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



OnPlayerPickupPickup - Blackazur - 21.09.2013

Hello, i need help with that and my problem is when someone using fake killing he get banned (yeah, that's fine) but the pickups duplicate so that on a map many many pickups are and players abusing that, so how to fix that it don't duplicate?

Код:
new randomxp = random(35);
format(string,sizeof(string),"~w~+~g~%d ~w~XP",randomxp);
GameTextForPlayer(playerid,string,4000,5);
pInfo[playerid][pXP] += randomxp;
DestroyPickup(meatDrops[playerid]);



Re: OnPlayerPickupPickup - hossa - 23.09.2013

Create a timer to create the pickup
like 2 seconds, if the player is connected, create the pickup, if the player isn't connected return 0;


Re: OnPlayerPickupPickup - CesarLT - 23.09.2013

pawn Код:
if(PickedUpPickup[playerid] != 0)//If they have picked up a pickup...
    {
        SendClientMessage(playerid, COLOR_ORANGE, "**[SERVER]** {FFFFFF}- You need to wait at least {FF0000}5 seconds{FFFFFF} before picking up another pickup!");
        return 1;//Ends the code, not allowing the pickup.
    }
    PickedUpPickup[playerid] = 1;//Sets the 'PickedUpPickup' variable to has picked somthing up.
    SetTimerEx("PickedUpPickupReset", 4500, false, "i", playerid);
Bottom of your script:

pawn Код:
public PickedUpPickupReset (playerid)//The timer that resets the variable 'PickedUpPickup' to 0 (Nothing picked up within 4.5 seconds).
{
      PickedUpPickup[playerid] = 0;
      return 1;
}
Enjoy!

P.S. - Credit for that goes to: jakejohnsonusa.