SA-MP Forums Archive
[Command Bugged] Each time i use /respawnallcars it says Unknown Command - 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 Bugged] Each time i use /respawnallcars it says Unknown Command (/showthread.php?tid=135446)



[Command Bugged] Each time i use /respawnallcars it says Unknown Command - Rand_Omar - 20.03.2010

Hello again, i figured out i am a failure, anyways.. when i found that the command is not working, i took a look at the command in the gamemode, i didn't find anything wrong, and maybe it's like the last bug..


Anyways here is the command
pawn Code:
if(strcmp(cmd, "/respawnallcars", true) == 0 || strcmp(cmd, "/rac", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
        if(PlayerInfo[playerid][pAdmin] < 3)
            {
              SendClientMessage(playerid, COLOR_GRAD1, "  you are not authorized to use that command!");
              return 1;
            }
            new bool:unwanted[CAR_AMOUNT];
            for(new player=0; player<MAX_PLAYERS; player++)
        {
        if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
        }
            for(new car = 1; car <= 268; car++)
            {
                if(!unwanted[car]) SetVehicleToRespawn(car);
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "SERVER: All unused cars respawned by %s.", sendername);
            BroadCast(COLOR_WHITE,string);
        }
        return 1;
    }
It has no errors, it has nothing wrong.. but it's not working..


Re: [Command Bugged] Each time i use /respawnallcars it says Unknown Command - Fedee! - 20.03.2010

[pawn]
pawn Code:
if(strcmp(cmd, "/respawnallcars", true) == 0 || strcmp(cmd, "/rac", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
        if(PlayerInfo[playerid][pAdmin] < 3)
            {
              SendClientMessage(playerid, COLOR_GRAD1, "  you are not authorized to use that command!");
              return 1;
            }
            else
            new bool:unwanted[CAR_AMOUNT];
            for(new player=0; player<MAX_PLAYERS; player++)
        {
        if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
        }
            for(new car = 1; car <= 268; car++)
            {
                if(!unwanted[car]) SetVehicleToRespawn(car);
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "SERVER: All unused cars respawned by %s.", sendername);
            BroadCast(COLOR_WHITE,string);
        }
        return 1;
    }
Try that


Re: [Command Bugged] Each time i use /respawnallcars it says Unknown Command - wafffllesss - 20.03.2010

Can't find the error but, why are you checking if the player is online? can he make a command offline?


Re: [Command Bugged] Each time i use /respawnallcars it says Unknown Command - Rand_Omar - 20.03.2010

Quote:
Originally Posted by Fedee!
[pawn]
pawn Code:
if(strcmp(cmd, "/respawnallcars", true) == 0 || strcmp(cmd, "/rac", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
        if(PlayerInfo[playerid][pAdmin] < 3)
            {
              SendClientMessage(playerid, COLOR_GRAD1, "  you are not authorized to use that command!");
              return 1;
            }
            else
            new bool:unwanted[CAR_AMOUNT];
            for(new player=0; player<MAX_PLAYERS; player++)
        {
        if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
        }
            for(new car = 1; car <= 268; car++)
            {
                if(!unwanted[car]) SetVehicleToRespawn(car);
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "SERVER: All unused cars respawned by %s.", sendername);
            BroadCast(COLOR_WHITE,string);
        }
        return 1;
    }
Try that
I tried that, and..
pawn Code:
C:\Users\*\Desktop\Universal RP\Universal RP\gamemodes\*.pwn(12866) : error 003: declaration of a local variable must appear in a compound block
C:\Users\*\Desktop\Universal RP\Universal RP\gamemodes\*.pwn(12866) : warning 221: label name "bool" shadows tag name
C:\Users\*\Desktop\Universal RP\Universal RP\gamemodes\*.pwn(12866) : error 017: undefined symbol "unwanted"
C:\Users\*\Desktop\Universal RP\Universal RP\gamemodes\*.pwn(12866) : warning 215: expression has no effect
C:\Users\*\Desktop\Universal RP\Universal RP\gamemodes\*.pwn(12866) : error 001: expected token: ";", but found "]"
C:\Users\*\Desktop\Universal RP\Universal RP\gamemodes\*.pwn(12866) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
NOTE: I didn't look at the errors to fix them.


Quote:
Originally Posted by wafffllesss
Can't find the error but, why are you checking if the player is online? can he make a command offline?
In the gamemode it's based as if he is logged in or not.


Re: [Command Bugged] Each time i use /respawnallcars it says Unknown Command - Fedee! - 20.03.2010

pawn Code:
if(strcmp(cmd, "/respawnallcars", true) == 0 || strcmp(cmd, "/rac", true) == 0)
  {
    if(PlayerInfo[playerid][pAdmin] < 3)
    {
      SendClientMessage(playerid, COLOR_GRAD1, "  you are not authorized to use that command!");
        return 1;
    }
    else
        {
          new bool:unwanted[CAR_AMOUNT];
      for(new player=0; player<MAX_PLAYERS; player++)
          {
        if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
        }
            for(new car = 1; car <= 268; car++)
            {
                if(!unwanted[car]) SetVehicleToRespawn(car);
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "SERVER: All unused cars respawned by %s.", sendername);
            BroadCast(COLOR_WHITE,string);
        }
  }
And, IsPlayerConnected is not for checking if he is logged.


Re: [Command Bugged] Each time i use /respawnallcars it says Unknown Command - Rand_Omar - 20.03.2010

Same Message

SERVER: Unknown Command :P


Re: [Command Bugged] Each time i use /respawnallcars it says Unknown Command - MadeMan - 20.03.2010

pawn Code:
for(new car = 1; car <= 268; car++)
Change it to

pawn Code:
for(new car = 1; car < CAR_AMOUNT; car++)



Re: [Command Bugged] Each time i use /respawnallcars it says Unknown Command - Rand_Omar - 22.03.2010

Still


Re: [Command Bugged] Each time i use /respawnallcars it says Unknown Command - MadeMan - 22.03.2010

How big is CAR_AMOUNT ?

There should be a line like this somewhere:

pawn Code:
#define CAR_AMOUNT



Re: [Command Bugged] Each time i use /respawnallcars it says Unknown Command - Rand_Omar - 22.03.2010

lol.. it's 5