CMD Error
#1

hello i have problem in this command i dont know what its the problem
i try to fix it but no respond

help me fix it i need explen

Код:
command(taxi, playerid, params[])
{
	new id;
    if(IsPlayerConnected(playerid))
    {
		new name[128], string[128];
		if(sscanf(params, "z", name))
		{
			SendClientMessage(playerid, WHITE, "SYNTAX: /taxi [message of the day]");
		}
	    if(strcmp(name, "check", true) == 0)
	    {
		    if(IsPlayerConnected(playerid))
		    {
		        if(Accepted[playerid] == 1)
		        {
					if(sscanf(params, "u", id))
					{
						SendClientMessage(playerid, COLOR_WHITE, "USAGE: /taxi check [playerid]");
						return 1;
					}
					if(IsPlayerConnected(id))
					{
					    if(Player[playerid][Job] == 9)
					    {
					         new price;
					         new pname[MAX_PLAYER_NAME];
					         GetPlayerName(id,pname,sizeof(pname));
					         new zone[MAX_ZONE_NAME];
					         GetPlayer2DZone(id,zone,sizeof(zone));
					         price = Fare[id];
					         SendClientMessage(playerid,COLOR_YELLOW7,"|_____Taxi Check_____|");
					         format(string,sizeof(string),"Taxi Driver Name: %s(%d)",pname,id);
					         SendClientMessage(playerid,COLOR_YELLOW7,string);
					         format(string,sizeof(string),"Taxi Location: %s",zone);
					         SendClientMessage(playerid,COLOR_YELLOW7,string);
				  	         format(string,sizeof(string),"Taxi Driver Phone Number: %d",Player[id][PhoneN]);
			    	         SendClientMessage(playerid,COLOR_YELLOW7,string);
					         format(string,sizeof(string),"Taxi Price: $%d",price);
				    	     SendClientMessage(playerid,COLOR_YELLOW7,string);
						}
						else
						{
						    SendClientMessage(playerid,COLOR_LIGHTRED,"He's not a taxi driver!");
						}
					}
					else
					{
					    SendClientMessage(playerid,COLOR_LIGHTRED,"Player is not online !");
						return 1;
					}
				}
				else
				{
				    SendClientMessage(playerid,COLOR_LIGHTRED,"There is no taxi that have accepted you yet!");
				}
			}
		}
	    if(strcmp(name, "duty", true) == 0)
	    {
		    if(Player[playerid][Job] == 9)
		    {
				if(IsPlayerInAnyVehicle(playerid))
				{
				    new vid = GetPlayerVehicleID(playerid);
			        if(GetVehicleModel(vid) == 420)
			        {
						new name1[128];
						if(sscanf(params, "z", name1))
						{
							SendClientMessage(playerid, COLOR_YELLOW7, "|_____ Taxi Commands _____|");
							SendClientMessage(playerid, COLOR_YELLOW7, "USAGE:/taxi duty [name]");
							SendClientMessage(playerid, COLOR_YELLOW7, "[Names] on, off.");
						}
					    if(strcmp(name1, "on", true) == 0)
					    {
							SendClientMessage(playerid,COLOR_WHITE,"Your now in Taxi Duty!");
							Accepted[playerid] = 0;
							SetPlayerColor(playerid,0xFBA16CFF);
							TaxiDuty[playerid] = 1;
							return 1;
						}
					    else if(strcmp(name1, "off", true) == 0)
					    {
							GameTextForPlayer(playerid,"~p~Left the duty",5000,5);
							TaxiDuty[playerid] = 0;
							if(TCustomer[playerid] < 9999)
							{
								CalledTaxi[TCustomer[playerid]] = 0;
								Accepted[TCustomer[playerid]] = 0;
							}
							return 1;
						}
					}
					else
					{
					    SendClientMessage(playerid,COLOR_LIGHTRED,"You need to own and drive the Taxi!");
					}
				}
				else
				{
				    SendClientMessage(playerid,COLOR_LIGHTRED,"You need to sit in that vehicle!");
				}
			}
			else
			{
			    SendClientMessage(playerid,COLOR_LIGHTRED,"Your not a Taxi Driver!");
			}
			return 1;
		}
	    if(strcmp(name, "accept", true) == 0)
	    {
		    if(Player[playerid][Job] == 9)
		    {
				if(IsPlayerInAnyVehicle(playerid))
				{
				    new vid = GetPlayerVehicleID(playerid);
			        if(GetVehicleModel(vid) == 420)
			        {
			            if(TaxiDuty[playerid] == 1)
			            {
							if(sscanf(params, "u", id))
							{
								SendClientMessage(playerid, COLOR_WHITE, "USAGE: /taxi accept [playerid]");
								return 1;
							}
							new pname[MAX_PLAYER_NAME];
							GetPlayerName(id,pname,sizeof(pname));
							new pname2[MAX_PLAYER_NAME];
							GetPlayerName(playerid,pname2,sizeof(pname2));
				            new zone[MAX_ZONE_NAME];
				            GetPlayer2DZone(id,zone,sizeof(zone));
							if(IsPlayerConnected(id))
							{
							    if(CalledTaxi[id] == 1 && Accepted[id] == 0)
							    {
									CalledTaxi[id] = 0;
									Accepted[id] = 1;
									Driver[id] = playerid;
									TCustomer[playerid] = id;
									format(string,sizeof(string),"You have accepted (%d)%s's taxi call.",id,pname);
									SendClientMessage(playerid,GREEN,string);
									format(string,sizeof(string),"Location: %s",zone);
									SendClientMessage(playerid,GREEN,string);
									format(string,sizeof(string),"%s(%d) Have accepted your taxi call.",pname2,playerid);
									SendClientMessage(id,GREEN,string);
									SendClientMessage(id,COLOR_PURPLE,"Use /taxi check [taxi driver] to check his fare price!");
								}
								else
								{
								    SendClientMessage(playerid,COLOR_LIGHTRED,"That player hasn't call for a taxi!Or his accepted already.");
								}
							}
							else
							{
							    SendClientMessage(playerid,COLOR_YELLOW,"That player is not connected!");
							    return 1;
							}
						}
			            else
						{
						    SendClientMessage(playerid,RED,"Your not in duty!");
						}
					}
					else
					{
					    SendClientMessage(playerid,RED,"You need to own and drive the Taxi!");
					}
				}
				else
				{
				    SendClientMessage(playerid,RED,"You need to sit in that vehicle!");
				}
			}
			else
			{
			    SendClientMessage(playerid,RED,"Your not a Taxi Driver!");
			}
		}
	    if(strcmp(name, "fare", true) == 0)
	    {
		    if(Player[playerid][Job] == 9)
		    {
				if(IsPlayerInAnyVehicle(playerid))
				{
				    new vid = GetPlayerVehicleID(playerid);
			        if(GetVehicleModel(vid) == 420)
			        {
			            if(TaxiDuty[playerid] == 1)
			            {
							if(sscanf(params, "u", id))
							{
								SendClientMessage(playerid, COLOR_WHITE, "USAGE: /taxi fare [price]");
								return 1;
							}
							if(id > 25 || id < 1){ return SendClientMessage(playerid,COLOR_LIGHTRED,"The fare price should be between 1 and 25$!"); }
							Fare[playerid] = id;
							if(Accepted[TCustomer[playerid]] < 9999)
							{
							    format(string,sizeof(string),"Your taxi driver raised the Fare Price to $%d",Fare[playerid]);
							    SendClientMessage(TCustomer[playerid],COLOR_WHITE,string);
							}
			    			format(string,sizeof(string),"You've raised your fare price to $%d",Fare[playerid]);
						    SendClientMessage(playerid,GREEN,string);
						    return 1;
						}
			            if(TaxiDuty[playerid] == 0)
						{
						    SendClientMessage(playerid,RED,"Your not in duty!");
						}
					}
					else
					{
					    SendClientMessage(playerid,RED,"You need to own and drive the Taxi!");
					}
				}
				else
				{
				    SendClientMessage(playerid,RED,"You need to sit in that vehicle!");
				}
			}
			else
			{
			    SendClientMessage(playerid,RED,"Your not a Taxi Driver!");
			}
			return 1;
		}
	    if(strcmp(name, "start", true) == 0)
	    {
		    if(Player[playerid][Job] == 9)
		    {
				if(IsPlayerInAnyVehicle(playerid))
				{
				    new vid = GetPlayerVehicleID(playerid);
				    new vehicleid = GetPlayerVehicleID(playerid);
				    for(new i = 0; i < MAX_PLAYERS; i++)
				    {
				        if(IsPlayerConnected(i))
				        {
				            if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == 3 && playerid != i)
				            {
				                new name[MAX_PLAYER_NAME];
				                GetPlayerName(i,name,sizeof(name));
				                if(GetPlayerMoney(i) < Fare[playerid])
				                {
				                    format(string, sizeof(string), "You need %d to enter this taxi!", Fare[playerid]);
									SendClientMessage(i, COLOR_LIGHTRED, string);
									RemovePlayerFromVehicle(i);
				                }
				                else
				                {
				                    if(TaxiDuty[playerid] == 1)
				                    {
				                        format(string, sizeof(string), "You paid $%d to the Taxi Driver.The clock beguns", Fare[playerid]);
										SendClientMessage(i, COLOR_WHITE, string);
										format(string, sizeof(string), "Passenger %s has entered your Taxi.He has paid the Fare price and the clocks beguns!", name);
										SendClientMessage(playerid, COLOR_WHITE, string);
										PayForTaxi[i] = Fare[playerid];
										GetFromTaxi[playerid] = Fare[playerid];
										Driver[i] = playerid;
										TrTime[i] = 1;
									}
									if(TaxiDuty[playerid] == 0)
									{
									    SendClientMessage(playerid,RED,"Your not in duty!");
									}
								}
							}
						}
					}
				}
				else
				{
				    SendClientMessage(playerid,RED,"You need to sit in that vehicle!");
				}
			}
			else
			{
			    SendClientMessage(playerid,RED,"Your not a Taxi Driver!");
			}
		}
	    if(strcmp(name, "stop", true) == 0)
	    {
		    if(Player[playerid][Job] == 9)
		    {
				if(IsPlayerInAnyVehicle(playerid))
				{
				    new vid = GetPlayerVehicleID(playerid);
				    new vehicleid = GetPlayerVehicleID(playerid);
				    for(new i = 0; i < MAX_PLAYERS; i++)
				    {
				        if(IsPlayerConnected(i))
				        {
				            if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == 3 && playerid != i)
				            {
								if(TrTime[i] > 0 && Driver[i] < 999)
								{
								    if(IsPlayerConnected(playerid))
									{
									    format(string, sizeof(string), "~w~The ride cost~n~~r~ $ %d",PayForTaxi[i]);
									    GameTextForPlayer(i, string, 5000, 5);
									    format(string, sizeof(string), "~w~Clock Stopped~n~~g~Earned $ %d",PayForTaxi[i]);
									    GameTextForPlayer(playerid, string, 5000, 5);
									    GivePlayerMoney(i,-PayForTaxi[i]);
									    GivePlayerMoney(playerid, PayForTaxi[i]);
										RemovePlayerFromVehicle(i);
										PayForTaxi[i] = 0;
										Driver[i] = 999;
										TrTime[i] = 0;
										TrTime[playerid] = 0;
										CalledTaxi[i] = 0;
										ShowMoney[i] = 0;
									}
								}
								else
								{
								    SendClientMessage(playerid,RED,"You haven't start the Taxi Clock!");
								}
							}
						}
					}
				}
				else
				{
				    SendClientMessage(playerid,RED,"You need to sit in that vehicle!");
				}
			}
			else
			{
			    SendClientMessage(playerid,RED,"Your not a Taxi Driver!");
			}
		}
	}
	return 1;
}
Reply
#2

What are the errors?Also use [PAWN] instead of [HTML]
Reply
#3

There is no error when i type the cmd its write me
SYNTAX: /taxi [message of the day]
"There is no taxi that have accepted you yet!"

and more else i think the problem is here
Код:
if(sscanf(params, "u", id))
{
but i dont get it
Reply
#4

Bump i need help guys please
Reply
#5

Replace "u" with "d". All my zcmd commands were giving the same error. I changed u with d and all was fine.
Reply
#6

it doesnt work more help please !
Reply
#7

By adding these lines, you force the cmd to accept only 1 variable, the name string:
pawn Код:
if(sscanf(params, "z", name))
        {
            SendClientMessage(playerid, WHITE, "SYNTAX: /taxi [message of the day]");
        }
You have to use only once the sscanf function like this:
pawn Код:
if(sscanf(params, "s[128]u", name, id))
{
    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /taxi check [playerid]");
    return 1;
}
EDIT:

P.S.: I have also tried to make a command having a different output when I enter 1 input and another output if i enter 2 inputs, but failed.
Reply
#8

doesnt work some one else can help me please i need it
Reply
#9

I have this problem help+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)