SA-MP Forums Archive
Help with moving gate - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with moving gate (/showthread.php?tid=449629)



Help with moving gate - Lajko1 - 09.07.2013

Hello community!

I got problem with scripting moving gates, what I want to do is that, when I come near to object and when I press press enter I want that my gate move, so I tried with this code.

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInRangeOfPoint(playerid,5.0,1566.500000 0,-1704.5999756,3620.5000000) && (PRESSED(KEY_ACTION)))
{
MoveObject(Jail3,1566.5000000,-1704.5999756,3620.5000000 +3.0,0.97);//This will move the gate
}
return 1;
}

But it doesn't work, why not ?
Thanks for help in advance =)


Re : Help with moving gate - yusei - 09.07.2013

if you use streamer you must use MoveDynamicObject

or try to Up Speed moving
MoveObject(Jail3,1566.5000000,-1704.5999756,3620.5000000 +3.0,5.00);


Re: Help with moving gate - Calabresi - 09.07.2013

You should use KEY_SECONDARY_ATTACK instead of KEY_ACTION if you want it to work with enter key.


Re: Help with moving gate - Lajko1 - 09.07.2013

Thank you, but it was my stupid fault, I entered wrong coordinates at IsPlayerInRangeOfPoint lol -.-'


Re: Help with moving gate - Pottus - 09.07.2013

IsPlayerInRangeOfPoint is the worst way to do this actually (If you have a lot of gates)