/respawn error.
#1

I tried to do /respawn command, but i got one error
.pwn(372) : error 017: undefined symbol "cmd"

Heres the command. Sorry i dont know how to put it in code


if(strcmp(cmd, "/respawnall", true) == 0 || strcmp(cmd, "/respvehs", true) == 0)
{

if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not an admin to use it!");
for(new i=0;i<MAX_VEHICLES;i++)
{
if(IsVehicleOccupied(i) == 0)
{
SetVehicleToRespawn(i);
}
}
SendClientMessage(playerid, 0xAFAFAFAA, "* All unoccupied vehicles respawned!!");
return 1;
}






Thanks.
Reply
#2

Do it like this

pawn Код:
forward IsVehicleOccupied(vehicleid);

    if(strcmp(cmd, "/respawncars", true) == 0)
    {
    if (PlayerInfo[playerid][pAdmin] >=3)
        for(new i=0;i<MAX_VEHICLES;i++)
        {
            if(IsVehicleOccupied(i) == 0)
            {
            SetVehicleToRespawn(i);
          }
        }
    GetPlayerName(playerid,playername,sizeof(playername));
        format(string,sizeof(string),"[AdminCmd]: All vehicles respawned by Admin : %s",playername);
      SendClientMessageToAll(Admin, string);
      return 1;
    }

public IsVehicleOccupied(vehicleid)
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerInVehicle(i,vehicleid)) return 1;
    }
    return 0;
}
Reply
#3

5 errors..


And with my command, i only got one error.
Reply
#4

Tell me the errors and the lines of errors
Reply
#5

C:\Documents and Settings\Medo\Desktop\SA-MP Server\gamemodes\stuntscript.pwn(425) : error 017: undefined symbol "cmd"
C:\Documents and Settings\Medo\Desktop\SA-MP Server\gamemodes\stuntscript.pwn(427) : error 017: undefined symbol "PlayerInfo"
C:\Documents and Settings\Medo\Desktop\SA-MP Server\gamemodes\stuntscript.pwn(427) : warning 215: expression has no effect
C:\Documents and Settings\Medo\Desktop\SA-MP Server\gamemodes\stuntscript.pwn(427) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Medo\Desktop\SA-MP Server\gamemodes\stuntscript.pwn(427) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Medo\Desktop\SA-MP Server\gamemodes\stuntscript.pwn(427) : fatal error 107: too many error messages on one line



Error line 425: if(strcmp(cmd, "/respawncars", true) == 0)
Error line 427: if (PlayerInfo[playerid][pAdmin] >=3)
Reply
#6

Sorry forgot to remove that PlayerInfo thing .. Here is the correct one
pawn Код:
if(strcmp(cmd, "/respawncars", true) == 0)
    {
   
        for(new i=0;i<MAX_VEHICLES;i++)
        {
            if(IsVehicleOccupied(i) == 0)
            {
            SetVehicleToRespawn(i);
          }
        }
    GetPlayerName(playerid,playername,sizeof(playername));
        format(string,sizeof(string),"[AdminCmd]: All vehicles respawned by Admin : %s",playername);
      SendClientMessageToAll(Admin, string);
      return 1;
    }
Just change the command and leave the rest to be like it is
Reply
#7

In Your first post replace
Код:
cmd
to
Код:
cmdtext
Reply
#8

Quote:
Originally Posted by Jefff
In Your first post replace
Код:
cmd
to
Код:
cmdtext
Yup
Reply
#9

I have the same error :S

pwn(425) : error 017: undefined symbol "cmd"

Error line 425: if(strcmp(cmdtext, "/respawnall", true) == 0 || strcmp(cmd, "/respvehs", true) == 0)
Reply
#10

Change to this
pawn Код:
if(strcmp(cmdtext, "/respawnall", true) == 0 || strcmp(cmdtext, "/respvehs", true) == 0)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)