Spawn Vehicle Command not working
#1

Код:
	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.
Reply
#2

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
Reply
#3

Make sure your OnPlayerCommandText callback returns 0.
Reply
#4

Edit: What he said
Reply
#5

Grim, it returns 0.
Reply
#6

!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
Reply
#7

Rachael, just doing /spawncar gives me that message.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)