25.03.2011, 09:24
Quote:
Raptor admin script ..Actually i can kick and ban from console but not from game like /kick or /ban and how i can make someone admin ?
|
Код:
COMMAND:kick(playerid,params[]) { if(PlayerInfo[playerid][Level] < 1) return SendClientMessage(playerid,color_red,"You have no permission to use this command!"); new id,reason[64]; if(sscanf(params,"i",id)) return SendClientMessage(playerid,color_red,"USAGE: /kick [id] [reason]"); sscanf(params,"is[64]",id,reason); if(!IsPlayerConnected(id)) return SendClientMessage(playerid,color_red,"Player not connected."); if(!strlen(reason)) { SendClientMessageToAllEx(color_blue,"sssss","***Administrator ",PlayerInfo[playerid][Username],"{FFFFFF} kicked ",PlayerInfo[id][Username],"."); } else { SendClientMessageToAllEx(color_blue,"sssssss","***Administrator ",PlayerInfo[playerid][Username],"{FFFFFF} kicked ",PlayerInfo[id][Username]," Reason:",reason,"."); } return Kick(id); }
Код:
COMMAND:ban(playerid,params[]) { if(PlayerInfo[playerid][Level] < 2) return SendClientMessage(playerid,color_red,"You have no permission to use this command!"); new id,reason[64]; if(sscanf(params,"i",id)) return SendClientMessage(playerid,color_red,"USAGE: /ban [id] [reason]"); sscanf(params,"is[64]",id,reason); if(!IsPlayerConnected(id)) return SendClientMessage(playerid,color_red,"Player not connected."); if(!strlen(reason)) { SendClientMessageToAllEx(color_blue,"sssss","***Administrator ",PlayerInfo[playerid][Username],"{FFFFFF} banned ",PlayerInfo[id][Username],"."); } else { SendClientMessageToAllEx(color_blue,"sssssss","***Administrator ",PlayerInfo[playerid][Username],"{FFFFFF} banned ",PlayerInfo[id][Username]," Reason:",reason,"."); } return Ban(id); }
Код:
COMMAND:setlevel(playerid,params[]) { if(PlayerInfo[playerid][Level] < 3&& !IsPlayerAdmin(playerid)) return SendClientMessage(playerid,color_red,"You have no permission to use this command!"); new id,level;if(sscanf(params,"ii",id,level)) return SendClientMessage(playerid,color_red,"USAGE: /setlevel [playerid] [level 0/3]"); if(!IsPlayerConnected(id)) return SendClientMessage(playerid,color_red,"Player not connected."); if(level > 3) return SendClientMessage(playerid,color_red,"Error! You can only pick between level 0/3 (0: Player - 1: Moderator - 2: Administrator - 3: Owner)"); if(PlayerInfo[id][Level] < level) { PlayerInfo[id][Level] = level; SendClientMessageEx(playerid,color_green,"sssis","You have promoted ",PlayerInfo[id][Username]," succesfully to level ",level,"."); SendClientMessageEx(id,color_green,"sis","Congratulations! You have been promoted to level ",level,"."); } else { PlayerInfo[id][Level] = level; SendClientMessageEx(playerid,color_green,"sssis","You have demoted ",PlayerInfo[id][Username]," succesfully to level ",level,"."); SendClientMessageEx(id,color_green,"sis","You have been demoted to level ",level,"."); } SaveUser(id); return 1; }
Код:
#include <zcmd>
have fun!
(if u will get any error,let me know...)