18.03.2012, 19:52
Код:
CMD:kick(playerid, params[]) { new pAdmin[MAX_PLAYERS]; new PID; //define the playerid we wanna kick new reason[64]; //the reason, put into a string new str[128]; //a new message string new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get GetPlayerName(PID, Playername, sizeof(Playername)); if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here) if(pAdmin[playerid] <= 3 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You are not authorised to use this command."); if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!"); format(str, sizeof(str), "'%s' has been kicked by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names SendClientMessageToAll(COLOR_RED, str); //send that message to all Kick(PID); //kick the playerid we've defined return 1; } CMD:ban(playerid, params[]) { new pAdmin[MAX_PLAYERS]; new PID; //define the playerid we wanna kick new reason[64]; //the reason, put into a string new str[128]; //a new message string new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get GetPlayerName(PID, Playername, sizeof(Playername)); if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /ban [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here) if(pAdmin[playerid] <= 3 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You are not authorised to use this command."); if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!"); format(str, sizeof(str), "'%s' has been Banned by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names SendClientMessageToAll(COLOR_RED, str); //send that message to all Ban(PID); //kick the playerid we've defined return 1; } CMD:akill(playerid, params[]) { new pAdmin[MAX_PLAYERS]; new PID; //define the playerid we wanna kick new reason[64]; //the reason, put into a string new str[128]; //a new message string new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get GetPlayerName(PID, Playername, sizeof(Playername)); if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /akill [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here) if(pAdmin[playerid] <= 3 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You are not authorised to use this command."); if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!"); format(str, sizeof(str), "'%s' has been akill by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names SendClientMessageToAll(COLOR_RED, str); //send that message to all SetPlayerHealth(PID, 0); return 1; } CMD:freeze(playerid, params[]) { new pAdmin[MAX_PLAYERS]; new PID; //define the playerid we wanna kick new reason[64]; //the reason, put into a string new str[128]; //a new message string new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get GetPlayerName(PID, Playername, sizeof(Playername)); if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /freeze [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here) if(pAdmin[playerid] <= 3 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You are not authorised to use this command."); if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!"); format(str, sizeof(str), "'%s' has been freezed by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names SendClientMessageToAll(COLOR_RED, str); //send that message to all TogglePlayerControllable(PID,0); return 1; } CMD:unfreeze(playerid, params[]) { new pAdmin[MAX_PLAYERS]; new PID; //define the playerid we wanna kick new reason[64]; //the reason, put into a string new str[128]; //a new message string new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get GetPlayerName(PID, Playername, sizeof(Playername)); if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /unfreeze [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here) if(pAdmin[playerid] <= 3 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You are not authorised to use this command."); if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!"); format(str, sizeof(str), "'%s' has been unfreezed by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names SendClientMessageToAll(COLOR_RED, str); //send that message to all TogglePlayerControllable(PID,1); return 1; } CMD:gotols(playerid, params[]) { new pAdmin[MAX_PLAYERS]; new PID; //define the playerid we wanna kick new reason[64]; //the reason, put into a string new str[128]; //a new message string new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get GetPlayerName(PID, Playername, sizeof(Playername)); if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /gotols [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here) if(pAdmin[playerid] <= 3 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You are not authorised to use this command."); if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!"); format(str, sizeof(str), "'%s' has been TELEPORTED to ls by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names SendClientMessageToAll(COLOR_RED, str); //send that message to all SetPlayerPos(PID,1529.4846,-1715.3315,13.3828); return 1; } CMD:gotohos(playerid, params[]) { new pAdmin[MAX_PLAYERS]; new PID; //define the playerid we wanna kick new reason[64]; //the reason, put into a string new str[128]; //a new message string new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get GetPlayerName(PID, Playername, sizeof(Playername)); if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /gotohos [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here) if(pAdmin[playerid] <= 3 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You are not authorised to use this command."); if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!"); format(str, sizeof(str), "'%s' has been TELEPORTED to hos by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names SendClientMessageToAll(COLOR_RED, str); //send that message to all SetPlayerPos(PID,1178.0469,-1324.3839,14.1008); return 1; } CMD:jail(playerid, params[]) { new pAdmin[MAX_PLAYERS]; new PID; if(IsPlayerConnected(PID)) { if(pAdmin[playerid] <= 3 && !IsPlayerAdmin(playerid)) { if(!sscanf(params, "u", PID)) { new string[64]; format(string, sizeof(string), "You have been jailed by %s.", PlayerName(playerid)); SendClientMessage(PID, 0xD8D8D8FF, string); format(string, sizeof(string), "You jailed %s .", PlayerName(PID)); SendClientMessage(playerid, 0xD8D8D8FF, string); SetPlayerPos(PID, 264.5442199707,77.155387878418,1001.0390625); SetPlayerInterior(PID, 6); return true; } else return SendClientMessage(playerid, 0xD8D8D8FF, "USAGE: /jail [PlayerId/PartOfName]"); } else return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command."); } else return SendClientMessage(playerid, 0xD8D8D8FF, "Player is not connected."); } CMD:unjail(playerid, params[]) { new pAdmin[MAX_PLAYERS]; new PID; if(IsPlayerConnected(PID)) { if(pAdmin[playerid] <= 3 && !IsPlayerAdmin(playerid)) { if(!sscanf(params, "u", PID)) { new string[64]; format(string, sizeof(string), "You have been unjailed by %s.", PlayerName(playerid)); SendClientMessage(PID, 0xD8D8D8FF, string); format(string, sizeof(string), "You unjailed %s .", PlayerName(PID)); SendClientMessage(playerid, 0xD8D8D8FF, string); SetPlayerPos(PID, 1552.1305,-1675.6511,16.1554); SetPlayerInterior(PID, 0); return true; } else return SendClientMessage(playerid, 0xD8D8D8FF, "USAGE: /unjail [PlayerId/PartOfName]"); } else return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command."); } else return SendClientMessage(playerid, 0xD8D8D8FF, "Player is not connected."); } stock PlayerName(playerid) { new Name[MAX_PLAYER_NAME]; GetPlayerName(playerid, Name, sizeof(Name)); return Name; } CMD:goto(playerid, params[]) { new pAdmin[MAX_PLAYERS]; new ID; if(sscanf(params, "u", ID)) SendClientMessage(playerid, 0xF97804FF, "USAGE: /goto [id]"); if(pAdmin[playerid] <= 3 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You are not authorised to use this command."); else if(IsPlayerConnected(ID) == 0) SendClientMessage(playerid, 0xF97804FF, "Player is not connected!"); else { new Float:x, Float:y, Float:z; GetPlayerPos(ID, x, y, z); SetPlayerPos(playerid, x+1, y+1, z); } return 1; } CMD:gethere(playerid,params[]) { new pAdmin[MAX_PLAYERS]; new targetid, Float:x, Float:y, Float:z; if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /gethere [id]"); if(pAdmin[playerid] <= 3 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You are not authorised to use this command."); if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_YELLOW, "That player is not connected"); GetPlayerPos(playerid, x, y, z); SetPlayerPos(targetid, x, y+0.5, z+0.5); return 1; } CMD:explode(playerid, params[]) { new pAdmin[MAX_PLAYERS]; new id,reason[20],message[128]; if(pAdmin[playerid] <= 3 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You are not authorised to use this command."); if(sscanf(params,"dz",id,reason)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /explode [playerid] [Reason]"); //if he didn't type ID command will stop processing and will return error message if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_YELLOW, "Warnning: this player not online"); //If player isn't online command will stop processing and will return error message new Float:X,Float:Y,Float:Z; GetPlayerPos(id, X, Y, Z); CreateExplosion(X,Y,Z,2,10.0); //Creating explosion on id's position format(message, sizeof(message), "%d have been exploded", id); SendClientMessage(playerid, COLOR_YELLOW, message); format(message, sizeof(message), "you have been exploded by %d", playerid); return 1; } CMD:announce(playerid, params[]) { new pAdmin[MAX_PLAYERS]; if(pAdmin[playerid] <= 3 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You are not authorised to use this command."); if(!strlen(params)) return SendClientMessage(playerid,0x3A47DEFF,"[MM] USAGE: /announce [Text]"); //Cheching has he typed message. If not command will stop being proccessed and will return error message GameTextForAll(params,3*1000,3); //Showing announcement for al players return 1; } CMD:sendsky(playerid, params[]) { new pAdmin[MAX_PLAYERS]; new id,reason[20],Float:Pos[3]; if(sscanf(params,"dz",id,reason)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /sendsky [playerid] [Reason]"); if(pAdmin[playerid] <= 1 && !IsPlayerAdmin(playerid)) if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_YELLOW, "Warnning: this player not online"); GivePlayerWeapon(id, 46, 1); GetPlayerPos(id, Pos[0], Pos[1], Pos[2]); SetPlayerPos(id, Pos[0], Pos[1], Pos[2] + 3000); return 1; } stock GetName(playerid) { new name[24]; GetPlayerName(playerid,name,sizeof(name)); return name; } new pAdmin[MAX_PLAYERS]; CMD:makeadmin(playerid,params[]) { new targetid, level, targetstring[128], string[128]; if(pAdmin[playerid] <= 5 && !IsPlayerAdmin(playerid)) { return SendClientMessage(playerid,-1,"You are not authorised to use that command."); } if(sscanf(params,"ui",targetid,level)) { return SendClientMessage(playerid,-1,"USAGE: /makeadmin [playerid] [level]"); } if(targetid == INVALID_PLAYER_ID) { return SendClientMessage(playerid,-1,"Player not found."); } if(level == 0 || level >= 6) { return SendClientMessage(playerid,-1,"Only levels available are level 1 and 5."); } else { format(targetstring,sizeof(targetstring),"Administrator %s has promoted you to Level %d Admin.",GetName(playerid),level); format(string,sizeof(string),"You have made %s a level %d Admin.",GetName(targetid),level); SendClientMessage(targetid,-1,targetstring); SendClientMessage(playerid,-1,string); pAdmin[targetid] = level; } return 1; }
Код:
C:\Users\User\Desktop\GangWar\gamemodes\Test.pwn(586) : warning 219: local variable "pAdmin" shadows a variable at a preceding level C:\Users\User\Desktop\GangWar\gamemodes\Test.pwn(604) : warning 219: local variable "pAdmin" shadows a variable at a preceding level C:\Users\User\Desktop\GangWar\gamemodes\Test.pwn(622) : warning 219: local variable "pAdmin" shadows a variable at a preceding level C:\Users\User\Desktop\GangWar\gamemodes\Test.pwn(640) : warning 219: local variable "pAdmin" shadows a variable at a preceding level C:\Users\User\Desktop\GangWar\gamemodes\Test.pwn(658) : warning 219: local variable "pAdmin" shadows a variable at a preceding level C:\Users\User\Desktop\GangWar\gamemodes\Test.pwn(676) : warning 219: local variable "pAdmin" shadows a variable at a preceding level C:\Users\User\Desktop\GangWar\gamemodes\Test.pwn(694) : warning 219: local variable "pAdmin" shadows a variable at a preceding level C:\Users\User\Desktop\GangWar\gamemodes\Test.pwn(712) : warning 219: local variable "pAdmin" shadows a variable at a preceding level C:\Users\User\Desktop\GangWar\gamemodes\Test.pwn(737) : warning 219: local variable "pAdmin" shadows a variable at a preceding level C:\Users\User\Desktop\GangWar\gamemodes\Test.pwn(768) : warning 219: local variable "pAdmin" shadows a variable at a preceding level C:\Users\User\Desktop\GangWar\gamemodes\Test.pwn(783) : warning 219: local variable "pAdmin" shadows a variable at a preceding level C:\Users\User\Desktop\GangWar\gamemodes\Test.pwn(794) : warning 219: local variable "pAdmin" shadows a variable at a preceding level C:\Users\User\Desktop\GangWar\gamemodes\Test.pwn(809) : warning 219: local variable "pAdmin" shadows a variable at a preceding level C:\Users\User\Desktop\GangWar\gamemodes\Test.pwn(817) : warning 219: local variable "pAdmin" shadows a variable at a preceding level Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 14 Warnings.