30.07.2009, 19:55
It keeps crashing...neither that helps
I use it to make an admin filterscript and I wanna use it here
also I tried with IsNumeric
because I dont know any other way to send a client message to the akilled ID,not the one who uses the command...
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."); }
Код:
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; }