18.05.2009, 19:08
I want a cmd for a admin to explode another player.
/explode ID
/explode ID
if(strcmp(cmd, "/explode", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR, "Use: /explode [id/nick]"); return 1; } new playa; new Float:x,Float:y,Float:z; playa = CheckUser(tmp); if(IsPlayerAdmin(playerid)) { if(IsPlayerConnected(playa)) { if(playa != INVALID_PLAYER_ID) { GetPlayerPos(playa, x, y, z); format(cmdstring,sizeof(cmdstring),"You explode %s.", PlayerName(playa)); format(cmdstring2,sizeof(cmdstring2),"The ADM %s explode you.",PlayerName(playerid)); SendClientMessage(playerid,COLOR,cmdstring); SendClientMessage(playa,COLOR,cmdstring2); CreateExplosion(x, y, z, 10, 30); CreateExplosion(x + 1, y, z, 10, 30); CreateExplosion(x + 1, y + 1, z, 10, 30); CreateExplosion(x, y + 1, z, 10, 30); CreateExplosion(x - 1, y, z, 10, 30); CreateExplosion(x, y - 1, z, 10, 30); CreateExplosion(x - 1, y - 1, z, 10, 30); return 1; } else { SendClientMessage(playerid, COLOR, "The player is off!"); return 1; } } } else { SendClientMessage(playerid, COLOR, "You don't are administrator!"); return 1; } } SendClientMessage(playerid, COLOR, "The Player is off!"); return 1; }
CheckUser(text[], playerid = INVALID_PLAYER_ID) { new pos = 0; while (text[pos] < 0x21) { if (text[pos] == 0) return INVALID_PLAYER_ID; pos++; } new userid = INVALID_PLAYER_ID; if (IsNumeric(text[pos])) { userid = strval(text[pos]); if (userid >=0 && userid < MAX_PLAYERS) { if(!IsPlayerConnected(userid)) { userid = INVALID_PLAYER_ID; } else { return userid; } } }