SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 05/06/2017, 02:08 PM   #1
Ilias_
Banned
 
Join Date: Jan 2017
Location: Greece
Posts: 195
Reputation: 22
Default error 010: invalid function or declaration

My code is
Code:
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
Ilias_ is offline   Reply With Quote
Old 05/06/2017, 02:10 PM   #2
skuller12
Big Clucker
 
Join Date: Feb 2015
Location: Galati, Romania
Posts: 101
Reputation: 0
Default Re: error 010: invalid function or declaration

if(strcmp(cmd, "/racetrack", true) == 0)
skuller12 is offline   Reply With Quote
Old 05/06/2017, 02:13 PM   #3
Ilias_
Banned
 
Join Date: Jan 2017
Location: Greece
Posts: 195
Reputation: 22
Default Re: error 010: invalid function or declaration

Quote:
Originally Posted by skuller12 View Post
if(strcmp(cmd, "/racetrack", true) == 0)

didnt works
Ilias_ is offline   Reply With Quote
Old 05/06/2017, 02:14 PM   #4
MrFantasy
Little Clucker
 
Join Date: Mar 2017
Posts: 36
Reputation: 1
Default Re: error 010: invalid function or declaration

Code:
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;
}
MrFantasy is offline   Reply With Quote
Old 05/06/2017, 02:15 PM   #5
Ilias_
Banned
 
Join Date: Jan 2017
Location: Greece
Posts: 195
Reputation: 22
Default Re: error 010: invalid function or declaration

thanks it works now
Ilias_ is offline   Reply With Quote
Old 05/06/2017, 02:15 PM   #6
skuller12
Big Clucker
 
Join Date: Feb 2015
Location: Galati, Romania
Posts: 101
Reputation: 0
Default Re: error 010: invalid function or declaration

Top script

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

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;
}
skuller12 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
: error 010: invalid function or declaration Spartaaaaa Scripting Help 8 29/07/2014 06:08 PM
Weird error: invalid symbol name and invalid function or declaration Reboma Scripting Help 1 04/02/2014 10:58 AM
error 010: invalid function or declaration & warning 235: public function lacks forward declaration (symbol "Drag") tboysamp Scripting Help 1 14/04/2013 05:10 AM
error 010: invalid function or declaration DarkB0y Scripting Help 15 10/09/2012 10:26 AM
error 010: invalid function or declaration Meinstad Scripting Help 6 10/11/2011 01:33 PM


All times are GMT. The time now is 05:29 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.