A_TERMINATOR Posted March 27, 2012 Share Posted March 27, 2012 Hi, I have this code: It's in onClientPlayerRender: if (Created == 0) then x,y,z = getElementPosition(getLocalPlayer()) x1, y1, z1 = -2816.4443,-1523.5574,140.8438 end if (getDistanceBetweenPoints3D(x,y,z, x1, y1, z1) < 3.0) and (Created == 0) then Created = 1 zombangle = ( 360 - math.deg ( math.atan2 ( ( x - x1 ), ( y - y1 ) ) ) ) % 360 ped = createPed(0, x1, y1, z1, zombangle) setPedControlState(ped, "fire", true) callServerFunction("giveWeapon", ped, 9, 9999, true) setTimer(check, 1000, 0) setPedHeadless(ped, true) end and timer function: function check() local x,y,z = getElementPosition(getLocalPlayer()) local x1, y1, z1 = -2816.4443,-1523.5574,140.8438 if (getDistanceBetweenPoints3D(x,y,z, x1, y1, z1) < 3.0) then zombangle = ( 360 - math.deg ( math.atan2 ( ( x - x1 ), ( y - y1 ) ) ) ) % 360 setPedRotation(ped, zombangle) setPedControlState(ped, "fire", true) end end And on spawns bot, setPedControlState works perfectly, but in function "check" doesn't work And "giveWeapon" doesn't work also... But in function check, setPedRotation works perfectly... Please help me Link to comment
drk Posted March 27, 2012 Share Posted March 27, 2012 Maybe because you never call function check and callServerFunction not exists? Link to comment
A_TERMINATOR Posted March 27, 2012 Author Share Posted March 27, 2012 OK, It works. I do it in server-side, and everything is work. (I have definied callServerFunction) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now