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



Pickup abuse.. - ThePhill97 - 23.11.2012

I have this code
pawn Code:
if(pickupid == copdutypoint)
{
    if(GetPlayerTeam(playerid) == 100)
    {
        GivePlayerWeapon(playerid, 3, 1);
        GivePlayerWeapon(playerid, 22, 99);
        GivePlayerWeapon(playerid, 27, 50);
        new string[250];
        new Name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, Name, sizeof(Name));

        format(string,sizeof(string),"%s has gone on duty and collected their guns",Name);
        SendClientMessageToAll(0x33AA33AA, string);
    }
    else
    SendClientMessage(playerid, 0xAA3333AA, "You can't go on duty! You're not a cop");
}
It gives them guns with some ammo, but if you stay there after collecting your first set of guns.. then stay in the checkpoint for another few secs you get more. then wait again.. more how can I set it to wait 2 minutes before collecting more?


Re: Pickup abuse.. - Babul - 23.11.2012

Code:
if(pickupid == copdutypoint)
{
    if(GetPlayerTeam(playerid) == 100)
    {
		if(GetTickCount()-GetPVarInt(playerid,"CopDutyPickupMS")>120000)
		{
			SetPVarInt(playerid,"CopDutyPickupMS",GetTickCount());
			GivePlayerWeapon(playerid, 3, 1);
			GivePlayerWeapon(playerid, 22, 99);
			GivePlayerWeapon(playerid, 27, 50);
			new string[250];
			new Name[MAX_PLAYER_NAME];
			GetPlayerName(playerid, Name, sizeof(Name));
			format(string,sizeof(string),"%s has gone on duty and collected their guns",Name);
			SendClientMessageToAll(0x33AA33AA, string);
		}
		else
		{
			GameTextForPlayer(playerid,"you already refilled some shit - go away!",4000,4);
		}
    }
    else
    SendClientMessage(playerid, 0xAA3333AA, "You can't go on duty! You're not a cop");
}