Invalid OnPlayerPickUpDynamicPickup detect - 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: Invalid OnPlayerPickUpDynamicPickup detect (
/showthread.php?tid=653137)
Invalid OnPlayerPickUpDynamicPickup detect -
Jonggol - 27.04.2018
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(playerid, pickupid)
{
for (new i; i != MAX_DEALER; i++) if(DealershipData[i][dExists] && (pickupid == DealershipData[i][dPickup]))
{
ShowPlayerFooter(playerid, sprintf("~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
Re: Invalid OnPlayerPickUpDynamicPickup detect -
Logic_ - 27.04.2018
Move the
if statement inside the loop. That's awful way to write that code.
PHP код:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
for (new i; i != MAX_DEALER; i++)
{
if (!DealershipData[i][dExists] && pickupid != DealershipData[i][dPickup]) continue;
ShowPlayerFooter(playerid, sprintf("~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;
}
Re: Invalid OnPlayerPickUpDynamicPickup detect -
Jonggol - 27.04.2018
Quote:
Originally Posted by Logic_
Move the if statement inside the loop. That's awful way to write that code.
PHP код:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
for (new i; i != MAX_DEALER; i++)
{
if (!DealershipData[i][dExists] && pickupid != DealershipData[i][dPickup]) continue;
ShowPlayerFooter(playerid, sprintf("~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.