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



/kill - Seva - 27.06.2009

Hi, i have some problems with my /kill command. I cannot compile because of some errors.

Код:
C:\Users\****\Documents\USB\Mods\samp02Xserver.win32\gamemodes\gf.pwn(8137) : warning 217: loose indentation
C:\Users\****\Documents\USB\Mods\samp02Xserver.win32\gamemodes\gf.pwn(8137) : error 029: invalid expression, assumed zero
C:\Users\****\Documents\USB\Mods\samp02Xserver.win32\gamemodes\gf.pwn(8138) : error 001: expected token: ";", but found "{"
C:\Users\****\Documents\USB\Mods\samp02Xserver.win32\gamemodes\gf.pwn(8141) : error 017: undefined symbol "jailed2"
C:\Users\****\Documents\USB\Mods\samp02Xserver.win32\gamemodes\gf.pwn(8141) : warning 215: expression has no effect
C:\Users\****\Documents\USB\Mods\samp02Xserver.win32\gamemodes\gf.pwn(8141) : error 001: expected token: ";", but found "]"
C:\Users\****\Documents\USB\Mods\samp02Xserver.win32\gamemodes\gf.pwn(8141) : error 029: invalid expression, assumed zero
C:\Users\****\Documents\USB\Mods\samp02Xserver.win32\gamemodes\gf.pwn(8141) : fatal error 107: too many error messages on one line
And this is the script :

Код:
public OnPlayerCommandText(playerid, cmdtext)
{
  if(strcmp(cmdtext, "/kill", true) == 0)
  {
    if (jailed2[playerid] == 1)
    {
      SendClientMessage(playerid,COLOR_GRAD1,"You cannot kill yourself because you're in the jail.");
    }
    else
    {
      SetPlayerHealth(playerid, 0.0);
      GetPlayerName(playerid,playername,sizeof(playername));
      format(string,sizeof(string),".: %s Has killed himself (/kill) :.",playername);
      SendClientMessageToAll(COLOR_RED,string);
    }
    return 1;
  }
  return 0;
}
What is wrong ?


Re: /kill - Grim_ - 27.06.2009

pawn Код:
//top fo script
new jailed2[MAX_PLAYERS];



Re: /kill - Seva - 27.06.2009

I done what you say, but i have another error.

Код:
C:\Users\****\Documents\USB\Mods\samp02Xserver.win32\gamemodes\gf.pwn(8137) : warning 217: loose indentation
C:\Users\****\Documents\USB\Mods\samp02Xserver.win32\gamemodes\gf.pwn(8137) : error 029: invalid expression, assumed zero
C:\Users****\Documents\USB\Mods\samp02Xserver.win32\gamemodes\gf.pwn(8138) : error 001: expected token: ";", but found "{"
C:\Users\****\Documents\USB\Mods\samp02Xserver.win32\gamemodes\gf.pwn(8145) : error 029: invalid expression, assumed zero
C:\Users\****\Documents\USB\Mods\samp02Xserver.win32\gamemodes\gf.pwn(8141) : warning 204: symbol is assigned a value that is never used: "jailed2"
C:\Users****\Documents\USB\Mods\samp02Xserver.win32\gamemodes\gf.pwn(8157) : warning 225: unreachable code
C:\Users\****\Documents\USB\Mods\samp02Xserver.win32\gamemodes\gf.pwn(8157) : warning 217: loose indentation
And this is the 'new' script:

Код:
public OnPlayerCommandText(playerid, cmdtext)
{
  if(strcmp(cmdtext, "/kill", true) == 0)
  {
    new jailed2[MAX_PLAYERS];
    {
      SendClientMessage(playerid,COLOR_GRAD1,"You cannot kill yourself because you're in the jail.");
    }
    else
    {
      SetPlayerHealth(playerid, 0.0);
      GetPlayerName(playerid,playername,sizeof(playername));
      format(string,sizeof(string),".: %s Has killed himself (/kill) :.",playername);
      SendClientMessageToAll(COLOR_RED,string);
    }
    return 1;
  }
  return 0;
}



Re: /kill - illay - 27.06.2009




Re: /kill - luby - 27.06.2009

Код:
public OnPlayerCommandText(playerid, cmdtext)
{
  new jailed2[200];
  if(strcmp(cmdtext, "/kill", true) == 0)
  {
    if (jailed2[playerid] == 1)
    {
     SendClientMessage(playerid,COLOR_GRAD1,"You cannot kill yourself because you're in the jail.");
    }
    else
    {
      SetPlayerHealth(playerid, 0.0);
      GetPlayerName(playerid,playername,sizeof(playername));
      format(string,sizeof(string),".: %s Has killed himself (/kill) :.",playername);
      SendClientMessageToAll(COLOR_RED,string);
    }
    return 1;
  }
  return 0;
}