SA-MP Forums Archive
i don't understand settimer - 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: i don't understand settimer (/showthread.php?tid=123071)



i don't understand settimer - RobShakur - 24.01.2010

hello together,

I would like to know how I
a pickup where you get money so that you set again only after 30 seconds gets money


Re: i don't understand settimer - Jeffry - 24.01.2010

Okay,

Put this ON TOP of your script:
pawn Код:
new given[MAX_PLAYERS];
Put this under: OnGameModeInt
pawn Код:
moneys=CreatePickup(1274,1,2057.29, 1531.57, 10.67);
//The pickup (change the coords if you want) Its infront of ship (LV)
This under OnPlayerPickupPickup
pawn Код:
{
    if(pickupid == import)
        {
if(given[playerid]==1) return SendClientMessage(playerid, 0xFF0000AA, "Come back in 30 seconds!"); // if he got it already it returns

        SendClientMessage(playerid, 0x0A8F00FF, "You became 5000$! Come back in 30 seconds to get another 5000$.");
        GivePlayerMoney(playerid, 5000); // Gives him 5000
        given[playerid]=1;  // let the system know that he got it
        SetTimerEx("MGiver",30000,0,"d",playerid); // starts the 30 sec timer
}
In the end of your script:

pawn Код:
forward MGiver(playerid);
public MGiver(playerid)
{
    given[playerid]=0; // now he can enter again
}
This is untested, but it should work.
Would be nice if you say me if this was good.

Jeffry


Re: i don't understand settimer - RobShakur - 24.01.2010

what ?

can you make it easyier
id dont understand that ?

i make it and come error


Re: i don't understand settimer - [dN]Eagle - 24.01.2010

Код:
{
	if(pickupid == import)
		{
if(given[playerid]==1) return SendClientMessage(playerid, 0xFF0000AA, "Come back in 30 seconds!"); // if he got it already it returns
else
	SendClientMessage(playerid, 0x0A8F00FF, "You became 5000$! Come back in 30 seconds to get another 5000$.");
	GivePlayerMoney(playerid, 5000); // Gives him 5000
     given[playerid]=1;  // let the system know that he got it
     SetTimerEx("MGiver",30000,0,"d",playerid); // starts the 30 sec timer
}



Re: i don't understand settimer - RobShakur - 24.01.2010

without forward or so

only copy and paste im beginner

sorry


Re: i don't understand settimer - RobShakur - 24.01.2010

(dn)eagle im sorry its functionaly