Hi, I encountered a problem with setPedAnalogControlState while trying to make the ped walking forward.
That's the code I used:
function pedrespawn(pedID)
if (isPedDead(pedID))
then
destroyElement(pedID)
ped1 = createPed (120, 2495.55, -1665.46, 14)
setPedRotation(ped1, 270)
setPedAnalogControlState(ped1, 'walk', 1) ----[b][u]This line displays the error message[/u][/b]
end
end
function timerrespawn() --int totalAmmo, element killer, int killerWeapon, int bodypart, bool stealth
setTimer(pedrespawn, 2000, 1, source)
end
addEventHandler ("onPedWasted", getRootElement(), timerrespawn)
The ped is standing still and the error message is displayed
The message is - ERROR: server.lua:35: attemt to call global 'setPedAnalogControlState' (35th line is the one marked as 7th in the code I posted)
I was looking for a fix at mta's wiki, google and this forum but can't find a reason for this error and solution. Thanks in advance for any advice.