SA-MP Forums Archive
This command fucks my script - 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: This command fucks my script (/showthread.php?tid=603788)



This command doesn't work - NeXoR - 27.03.2016

This is my /accept taxi, When I remove the "/*" and "*/" my whole compiler is spammed with errors and warnings

Code:
Код:
if(!strcmp(params, "taxi", true))
	{
	    new playerb;
	    if(!IsATaxidriver(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "You are not a Taxi driver.");
	    if(AcceptedTaxi[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "You have already accepted a taxi call.");
	    if(sscanf(params, "s[128]i", params, playerb)) return SendClientMessage(playerid, COLOR_GREY, "/accept taxi [ID]");
	    if(!IsPlayerLoggedIn(playerb) && !IsPlayerNPC(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
	    if(OrderedTaxi[playerb] == 1)
		{
			format(string, sizeof(string), "You have accepted %s's Taxi call, He is now marked on your radar", RPN(playerb));
			SendClientMessage(playerid, COLOR_YELLOW, string);
			format(string, sizeof(string), "Taxi Driver %s is now on his way to you", RPN(playerid));
			SendClientMessage(playerb, COLOR_YELLOW, string);
			CP[playerid] = 8779;
			AcceptedTaxi[playerid] = 1;
			new Float:PosX, Float:PosY, Float:PosZ;
			GetPlayerPos(playerb, PosX, PosY, PosZ);
			SetPlayerCheckpoint(playerid, PosX, PosY, PosZ, 4.0);
			return 1;				}
		}
		else if(OrderedTaxi[playerb] == 0)
		{
		    SendClientMessage(playerid, COLOR_GREY, "This player hasn't ordered a Taxi");
		    return 1;
		}
	}*/



Re: This command fucks my script - Crystallize - 27.03.2016

How about posting the errors?


Re: This command fucks my script - Amads - 27.03.2016

Код:
if(!strcmp(params, "taxi", true))
	{
	    new playerb;
	    if(!IsATaxidriver(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "You are not a Taxi driver.");
	    if(AcceptedTaxi[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "You have already accepted a taxi call.");
	    if(sscanf(params, "s[128]i", params, playerb)) return SendClientMessage(playerid, COLOR_GREY, "/accept taxi [ID]");
	    if(!IsPlayerLoggedIn(playerb) && !IsPlayerNPC(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
	    if(OrderedTaxi[playerb] == 1)
		{
			format(string, sizeof(string), "You have accepted %s's Taxi call, He is now marked on your radar", RPN(playerb));
			SendClientMessage(playerid, COLOR_YELLOW, string);
			format(string, sizeof(string), "Taxi Driver %s is now on his way to you", RPN(playerid));
			SendClientMessage(playerb, COLOR_YELLOW, string);
			CP[playerid] = 8779;
			AcceptedTaxi[playerid] = 1;
			new Float:PosX, Float:PosY, Float:PosZ;
			GetPlayerPos(playerb, PosX, PosY, PosZ);
			SetPlayerCheckpoint(playerid, PosX, PosY, PosZ, 4.0);
			return 1;				}    <---- what is this doing here?
		}
		else if(OrderedTaxi[playerb] == 0)
		{
		    SendClientMessage(playerid, COLOR_GREY, "This player hasn't ordered a Taxi");
		    return 1;
		}
	}*/



Re: This command fucks my script - N0FeaR - 27.03.2016

try this

PHP код:
if(!strcmp(params"taxi"true))
    {
        new 
playerb;
        if(!
IsATaxidriver(playerid)) return SendClientMessage(playeridCOLOR_WHITE"You are not a Taxi driver.");
        if(
AcceptedTaxi[playerid] == 1) return SendClientMessage(playeridCOLOR_GREY"You have already accepted a taxi call.");
        if(
sscanf(params"s[128]i"paramsplayerb)) return SendClientMessage(playeridCOLOR_GREY"/accept taxi [ID]");
        if(!
IsPlayerLoggedIn(playerb) && !IsPlayerNPC(playerb)) return SendClientMessage(playeridCOLOR_GREY"Invalid player id.");
        if(
OrderedTaxi[playerb] == 1)
        {
            
format(stringsizeof(string), "You have accepted %s's Taxi call, He is now marked on your radar"RPN(playerb));
            
SendClientMessage(playeridCOLOR_YELLOWstring);
            
format(stringsizeof(string), "Taxi Driver %s is now on his way to you"RPN(playerid));
            
SendClientMessage(playerbCOLOR_YELLOWstring);
            
CP[playerid] = 8779;
            
AcceptedTaxi[playerid] = 1;
            new 
Float:PosXFloat:PosYFloat:PosZ;
            
GetPlayerPos(playerbPosXPosYPosZ);
            
SetPlayerCheckpoint(playeridPosXPosYPosZ4.0);
            return 
1;
        }
        else if(
OrderedTaxi[playerb] == 0)
        {
            
SendClientMessage(playeridCOLOR_GREY"This player hasn't ordered a Taxi");
            return 
1;
        }
    }*/ 



Re: This command fucks my script - NeXoR - 27.03.2016

Quote:
Originally Posted by N0FeaR
Посмотреть сообщение
try this

PHP код:
if(!strcmp(params"taxi"true))
    {
        new 
playerb;
        if(!
IsATaxidriver(playerid)) return SendClientMessage(playeridCOLOR_WHITE"You are not a Taxi driver.");
        if(
AcceptedTaxi[playerid] == 1) return SendClientMessage(playeridCOLOR_GREY"You have already accepted a taxi call.");
        if(
sscanf(params"s[128]i"paramsplayerb)) return SendClientMessage(playeridCOLOR_GREY"/accept taxi [ID]");
        if(!
IsPlayerLoggedIn(playerb) && !IsPlayerNPC(playerb)) return SendClientMessage(playeridCOLOR_GREY"Invalid player id.");
        if(
OrderedTaxi[playerb] == 1)
        {
            
format(stringsizeof(string), "You have accepted %s's Taxi call, He is now marked on your radar"RPN(playerb));
            
SendClientMessage(playeridCOLOR_YELLOWstring);
            
format(stringsizeof(string), "Taxi Driver %s is now on his way to you"RPN(playerid));
            
SendClientMessage(playerbCOLOR_YELLOWstring);
            
CP[playerid] = 8779;
            
AcceptedTaxi[playerid] = 1;
            new 
Float:PosXFloat:PosYFloat:PosZ;
            
GetPlayerPos(playerbPosXPosYPosZ);
            
SetPlayerCheckpoint(playeridPosXPosYPosZ4.0);
            return 
1;
        }
        else if(
OrderedTaxi[playerb] == 0)
        {
            
SendClientMessage(playeridCOLOR_GREY"This player hasn't ordered a Taxi");
            return 
1;
        }
    }*/ 
Well you are genius, would you mind explaining ?

EDIT -- The pawn compiles it but it doesnt really work > no CP, no SendClientMessage, nothing


Re: This command fucks my script - N0FeaR - 27.03.2016

Quote:
Originally Posted by NeXoR
Посмотреть сообщение
Well you are fucking genius, would you mind explaining ?

PHP код:
if(!strcmp(params"taxi"true))
    {
        new 
playerb;
        if(!
IsATaxidriver(playerid)) return SendClientMessage(playeridCOLOR_WHITE"You are not a Taxi driver.");
        if(
AcceptedTaxi[playerid] == 1) return SendClientMessage(playeridCOLOR_GREY"You have already accepted a taxi call.");
        if(
sscanf(params"s[128]i"paramsplayerb)) return SendClientMessage(playeridCOLOR_GREY"/accept taxi [ID]");
        if(!
IsPlayerLoggedIn(playerb) && !IsPlayerNPC(playerb)) return SendClientMessage(playeridCOLOR_GREY"Invalid player id.");
        if(
OrderedTaxi[playerb] == 1)
        {
            
format(stringsizeof(string), "You have accepted %s's Taxi call, He is now marked on your radar"RPN(playerb));
            
SendClientMessage(playeridCOLOR_YELLOWstring);
            
format(stringsizeof(string), "Taxi Driver %s is now on his way to you"RPN(playerid));
            
SendClientMessage(playerbCOLOR_YELLOWstring);
            
CP[playerid] = 8779;
            
AcceptedTaxi[playerid] = 1;
            new 
Float:PosXFloat:PosYFloat:PosZ;
            
GetPlayerPos(playerbPosXPosYPosZ);
            
SetPlayerCheckpoint(playeridPosXPosYPosZ4.0);
            return 
1;                }    <---- This was the problem.
        }
        else if(
OrderedTaxi[playerb] == 0)
        {
            
SendClientMessage(playeridCOLOR_GREY"This player hasn't ordered a Taxi");
            return 
1;
        }
    }*/ 



Re: This command fucks my script - NeXoR - 27.03.2016

Quote:
Originally Posted by N0FeaR
Посмотреть сообщение
PHP код:
if(!strcmp(params"taxi"true))
    {
        new 
playerb;
        if(!
IsATaxidriver(playerid)) return SendClientMessage(playeridCOLOR_WHITE"You are not a Taxi driver.");
        if(
AcceptedTaxi[playerid] == 1) return SendClientMessage(playeridCOLOR_GREY"You have already accepted a taxi call.");
        if(
sscanf(params"s[128]i"paramsplayerb)) return SendClientMessage(playeridCOLOR_GREY"/accept taxi [ID]");
        if(!
IsPlayerLoggedIn(playerb) && !IsPlayerNPC(playerb)) return SendClientMessage(playeridCOLOR_GREY"Invalid player id.");
        if(
OrderedTaxi[playerb] == 1)
        {
            
format(stringsizeof(string), "You have accepted %s's Taxi call, He is now marked on your radar"RPN(playerb));
            
SendClientMessage(playeridCOLOR_YELLOWstring);
            
format(stringsizeof(string), "Taxi Driver %s is now on his way to you"RPN(playerid));
            
SendClientMessage(playerbCOLOR_YELLOWstring);
            
CP[playerid] = 8779;
            
AcceptedTaxi[playerid] = 1;
            new 
Float:PosXFloat:PosYFloat:PosZ;
            
GetPlayerPos(playerbPosXPosYPosZ);
            
SetPlayerCheckpoint(playeridPosXPosYPosZ4.0);
            return 
1;                }    <---- This was the problem.
        }
        else if(
OrderedTaxi[playerb] == 0)
        {
            
SendClientMessage(playeridCOLOR_GREY"This player hasn't ordered a Taxi");
            return 
1;
        }
    }*/ 
Thanks you helped me very much, Although unfortunately the code doesn't work
Whenever I type /accept taxi and the person's id, nothing happenes, not a checkpoint, not SendClientMessage


Re: This command fucks my script - N0FeaR - 27.03.2016

Quote:
Originally Posted by NeXoR
Посмотреть сообщение
Thanks you helped me very much, Although unfortunately the code doesn't work
Whenever I type /accept taxi and the person's id, nothing happenes, not a checkpoint, not SendClientMessage
Show me OrderedTaxi please.


Re: This command fucks my script - NeXoR - 28.03.2016

bump


Re: This command fucks my script - thefirestate - 28.03.2016

How about making it with ZCMD and SSCANF? It would be much easier and it would much faster than strcmp. If you actually change it I might help you but otherwise no.