/freeze
#1

How do i make a /freeze cmd.
Only if you have the username "Sal_Kings" then you can use it.

/freeze id
Player freezes
/unfreeze id
Player unfreezes
Reply
#2

Use DCMD to make the /freeze.
Reply
#3

pawn Код:
new
  n[MAX_PLAYER_NAME];
GetPlayerName(playerid,n,sizeof(n));
if(!strcmp(n,"Sal_Kings")) // the rest.
Reply
#4

Try this:

Код:
//==================================<[freeze]>=============================================================
if(strcmp(cmd, "/freeze", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /freeze [playerid/PartOfName]");
				return 1;
			}
			new playa;
			playa = ReturnUser(tmp);
			if(PlayerInfo[playa][pAdmin] > 0)
			{
				SendClientMessage(playerid, COLOR_GRAD2, "Admins can not be frozen");
				return 1;
			}
			if (PlayerInfo[playerid][pAdmin] >= 2)
			{
			  if(IsPlayerConnected(playa))
			  {
			    if(playa != INVALID_PLAYER_ID)
			    {
				    GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						TogglePlayerControllable(playa, 0);
						format(string, sizeof(string), "AdmCmd: %s Freezes %s",sendername, giveplayer);
						printf("%s",string);
						format(string, sizeof(string), "AdmCmd: %s was Frozen by %s",giveplayer ,sendername);
						ABroadCast(COLOR_LIGHTRED,string,1);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "  you are not authorized to use that command!");
			}
		}
		return 1;
	}

//==================================<[unfreeze]>=============================================================
	if(strcmp(cmd, "/unfreeze", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /unfreeze [playerid]");
				return 1;
			}
			new playa;
			playa = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
			  if(IsPlayerConnected(playa))
			  {
			    if(playa != INVALID_PLAYER_ID)
			    {
			  	  GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						TogglePlayerControllable(playa, 1);
						format(string, sizeof(string), "AdmCmd: %s UnFroze %s",sendername, giveplayer);
						printf("%s",string);
						format(string, sizeof(string), "AdmCmd: %s was UnFrozen by %s",giveplayer ,sendername);
						ABroadCast(COLOR_LIGHTRED,string,1);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "  you are not authorized to use that command!");
			}
		}
		return 1;
	}
Reply
#5

Код:
if(strcmp(cmd, "/freeze", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /freeze [playerid/PartOfName]");
				return 1;
			}
			new playa;
			playa = ReturnUser(tmp);
			if(PlayerInfo[playa][pAdmin] > 0)
			{
				SendClientMessage(playerid, COLOR_GRAD2, "Admins can not be frozen");
				return 1;
			}
			if (PlayerInfo[playerid][pAdmin] >= 2)
			{
			  if(IsPlayerConnected(playa))
			  {
			    if(playa != INVALID_PLAYER_ID)
			    {
				    GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						TogglePlayerControllable(playa, 0);
						format(string, sizeof(string), "AdmCmd: %s Freezes %s",sendername, giveplayer);
						printf("%s",string);
						format(string, sizeof(string), "AdmCmd: %s was Frozen by %s",giveplayer ,sendername);
						ABroadCast(COLOR_LIGHTRED,string,1);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "  you are not authorized to use that command!");
			}
		}
		return 1;
	}
Код:
C:\Documents and Settings\home\Desktop\samp02Xserver.win32\gamemodes\_gamemodes__gamemodes_SalsTestingGrounds.pwn(811) : error 017: undefined symbol "cmd"
C:\Documents and Settings\home\Desktop\samp02Xserver.win32\gamemodes\_gamemodes__gamemodes_SalsTestingGrounds.pwn(815) : error 017: undefined symbol "tmp"
C:\Documents and Settings\home\Desktop\samp02Xserver.win32\gamemodes\_gamemodes__gamemodes_SalsTestingGrounds.pwn(815) : error 017: undefined symbol "strtok"
C:\Documents and Settings\home\Desktop\samp02Xserver.win32\gamemodes\_gamemodes__gamemodes_SalsTestingGrounds.pwn(816) : error 017: undefined symbol "tmp"
C:\Documents and Settings\home\Desktop\samp02Xserver.win32\gamemodes\_gamemodes__gamemodes_SalsTestingGrounds.pwn(818) : error 017: undefined symbol "COLOR_GRAD2"
C:\Documents and Settings\home\Desktop\samp02Xserver.win32\gamemodes\_gamemodes__gamemodes_SalsTestingGrounds.pwn(822) : error 017: undefined symbol "ReturnUser"
C:\Documents and Settings\home\Desktop\samp02Xserver.win32\gamemodes\_gamemodes__gamemodes_SalsTestingGrounds.pwn(823) : error 017: undefined symbol "PlayerInfo"
C:\Documents and Settings\home\Desktop\samp02Xserver.win32\gamemodes\_gamemodes__gamemodes_SalsTestingGrounds.pwn(823) : warning 215: expression has no effect
C:\Documents and Settings\home\Desktop\samp02Xserver.win32\gamemodes\_gamemodes__gamemodes_SalsTestingGrounds.pwn(823) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\home\Desktop\samp02Xserver.win32\gamemodes\_gamemodes__gamemodes_SalsTestingGrounds.pwn(823) : error 029: invalid expression, assumed zero
C:\Documents and Settings\home\Desktop\samp02Xserver.win32\gamemodes\_gamemodes__gamemodes_SalsTestingGrounds.pwn(823) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


10 Errors.
Reply
#6

Sal_Kings.. Of course you'll have to modify the script, you can't just copy-paste it like that.
You'll have to define certain things.
Reply
#7

Quote:
Originally Posted by Anarkien
Sal_Kings.. Of course you'll have to modify the script, you can't just copy-paste it like that.
You'll have to define certain things.
Код:
C:\Documents and Settings\home\Desktop\samp02Xserver.win32\gamemodes\_gamemodes__gamemodes_SalsTestingGrounds.pwn(815) : error 017: undefined symbol "strtok"
I don't understand this.
This is the line.
Код:
			tmp = strtok(cmdtext, idx);
Reply
#8

Uhh, people just copy to you codes from their GF scripts.
Reply
#9

Quote:
Originally Posted by MenaceX^
Uhh, people just copy to you codes from their GF scripts.
:/ they are abusing me because i am new.
Reply
#10

Quote:
Originally Posted by Sal_Kings
Quote:
Originally Posted by MenaceX^
Uhh, people just copy to you codes from their GF scripts.
:/ they are abusing me because i am new.
Haha, I lol'd.. No, it's because they can't make it themselves, so they copy-paste whatever they might find to try to looks smart.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)