question about pickups
#1

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?
Reply
#2

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

Reply
#3

how can setting pickup variable value to an invalid id help?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)