The messages are being spammed for every dynamic pickup in the server.
What am I doing wrong?
What am I doing wrong?
PHP Code:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
for(new t = 0; t < sizeof(Tolls); t++)
{
if(pickupid == Tolls[t][fPickup] || Tolls[t][sPickup]) //if(IsPlayerInRangeOfPoint(i, 4, Tolls[t][tX], Tolls[t][tY], Tolls[t][tZ]))
{
if(Tolls[t][tStatus] == 1)
{
ProxDetector(20.0, playerid, "Toll guard says: Sorry, the tolls aren't available right now.", COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
}
else
{
if(Player[playerid][CopDuty])
{
ProxDetector(20.0, playerid, "Toll guard says: Hello officer, would you like to pass?", COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
SendClientMessage(playerid, COLOR_GOLD, "Use \"/opentolls\" to open the toll.");
}
else
{
ProxDetector(20.0, playerid, "Toll guard says: Hello, the toll is $50 to go through.", COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
SendClientMessage(playerid, COLOR_GOLD, "Use \"/opentolls\" to open the toll.");
}
}
}
}
return 1;
}