Problem with a command
#1

So I have a RPG server, and I wanted to put a command to find my car. And I got some errors.

That's the command

Код:
CMD:findcar(playerid, params[])
{

    if(CP[playerid] >= 1 || CPR[playerid] >= 1 || playerVariables[playerid][pCheckpoint] >= 1)
    return SendClientMessage(playerid, COLOR_GREY, "Foloseste /killcp pentru a folosi comanda !");

    new carslot;
	if(sscanf(params, "d", carslot)) return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/findcar [1/2/3/4]");
	{
		if(playerVariables[playerid][pCarModel1] >= 1 || playerVariables[playerid][pCarModel2] >= 1 || playerVariables[playerid][pCarModel3] >= 1 || playerVariables[playerid][pCarModel4] >= 1)
		{
		    if(carslot == 1)
		    {
				GetVehiclePos(playerVariables[playerid][pCarID1], playerVariables[playerid][pCarPos1][0], playerVariables[playerid][pCarPos1][1], playerVariables[playerid][pCarPos1][2]);
				SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos1][0], playerVariables[playerid][pCarPos1][1], playerVariables[playerid][pCarPos1][2], 10.0);
				playerVariables[playerid][pCheckpoint] = 4;

				format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel1] - 400]);
				SendClientMessage(playerid, COLOR_WHITE, szMessage);
			}
			else if(carslot == 2)
			{
			    GetVehiclePos(playerVariables[playerid][pCarID2], playerVariables[playerid][pCarPos2][0], playerVariables[playerid][pCarPos2][1], playerVariables[playerid][pCarPos2][2]);
				SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos2][0], playerVariables[playerid][pCarPos2][1], playerVariables[playerid][pCarPos2][2], 10.0);
				playerVariables[playerid][pCheckpoint] = 4;

				format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel2] - 400]);
				SendClientMessage(playerid, COLOR_WHITE, szMessage);

			}
			else if(carslot == 3)
			{
			    GetVehiclePos(playerVariables[playerid][pCarID3], playerVariables[playerid][pCarPos3][0], playerVariables[playerid][pCarPos3][1], playerVariables[playerid][pCarPos3][2]);
				SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos3][0], playerVariables[playerid][pCarPos3][1], playerVariables[playerid][pCarPos3][2], 10.0);
				playerVariables[playerid][pCheckpoint] = 4;

				format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel3] - 400]);
				SendClientMessage(playerid, COLOR_WHITE, szMessage);

			}
			else if(carslot == 4)
			{
			    GetVehiclePos(playerVariables[playerid][pCarID4], playerVariables[playerid][pCarPos4][0], playerVariables[playerid][pCarPos4][1], playerVariables[playerid][pCarPos4][2]);
				SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos4][0], playerVariables[playerid][pCarPos4][1], playerVariables[playerid][pCarPos4][2], 10.0);
				playerVariables[playerid][pCheckpoint] = 4;

				format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel4] - 400]);
				SendClientMessage(playerid, COLOR_WHITE, szMessage);

			}
			else SendClientMessage(playerid, COLOR_GREY, "Invalid car slot id.");
		}
		else SendClientMessage(playerid, COLOR_GREY, "You don't own a vehicle.");
	}
	return 1;
}
And the errors: http://imgur.com/a/4mi0j

Help me please
Reply
#2

Hello.

The mistake is here:
PHP код:
if(sscanf(params"d"carslot)) return SendClientMessage(playeridCOLOR_GREYSYNTAX_MESSAGE"/findcar [1/2/3/4]"); 
to
PHP код:
if(sscanf(params"d"carslot)) return SendClientMessage(playeridCOLOR_GREY,"SYNTAX_MESSAGE /findcar [1/2/3/4]"); 
I don't know how you want to use "SYNTAX_MESSAGE", but this is a way to remove the error. Maybe SYNTAX_MESSAGE is a color in your script, you have to check this.
Reply
#3

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Hello.

The mistake is here:
PHP код:
if(sscanf(params"d"carslot)) return SendClientMessage(playeridCOLOR_GREYSYNTAX_MESSAGE"/findcar [1/2/3/4]"); 
to
PHP код:
if(sscanf(params"d"carslot)) return SendClientMessage(playeridCOLOR_GREY,"SYNTAX_MESSAGE /findcar [1/2/3/4]"); 
I don't know how you want to use "SYNTAX_MESSAGE", but this is a way to remove the error. Maybe SYNTAX_MESSAGE is a color in your script, you have to check this.
SYNTAX_MESSAGE is definitely not a color. I'm pretty sure it's intended as a defined string.
PHP код:
#define SYNTAX_MESSAGE "Syntax: " 
Reply
#4

As I said I don't know what SYNTAX_MESSAGE is because it's the script of DarkElement and I can't see this.
We only can speculate.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)