[HELP] compile crash
#1

everytime I place in my script the following code it allways crashes

Код:
new i=0; i<length; i++)
I maybe use i<SLOTS; and it keep crashing whats the reason?
Reply
#2

pawn Код:
for(new i = 0; i < lenght; i++)
Reply
#3

It keeps crashing...neither that helps
I use it to make an admin filterscript and I wanna use it here

Код:
dcmd_akill(playerid, params[])
  if(gPlayerInfo[playerid][PLAYER_LEVEL] < gCommands[AKILL])
  {
    new string[100];
    format(string, sizeof(string), "You must be administrator level %d to use that command!", gCommands[AKILL]);
    return SendClientMessage(playerid, COLOUR_ORANGE, string);
  }
  else if(!strlen(params))
    return SendClientMessage(playerid, COLOUR_ORANGE, "USAGE: /akill [id | name]");
  else
  {
	for new(i = 0; i < length; i++; ) // here
	if(IsPlayerConnected(i) && i != playerid)
	{
	  SetPlayerHealth(id, 0.0);
	  new string[150];
	  format(string, sizeof(string), "You have been admin-killed by administrator \'%s\'.", gPlayerInfo[playerid][PLAYER_NAME]);
	  SendClientMessage(i, COLOUR_ORANGE, string);
	  format(string, sizeof(string), "You have successfully admin-killed player \'%s\'.", gPlayerInfo[id][PLAYER_NAME]);
	  return SendClientMessage(playerid, COLOUR_LIGHTBLUE, string);
	}
	else
	  return SendClientMessage(playerid, COLOUR_ORANGE, "ERROR: You can not admin-kill yourself or a disconnected player.");
}
also I tried with IsNumeric
Код:
stock IsNumeric(const string[]) //By Jan "DracoBlue" Schьtze (edited by Gabriel "Larcius" Cordes
{
new length=strlen(string);
if(length==0)
{
return 0;
}
for (new i=0; i<length; i++)
{
if (!((string[i] <= '9' && string[i] >= '0') || (i==0 && (string[i]=='-' || string[i]=='+'))))
{
return false;
}
}
return 0;
}
because I dont know any other way to send a client message to the akilled ID,not the one who uses the command...
Reply
#4

Use sscanf and dcmd (Example in gAdmin...)
Reply
#5

try this

Код:
dcmd_akill(playerid,params[]) 
{
  if(gPlayerInfo[playerid][PLAYER_LEVEL] > gCommands[AKILL]) 
  {
    if(!strlen(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /akill [id | name]");
      new player1, new string[128];
      player1 = strval(params);

      if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) 
      {
        GetPlayerName(player1, playername, sizeof(playername));	
        format(string,sizeof(string),"You have successfully admin-killed player \'%s\'.", PlayerName(player1)); 
        SendClientMessage(playerid,COLOUR_ORANGE,string);
        format(string, sizeof(string), "You have been admin-killed by administrator \'%s\'.", PlayerName(playerid));
	    SendClientMessage(player1, COLOUR_ORANGE, string);
        return SetPlayerHealth(player1, 0.0);
	  }else return SendClientMessage(playerid, red, "Player is not connected!");
  }else{ 
    format(string, sizeof(string), "You must be administrator level %d to use that command!", gCommands[AKILL]);
    return SendClientMessage(playerid, COLOUR_ORANGE, string);
  }
}
Код:
stock PlayerName(playerid) {

	new Name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, Name, sizeof(Name));
	return Name;
}
Reply
#6

1) a common reason for a COMPILER crash is too many } in the script.
2) targetid = strval(params);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)