Код:
dcmd_wire(playerid,params[]) {
if(IsPlayerCommandLevel(playerid,"wire")) {
if(!strlen(params)) return SendClientMessage(playerid,red,"Syntax Error: \"/WIRE <NICK OR ID> (<REASON>)\".");
new tmp[256],Index; tmp = strtok(params,Index);
new id; if(!IsNumeric(tmp)) id = ReturnPlayerID(tmp); else id = strval(tmp);
if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID && id != playerid) {
if(!Variables[id][Wired]) {
SendCommandMessageToAdmins(playerid,"WIRE");
new string[256],name[24],ActionName[24]; GetPlayerName(playerid,name,24); GetPlayerName(id,ActionName,24);
if(!strlen(params[strlen(tmp)+1])) format(string,256,"\"%s\" has been wired by Administrator \"%s\".",ActionName,name);
else format(string,256,"\"%s\" has been wired by Administrator \"%s\". (Reason: %s)",ActionName,name,params[strlen(tmp)+1]);
Variables[id][Wired] = true, Variables[id][WiredWarnings] = Config[WiredWarnings];
return SendClientMessageToAll(yellow,string);
} else return SendClientMessage(playerid,red,"ERROR: This player has already been wired.");
} else return SendClientMessage(playerid,red,"ERROR: You can not wire yourself or a disconnected player.");
} else return SendLevelErrorMessage(playerid,"wire");
}
Код:
dcmd_unwire(playerid,params[]) {
if(IsPlayerCommandLevel(playerid,"unwire")) {
if(!strlen(params)) return SendClientMessage(playerid,red,"Syntax Error: \"/UNWIRE <NICK OR ID>\".");
new id; if(!IsNumeric(params)) id = ReturnPlayerID(params); else id = strval(params);
if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID) {
if(Variables[id][Wired]) {
SendCommandMessageToAdmins(playerid,"UNWIRE");
new string[256],name[24],ActionName[24]; GetPlayerName(playerid,name,24); GetPlayerName(id,ActionName,24);
Variables[id][Wired] = false, Variables[id][WiredWarnings] = Config[WiredWarnings];
if(id != playerid) { format(string,256,"\"%s\" has been unwired by Administrator \"%s\".",ActionName,name); return SendClientMessageToAll(yellow,string); }
else return SendClientMessage(playerid,yellow,"You have successfully unwired yourself.");
} else return SendClientMessage(playerid,red,"ERROR: This player is not wired.");
} else return SendClientMessage(playerid,red,"ERROR: You can not unwire a disconnected player.");
} else return SendLevelErrorMessage(playerid,"unwire");
}