SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 20/03/2010, 04:02 PM   #1
Rand_Omar
Big Clucker
 
Join Date: Jan 2010
Posts: 50
Reputation: 0
Default [Command Bugged] Each time i use /respawnallcars it says Unknown Command

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..
Rand_Omar is offline   Reply With Quote
Old 20/03/2010, 04:08 PM   #2
Fedee!
Huge Clucker
 
Fedee!'s Avatar
 
Join Date: Jan 2010
Posts: 457
Reputation: 0
Default Re: [Command Bugged] Each time i use /respawnallcars it says Unknown Command

[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
Fedee! is offline   Reply With Quote
Old 20/03/2010, 04:09 PM   #3
wafffllesss
Huge Clucker
 
Join Date: Apr 2007
Posts: 413
Reputation: 1
Default Re: [Command Bugged] Each time i use /respawnallcars it says Unknown Command

Can't find the error but, why are you checking if the player is online? can he make a command offline?
wafffllesss is offline   Reply With Quote
Old 20/03/2010, 04:13 PM   #4
Rand_Omar
Big Clucker
 
Join Date: Jan 2010
Posts: 50
Reputation: 0
Default Re: [Command Bugged] Each time i use /respawnallcars it says Unknown Command

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.
Rand_Omar is offline   Reply With Quote
Old 20/03/2010, 04:32 PM   #5
Fedee!
Huge Clucker
 
Fedee!'s Avatar
 
Join Date: Jan 2010
Posts: 457
Reputation: 0
Default Re: [Command Bugged] Each time i use /respawnallcars it says Unknown Command

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.
Fedee! is offline   Reply With Quote
Old 20/03/2010, 04:39 PM   #6
Rand_Omar
Big Clucker
 
Join Date: Jan 2010
Posts: 50
Reputation: 0
Default Re: [Command Bugged] Each time i use /respawnallcars it says Unknown Command

Same Message

SERVER: Unknown Command :P
Rand_Omar is offline   Reply With Quote
Old 20/03/2010, 04:55 PM   #7
MadeMan
High-roller
 
MadeMan's Avatar
 
Join Date: Jun 2007
Posts: 3,472
Reputation: 237
Default Re: [Command Bugged] Each time i use /respawnallcars it says Unknown Command

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

Change it to

pawn Code:
for(new car = 1; car < CAR_AMOUNT; car++)
MadeMan is offline   Reply With Quote
Old 22/03/2010, 03:03 PM   #8
Rand_Omar
Big Clucker
 
Join Date: Jan 2010
Posts: 50
Reputation: 0
Default Re: [Command Bugged] Each time i use /respawnallcars it says Unknown Command

Still
Rand_Omar is offline   Reply With Quote
Old 22/03/2010, 03:26 PM   #9
MadeMan
High-roller
 
MadeMan's Avatar
 
Join Date: Jun 2007
Posts: 3,472
Reputation: 237
Default Re: [Command Bugged] Each time i use /respawnallcars it says Unknown Command

How big is CAR_AMOUNT ?

There should be a line like this somewhere:

pawn Code:
#define CAR_AMOUNT
MadeMan is offline   Reply With Quote
Old 22/03/2010, 04:00 PM   #10
Rand_Omar
Big Clucker
 
Join Date: Jan 2010
Posts: 50
Reputation: 0
Default Re: [Command Bugged] Each time i use /respawnallcars it says Unknown Command

lol.. it's 5
Rand_Omar 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
SERVER: Unknown Command when using a scripted command and it does execute! Moustafa Help Archive 6 11/06/2010 01:34 PM
Command that returns SERVER: Unknown Command. pagie1111 Help Archive 11 11/04/2010 09:55 AM
Getting unknown Command but command still works? Lipsmoker101 Help Archive 1 24/01/2010 04:39 PM
SERVER: Unknown Command - after login on every command virtualmarc Help Archive 0 20/09/2009 06:27 PM


All times are GMT. The time now is 01:49 AM.


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