error 010: invalid function or declaration
#1

My code is
Код:
public OnPlayerCommandText(playerid,cmdtext[])

if (!strcmp("/racetrack",cmdtext,true))
{
	SetPlayerInterior(playerid,0);
	if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
   {
		LinkVehicleToInterior(GetPlayerVehicleID(playerid),0);
		SetVehiclePos(GetPlayerVehicleID(playerid),-521.0,-3643.0,7.0);
		SetVehicleZAngle(GetPlayerVehicleID(playerid),0.0);
	}
	else
	{
		SetPlayerPos(playerid,-521.0,-3643.0,7.0);
		SetPlayerFacingAngle(playerid,0.0);
	}
	return 1;
}
and i am getting the error error 010: invalid function or declaration
Reply
#2

if(strcmp(cmd, "/racetrack", true) == 0)
Reply
#3

Quote:
Originally Posted by skuller12
Посмотреть сообщение
if(strcmp(cmd, "/racetrack", true) == 0)
didnt works
Reply
#4

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/racetrack", cmdtext, true, 10) == 0)
	{
		SetPlayerInterior(playerid,0);
		if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
		{
			LinkVehicleToInterior(GetPlayerVehicleID(playerid),0);
			SetVehiclePos(GetPlayerVehicleID(playerid),-521.0,-3643.0,7.0);
			SetVehicleZAngle(GetPlayerVehicleID(playerid),0.0);
		}
		else
		{
			SetPlayerPos(playerid,-521.0,-3643.0,7.0);
			SetPlayerFacingAngle(playerid,0.0);
		}
		return 1;
	}
	return 0;
}
Reply
#5

thanks it works now
Reply
#6

Top script

Код:
#define	function%0(%1) forward%0(%1); public%0(%1)
And replace with code:

Код:
function OnPlayerCommandText(playerid,cmdtext[])
{
if(strcmp(cmd, "/racetrack", true) == 0) 
{
	SetPlayerInterior(playerid, 0);
	if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
		LinkVehicleToInterior(GetPlayerVehicleID(playerid),0);
		SetVehiclePos(GetPlayerVehicleID(playerid),-521.0,-3643.0,7.0);
		SetVehicleZAngle(GetPlayerVehicleID(playerid),0.0);
	}
	else
	{
		SetPlayerPos(playerid,-521.0,-3643.0,7.0);
		SetPlayerFacingAngle(playerid,0.0);
	}
	return 1;
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)