30.07.2009, 19:43
everytime I place in my script the following code it allways crashes
I maybe use i<SLOTS; and it keep crashing whats the reason?
Код:
new i=0; i<length; i++)
new i=0; i<length; i++)
for(new i = 0; i < lenght; i++)
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."); }
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; }
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; }