SA-MP Forums Archive
freeze - 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)
+--- Thread: freeze (/showthread.php?tid=589502)



freeze - Trollerz - 19.09.2015

hey guys, i wanna ask how can i make /freeze command?


Re: freeze - Mister0 - 19.09.2015

Try this

PHP код:

CMD
:freeze(playeridparams
{
 new 
player1secondreason[256];
 if(!
IsPlayerAdmin(playerid)) return 1;
 if(
sscanf(params"iis[256]"player1secondreson))
 return 
SendClientMessage(playerid, -1"/freeze [ID] [Second] [Reason]");
 
TogglePlayerControllable(playerid0); 
SetTimerEx("Unfreeze"second*1000false"i"playerid);
 return 
1




forward Unfreeze(playerid); 
public 
Unfreeze(playerid)
 { 
TogglePlayerControllable(playeridtrue);
 return 
1;
 } 



Re : Re: freeze - KillerDVX - 19.09.2015

Quote:
Originally Posted by Mister0
Посмотреть сообщение
Try this

PHP код:

CMD
:freeze(playeridparams
{
 new 
player1secondreason[256];
 if(!
IsPlayerAdmin(playerid)) return 1;
 if(
sscanf(params"iis[256]"player1secondreson))
 return 
SendClientMessage(playerid, -1"/freeze [ID] [Second] [Reason]");
 
TogglePlayerControllable(playerid0); 
SetTimerEx("Unfreeze"second*1000false"i"playerid);
 return 
1

forward Unfreeze(playerid); 
public 
Unfreeze(playerid)
 { 
TogglePlayerControllable(playeridtrue);
 return 
1;
 } 
Instead of copying that code, why wouldn't you explain what you have done in each line ?


Re: freeze - Mister0 - 20.09.2015

I don't copy a code I am on the mobile phone and i can't explain all. If you want I explain everything, but serriousli is a simpli command for freeze


Re: freeze - J4Rr3x - 20.09.2015

pawn Код:
// You need zcmd and sscanf2

CMD:freeze(playerid, params[]) {
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You aren't admin"); // Comment this line if you want the command for all player
   new targetid;
   if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Syntax: /freeze [playerid/playername]");
   TogglePlayerControllable(targetid, 0);
   SendClientMessage(targetid, -1, "An admin froze you.");
   return 1;
}



Re: freeze - jlalt - 20.09.2015

Quote:
Originally Posted by J4Rr3x
Посмотреть сообщение
pawn Код:
// You need zcmd and sscanf2

CMD:freeze(playerid, params[]) {
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You aren't admin"); // Comment this line if you want the command for all player
   new targetid;
   if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Syntax: /freeze [playerid/playername]");
   TogglePlayerControllable(targetid, 0);
   SendClientMessage(targetid, -1, "An admin froze you.");
   return 1;
}
and how the player will unfreeze O.O?

for freeze
PHP код:
CMD:freeze(playeridparams[]) {
   if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"You aren't admin"); // Comment this line if you want the command for all player
   
new targetid,string[128],an[MAX_PLAYER_NAME],pn[MAX_PLAYER_NAME];
   if(
sscanf(params"u"targetid)) return SendClientMessage(playerid, -1"Syntax: /freeze [playerid/playername]");
   
GetPlayerName(playerid,an,sizeof(an)); GetPlayerName(targetid,pn,sizeof(pn));
   
TogglePlayerControllable(targetid0);
   
format(string,sizeof(string),"You has been frozen by administrator: %s",an);
   
SendClientMessage(targetid0x33FF33AAstring);
   
format(string,sizeof(string),"You has frozen %s",pn);
   
SendClientMessage(targetid0x33FF33AAstring);
   return 
1;

for unfreeze
PHP код:
CMD:unfreeze(playeridparams[]) {
   if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"You aren't admin"); // Comment this line if you want the command for all player
   
new targetid,string[128],an[MAX_PLAYER_NAME],pn[MAX_PLAYER_NAME];
   if(
sscanf(params"u"targetid)) return SendClientMessage(playerid, -1"Syntax: /unfreeze [playerid/playername]");
   
GetPlayerName(playerid,an,sizeof(an)); GetPlayerName(targetid,pn,sizeof(pn));
   
TogglePlayerControllable(targetid0);
   
format(string,sizeof(string),"You has been unfrozen by administrator: %s",an);
   
SendClientMessage(targetid0x33FF33AAstring);
   
format(string,sizeof(string),"You has unfrozen %s",pn);
   
SendClientMessage(playerid0x33FF33AAstring);
   return 
1;