question about pickups - 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: question about pickups (
/showthread.php?tid=592238)
question about pickups -
Sawalha - 22.10.2015
hi,
i just went to samp wiki to get more info about pickups, there at CreatePickup function and i just couldn't understand this sentence:
Quote:
It is possible that if DestroyPickup() is used when a pickup is picked up, more than one player can pick up the pickup, due to lag. This can be circumvented through the use of variables.
|
i couldn't understand the solution, which is the last sentence, can someone explain it with an example, please?
AW: question about pickups -
Kaliber - 22.10.2015
It means, that the native function for DestroyPickup can lagg...and then the player can pickup an pickup even if it should be destroyed. You can use variables to prevent this:
PHP код:
new pickup;
//OnGameModeInit
pickup = CreatePickup(...);
//OnPlayerPickupPickup
if(pickup == pickupid)
{
DestroyPickup(pickup);
pickup = -1; //This is meant, here you prevent the lagg. Because then the if-is invalid...even if the pickup exists
}
Re: question about pickups -
Sawalha - 22.10.2015
how can setting pickup variable value to an invalid id help?