SA-MP Forums Archive
Need help with some callbacks. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help with some callbacks. (/showthread.php?tid=199530)



Need help with some callbacks. - Rokzlive - 15.12.2010

Ok, i am making a ferry for my server, and i need it to where if they are on the ferry, they go with the ferry when the timer activates to move it, and charges them a fee.

I got a timer that when it goes does moveobject, but heres where i need help.
I need it so that people on the ferry go with it.
SO i need help so that when the timer activtes it sees if the person is on it (isplayernearcheckpoint or something) Sets the vehicle velocity to the same speed as the ferry, and i can figure out the rest. How can i do that.

Ps, im using an aircraft carrier as my ferry so hhow many check points or whatever would i need to set? And i need it so that it doed not think people on the docks are on the ferry.


Re: Need help with some callbacks. - Benjo - 15.12.2010

You could look into using the IsPlayerInRangeOfPoint function for the player's position check. Perhaps find the centre coordinate of the ferry and then specify a range around that?
https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint

If you are willing to collect a few coordinates, you could use this IsPlayerInArea function:
pawn Код:
IsPlayerInArea(playerid,Float:max_x,Float:min_x,Float:max_y,Float:min_y)
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    if(X <= max_x && X >= min_x && Y <= max_y && Y >= min_y) {
        return 1;
    }
    return 0;
}
That could be used to make sure players are on the ferry, and are not on the dock. Just a few suggestions to get the ball rolling!


Re: Need help with some callbacks. - The_Gangstas - 15.12.2010

how about, setting there pos then SetPlayerSpecialAction(playerid,SPECIAL_ACTION_SIT TING); ?