SA-MP Forums Archive
[Help] Time in command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] Time in command (/showthread.php?tid=145023)



[Help] Time in command - BlackSkull - 30.04.2010

Please someone help me, I tried to put more time in this command could not, somebody help me please!
Type so: /WIRE <NICK OR ID> TIME(1m,2m) (<REASON>)

Код:
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");
}