Spawn Vehicle Command not working - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Spawn Vehicle Command not working (
/showthread.php?tid=181890)
Spawn Vehicle Command not working -
jameskmonger - 07.10.2010
Код:
if (!strcmp (cmdtext,"/spawncar", true))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "USAGE: /spawncar [modelid]");
return 1;
}
new thecar = strval(tmp);
if(IsPlayerAdmin(playerid)) //Is the player rcon admin?
{
if(thecar > 399 && thecar < 612)
{
if(!IsPlayerInAnyVehicle(playerid)) //the "!" means that if "IsPlayerInVehicle" returns false, the code will execute, if not, the return code will.
{
GetPlayerPos(playerid, Float:X, Float:Y, Float:Z);
GetPlayerFacingAngle(playerid, Float:Angle);
CreateVehicle(thecar, X, Y, Z + 2.0, Angle + 90.0, -1, -1, 5000);
return 1;
}
return SendClientMessage(playerid,0xFF0000FF,"You are already in a vehicle!"); //If the player already is in a vehicle, this will happen
}
return SendClientMessage(playerid, COLOR_WHITE, "Invalid ID");
}
return SendClientMessage(playerid,0xFF0000FF,"Access denied!"); //If the player wasn't logged in to rcon, this happens.
}
I log into the RCON, do /spawncar 462 and it says Unknown Command.
Re: Spawn Vehicle Command not working -
Tommie1331 - 07.10.2010
TRY /RCON SPAWNCAR ID it rcon on mine dunno why if it doesnt work try recon but i dont use it that often so i may be wrong
Re: Spawn Vehicle Command not working -
Grim_ - 07.10.2010
Make sure your OnPlayerCommandText callback returns 0.
Re: Spawn Vehicle Command not working -
Lenny the Cup - 07.10.2010
Edit: What he said
Re: Spawn Vehicle Command not working -
jameskmonger - 08.10.2010
Grim, it returns 0.
Re: Spawn Vehicle Command not working -
Rachael - 08.10.2010
!strcmp(cmdtext,"/spawncar",true) might not return true if you type '/spawncar <anynumber>'
in other words, if you enter a parameter after the command, the command will not be recognised.
to test this type /spawncar, it should tell you 'USAGE: /spawncar [model]'
you can fix this by structuring your command properly.. ie
pawn Код:
public OnPlayerCommandText(playerid, cmdtext)
{
new cmd[32],tmp[32],idx;
cmd = strtok(cmdtext, idx);
if(!strcmp(cmd, "/spawncar",true))
{
tmp = strtok(cmdtext, idx);
// rest of command here
Re: Spawn Vehicle Command not working -
jameskmonger - 08.10.2010
Rachael, just doing /spawncar gives me that message.