Invalid OnPlayerPickUpDynamicPickup detect
#1

I have problem using OnPlayerPickUpDynamicPickup callback. I have dealership system using pickup as indicator to show the textdraw. Then i have entrance system using pickup too, but iam not using the callback for the pickup. The problem is on the entrance pickup, i can see the dealership detail textdraw when i am on entrance pickup, how can i fix this problem?

this is the code:

PHP код:
public OnPlayerPickUpDynamicPickup(playeridpickupid)
{
    for (new 
i!= MAX_DEALERi++) if(DealershipData[i][dExists] && (pickupid == DealershipData[i][dPickup]))
    {
        
ShowPlayerFooter(playeridsprintf("~n~~b~~h~%s~n~~g~~h~Stock: ~y~%d~n~~g~~h~Status: %s~n~~g~~h~type /buycar to buy"DealershipData[i][dName], DealershipData[i][dStock], (DealershipData[i][dLock] == 1) ? ("~r~~h~Close") : ("~g~~h~Open")), 1000);
    }
    return 
1;

Image: see green marker
Reply
#2

Move the if statement inside the loop. That's awful way to write that code.

PHP код:
public OnPlayerPickUpDynamicPickup(playeridpickupid

    for (new 
i!= MAX_DEALERi++)
    {
        if (!
DealershipData[i][dExists] && pickupid != DealershipData[i][dPickup]) continue;
        
ShowPlayerFooter(playeridsprintf("~n~~b~~h~%s~n~~g~~h~Stock: ~y~%d~n~~g~~h~Status: %s~n~~g~~h~type /buycar to buy"DealershipData[i][dName], DealershipData[i][dStock], (DealershipData[i][dLock] == 1) ? ("~r~~h~Close") : ("~g~~h~Open")), 1000); 
    } 
    return 
1

Reply
#3

Quote:
Originally Posted by Logic_
Посмотреть сообщение
Move the if statement inside the loop. That's awful way to write that code.

PHP код:
public OnPlayerPickUpDynamicPickup(playeridpickupid

    for (new 
i!= MAX_DEALERi++)
    {
        if (!
DealershipData[i][dExists] && pickupid != DealershipData[i][dPickup]) continue;
        
ShowPlayerFooter(playeridsprintf("~n~~b~~h~%s~n~~g~~h~Stock: ~y~%d~n~~g~~h~Status: %s~n~~g~~h~type /buycar to buy"DealershipData[i][dName], DealershipData[i][dStock], (DealershipData[i][dLock] == 1) ? ("~r~~h~Close") : ("~g~~h~Open")), 1000); 
    } 
    return 
1

Will try this, thanks for help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)