SA-MP Forums Archive
Pickup - 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: Pickup (/showthread.php?tid=253240)



Pickup - Rock_Ro - 05.05.2011

Hey , today i was wondering how to make something like if somebody enter a pickup to rob or to get something to have to wait 10 maybe 20 seconds and if he leave pickup nothing happens.
I mean to make something work if they stay 10 seconds in the pickup.

So ...how to do it ?
Give me a simple example , i will understand .


Re: Pickup - MadeMan - 05.05.2011

pawn Код:
new RobTime[MAX_PLAYERS];
OnGameModeInit
pawn Код:
SetTimer("RobTimer", 1000, true);
pawn Код:
public RobTimer()
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInRangeOfPoint(i, 2.0, /*pickup coords*/))
            {
                RobTime[i]++;
                if(RobTime[i] == 10)
                {
                    // 10 seconds passed
                }
            }
            else
            {
                RobTime[i] = 0;
            }
        }
    }
}



Re: Pickup - Rock_Ro - 05.05.2011

Ooo , thanks man...really love you.
( I'm not gay )