Command question. - 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: Command question. (
/showthread.php?tid=412111)
Command question. -
Strier - 31.01.2013
Getting used to pawno everyday, but as every new starter we have to comit mistakes.
So here's the command
pawn Код:
CMD:ee(playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid))
if(gClass[playerid] != CLASS_PILOT) return SP COLOR_RED, "[ERROR]: You need to be a Pilot (Rank "#PILOT_RANK"); to use this command");
{
GetPlayerPos(playerid, EX,EY,EZ);
SetPlayerPos(playerid, EX,EY,EZ+5);
GivePlayerWeapon(playerid, 46, 1);
}
}else return SP COLOR_RED, "[ERROR]: You are not in any vehicle");
}
Error in line
Error name: Invalid function or declaration.
Re: Command question. -
tyler12 - 31.01.2013
pawn Код:
CMD:ee(playerid, params[])
{
new Float:EX,Float:EY,Float:EZ;
if(!IsPlayerInAnyVehicle(playerid))
if(gClass[playerid] != CLASS_PILOT) return SP COLOR_RED, "[ERROR]: You need to be a Pilot (Rank "#PILOT_RANK"); to use this command");
{
GetPlayerPos(playerid, EX,EY,EZ);
SetPlayerPos(playerid, EX,EY,EZ+5);
GivePlayerWeapon(playerid, 46, 1);
}
else
{
SP COLOR_RED, "[ERROR]: You are not in any vehicle");
}
return 1;
}
Re: Command question. -
Roach_ - 31.01.2013
This will totally work:
pawn Код:
CMD:ee(playerid)
{
if(!IsPlayerInAnyVehicle(playerid)) return SP COLOR_RED, "[ERROR]: You are not in any vehicle");
if(gClass[playerid] != CLASS_PILOT) return SP COLOR_RED, "[ERROR]: You need to be a Pilot (Rank "#PILOT_RANK"); to use this command");
GetPlayerPos(playerid, EX,EY,EZ);
SetPlayerPos(playerid, EX,EY,EZ+5);
GivePlayerWeapon(playerid, 46, 1);
}
AW: Re: Command question. -
Blackazur - 31.01.2013
Quote:
Originally Posted by Roach_
This will totally work:
pawn Код:
CMD:ee(playerid) { if(!IsPlayerInAnyVehicle(playerid)) return SP COLOR_RED, "[ERROR]: You are not in any vehicle"); if(gClass[playerid] != CLASS_PILOT) return SP COLOR_RED, "[ERROR]: You need to be a Pilot (Rank "#PILOT_RANK"); to use this command");
GetPlayerPos(playerid, EX,EY,EZ); SetPlayerPos(playerid, EX,EY,EZ+5); GivePlayerWeapon(playerid, 46, 1); }
|
Agree!
Respuesta: Command question. -
Strier - 31.01.2013
Worked thanks
Re: Command question. -
mamorunl - 31.01.2013
To give you the explanation on why your first code did not work: you were missing an opening bracket on your if(isPlayerInAnyVehicle) statement.
pawn Код:
if(!IsPlayerInAnyVehicle(playerid)) {