SA-MP Forums Archive
/respawn error. - 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: /respawn error. (/showthread.php?tid=102152)



/respawn error. - MartinDaniel - 13.10.2009

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.


Re: /respawn error. - Peter_Corneile - 13.10.2009

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;
}



Re: /respawn error. - MartinDaniel - 13.10.2009

5 errors..


And with my command, i only got one error.


Re: /respawn error. - Peter_Corneile - 13.10.2009

Tell me the errors and the lines of errors


Re: /respawn error. - MartinDaniel - 13.10.2009

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)


Re: /respawn error. - Peter_Corneile - 13.10.2009

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


Re: /respawn error. - Jefff - 13.10.2009

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



Re: /respawn error. - Peter_Corneile - 13.10.2009

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


Re: /respawn error. - MartinDaniel - 13.10.2009

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)


Re: /respawn error. - Peter_Corneile - 13.10.2009

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