SA-MP Forums Archive
My Taxi Job simple error - 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: My Taxi Job simple error (/showthread.php?tid=319695)



My Taxi Job simple error - Nuke547 - 19.02.2012

Basically everything works, its just that when there are no taxi drivers are on duty, it gets raped and constantly sends that same message, "There are no taxi drivers on duty.".

Heres my code:

PHP код:
command(serviceplayeridparams[])
{
    new 
Usage[30], string[128];
    if(
sscanf(params"z"Usage))
    {
        
SendClientMessage(playeridWHITE"SYNTAX: /service [usage]");
        
SendClientMessage(playeridWHITE"Usage: taxi");
    }
    else
    {
        if(
strcmp(Usage"taxi"true) == 0)
        {
            for(new 
0MAX_PLAYERSi++)
            {
                if(
IsPlayerConnectedEx(i) && (Player[i][Job] == || Player[i][Job2] == 8) && OnTaxiDuty[i] == 1)
                {
                    
SendClientMessage(playeridWHITE"You have requested a taxi. Please be patient, and stay where you are.");
                    
format(stringsizeof(string), "%s[ID:%d] has requested a taxi. To take his call, use /accepttaxi [playerid]"GetNameU(playerid), playerid);
                    
SendClientMessage(iWHITEstring);
                    
PendingTaxiRequest[playerid] = 1;
                }
                else if(
OnTaxiDuty[i] == 0)
                {
                    
SendClientMessage(playeridWHITE"There are no taxi drivers on duty.");
                }
            }
        }
        else
        {
            
SendClientMessage(playeridWHITE"That is an invailid option.");
        }
    }




Re: My Taxi Job simple error - JhnzRep - 19.02.2012

pawn Код:
for (new i = 0; i != MAX_PLAYERS; ++i)
Try this.


Re: My Taxi Job simple error - Nuke547 - 19.02.2012

Quote:
Originally Posted by JhnzRep
Посмотреть сообщение
pawn Код:
for (new i = 0; i != MAX_PLAYERS; ++i)
Try this.
Nope, I just replaced it, but it still repeats it.


Re: My Taxi Job simple error - JhnzRep - 19.02.2012

pawn Код:
command(service, playerid, params[])
{
    new Usage[30], string[128];
    if(sscanf(params, "z", Usage))
    {
        SendClientMessage(playerid, WHITE, "SYNTAX: /service [usage]");
        SendClientMessage(playerid, WHITE, "Usage: taxi");
    }
    else
    {
        if(strcmp(Usage, "taxi", true) == 0)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnectedEx(i) && (Player[i][Job] == 8 || Player[i][Job2] == 8) && OnTaxiDuty[i] == 1)
                {
                    SendClientMessage(playerid, WHITE, "You have requested a taxi. Please be patient, and stay where you are.");
                    format(string, sizeof(string), "%s[ID:%d] has requested a taxi. To take his call, use /accepttaxi [playerid]", GetNameU(playerid), playerid);
                    SendClientMessage(i, WHITE, string);
                    PendingTaxiRequest[playerid] = 1;
                }
                else if(OnTaxiDuty[i] == 0)
                {
                    SendClientMessage(playerid, WHITE, "There are no taxi drivers on duty.");
                }
            }
        }
        else
        {
            SendClientMessage(playerid, WHITE, "That is an invailid option.");
        }
    }
    return 1;
}
EDIT: Just went on Explict RP, and when I called a taxi, it only send the message once.


Re: My Taxi Job simple error - Nuke547 - 19.02.2012

Didnt work


Re: My Taxi Job simple error - JhnzRep - 19.02.2012

Your server doesn't spam it though o.O


Re: My Taxi Job simple error - Nuke547 - 19.02.2012

Quote:
Originally Posted by JhnzRep
Посмотреть сообщение
Your server doesn't spam it though o.O
It does for everybody else.