Got it from a website-
#raw 0x7C 0x1D 0x00 'check to see if one of our pokes knows Headbutt!
compare LASTRESULT 0x06 'if none of them do
if 1 jump $could 'jump to the "this tree could be headbutted" comment
#raw 0x9D 0x00 0x0D 0x80 'store PKMN for animation
#raw 0x7F 0x00 0x0D 0x80 'store PKMNs name to \v\h02
#raw 0x82 0x01 0x1D 0x00 'store HEADBUTT to \v\h03
$question 1 = This tree could have a Pokemon\nin it. Use HEADBUTT?
compare LASTRESULT 0x00 'if they say no...
if 1 jump $end 'break off now
message $used 'show X used Y!
$used 1 = \v\h02 used \v\h03!
#raw 0x68 'im not sure what this is used for here, but best include it
#raw 0x9C 0x25 0x00 'there is no animation for HEADBUTT, so use the ROCK SMASH one
#raw 0x27 'as above
jump 0x1Be06F 'games inbuilt code for "Trees" pokemon encounter
$you 1 = This tree could be HEADBUTTed!