Freeze & Unfreeze.
#1

Hey SAMP'ers.

I've edited my command /freeze and /unfreeze, original it was that everybody could see if someone got frozen or got unfrozen so I changed it abit.
I wanna have, if you got frozen by an admin that you will get the message: "You got frozen by admin (name)"
If an admin freezes someone, he should get the message: "You frozen (name)"

And the same for /unfreeze, thanks in advance.
Reply
#2

send your freeze and unfreeze lines
Reply
#3

pawn Код:
if(strcmp(cmd, "/unfreeze", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "(USAGE) /unfreeze [playerid/partofname]");
                return 1;
            }
            new playa;
            playa = ReturnUser(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 1)
            {
              if(IsPlayerConnected(playa))
              {
                if(playa != INVALID_PLAYER_ID)
                {
                        TogglePlayerControllable(playa, 1);
                        format(string, sizeof(string), "You got unfrozen by %s",sendername);
                        SendClientMessage(playa,COLOR_RED,string);
                        format(string, sizeof(string), "You've unfrozen %s",giveplayer);
                        SendClientMessage(playerid,COLOR_RED,string);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "Attempt denied! You are not authorized to use that command!");
            }
        }
        return 1;
    }
if(strcmp(cmd, "/freeze", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "(USAGE) /unfreeze [playerid/partofname]");
                return 1;
            }
            new playa;
            playa = ReturnUser(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 1)
            {
              if(IsPlayerConnected(playa))
              {
                if(playa != INVALID_PLAYER_ID)
                {
                        TogglePlayerControllable(playa, 0);
                        format(string, sizeof(string), "You got frozen by %s",sendername);
                        SendClientMessage(playa,COLOR_RED,string);
                        format(string, sizeof(string), "You frozen %s",giveplayer);
                        SendClientMessage(playerid,COLOR_RED,string);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "Attempt denied! You are not authorized to use that command!");
            }
        }
        return 1;
    }
Reply
#4

isn't it already in your script? lol i think i don't get what you want...
Reply
#5

Quote:
Originally Posted by pmk1
isn't it already in your script? lol i think i don't get what you want...


That's the mistake, you don't see who unfrozen you.
Reply
#6

bump
Reply
#7

that should work :

Код:
if(strcmp(cmd, "/unfreeze", true) == 0)
	{
      new pNaME[MAX_PLAYER_NAME];
      GetPlayerName(playerid,pNaME,sizeof(pNaME));
	  if(IsPlayerConnected(playerid))
	  {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "(USAGE) /unfreeze [playerid/partofname]");
				return 1;
			}
			new playa;
			playa = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
			  if(IsPlayerConnected(playa))
			  {
			    if(playa != INVALID_PLAYER_ID)
			    {
						TogglePlayerControllable(playa, 1);
						format(string, sizeof(string), "You got unfrozen by %s",pNaME);
						SendClientMessage(playa,COLOR_RED,string);
						format(string, sizeof(string), "You've unfrozen %s",playa);
						SendClientMessage(playerid,COLOR_RED,string);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_RED, "Attempt denied! You are not authorized to use that command!");
			}
		}
		return 1;
	}
if(strcmp(cmd, "/freeze", true) == 0)
	{
      new pNamE[MAX_PLAYER_NAME];
      GetPlayerName(playerid,pNamE,sizeof(pNamE));
	  if(IsPlayerConnected(playerid))
	  {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "(USAGE) /unfreeze [playerid/partofname]");
				return 1;
			}
			new playa;
			playa = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
			  if(IsPlayerConnected(playa))
			  {
			    if(playa != INVALID_PLAYER_ID)
			    {
						TogglePlayerControllable(playa, 0);
						format(string, sizeof(string), "You got frozen by %s",pNamE);
						SendClientMessage(playa,COLOR_RED,string);
						format(string, sizeof(string), "You frozen %s",playa);
						SendClientMessage(playerid,COLOR_RED,string);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_RED, "Attempt denied! You are not authorized to use that command!");
			}
		}
		return 1;
	}
Reply
#8



Mhm..
Reply
#9

try that :

Код:
if(strcmp(cmd, "/unfreeze", true) == 0)
	{
      new string128[128];
      new pNaME[MAX_PLAYER_NAME];
      GetPlayerName(playerid,pNaME,sizeof(pNaME));
	  if(IsPlayerConnected(playerid))
	  {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "(USAGE) /unfreeze [playerid/partofname]");
				return 1;
			}
			new playa;
			playa = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
			  if(IsPlayerConnected(playa))
			  {
			    if(playa != INVALID_PLAYER_ID)
			    {
						TogglePlayerControllable(playa, 1);
						format(string, sizeof(string), "You got unfrozen by %s",pNaME);
						SendClientMessage(playa,COLOR_RED,string);
						format(string128, sizeof(string128), "You've unfrozen %s",playa);
						SendClientMessage(playerid,COLOR_RED,string);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_RED, "Attempt denied! You are not authorized to use that command!");
			}
		}
		return 1;
	}
if(strcmp(cmd, "/freeze", true) == 0)
	{
      new string128[128];
      new pNamE[MAX_PLAYER_NAME];
      GetPlayerName(playerid,pNamE,sizeof(pNamE));
	  if(IsPlayerConnected(playerid))
	  {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "(USAGE) /unfreeze [playerid/partofname]");
				return 1;
			}
			new playa;
			playa = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
			  if(IsPlayerConnected(playa))
			  {
			    if(playa != INVALID_PLAYER_ID)
			    {
						TogglePlayerControllable(playa, 0);
						format(string, sizeof(string), "You got frozen by %s",pNamE);
						SendClientMessage(playa,COLOR_RED,string);
						format(string128, sizeof(string128), "You frozen %s",playa);
						SendClientMessage(playerid,COLOR_RED,string);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_RED, "Attempt denied! You are not authorized to use that command!");
			}
		}
		return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)