damn freeze
#1

ok im not really a script noob but this damn little freeze/unfreeze command send me round the bend...
Код:
if(strcmp(cmd, "/freeze", true) == 0)
            {
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "VERWENDE: /freeze [SpielerID/Name]");
				return 1;
			}
			new playa;
			playa = ReturnUser(tmp);
			if(IsPlayerAdmin(playerid))
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			                {
						TogglePlayerControllable(playa, 0);
					}
				}
				else
				{
				SendClientMessage(playerid, COLOR_WHITE, "SERVER: Unknown command.");
				}
			}
		return 1;
           }
//------
	if(strcmp(cmd, "/unfreeze", true) == 0)
		{
	        if(IsPlayerConnected(playerid))
	        {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "VERWENDE: /unfreeze [SpielerID/Name]");
				return 1;
			}
			new playa;
			playa = ReturnUser(tmp);
			if(IsPlayerAdmin(playerid))
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			                {
						TogglePlayerControllable(playa, 1);
					}
				}
				else
				{
				SendClientMessage(playerid, COLOR_WHITE, "SERVER: Unknown command.");
				}
			}
		return 1;
	   }
whats wrong with it??
Reply
#2

pawn Код:
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(IsPlayerAdmin(playa))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Admins can not be frozen");
                return 1;
            }
            if (IsPlayerAdmin(playerid))
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        TogglePlayerControllable(playa, 0);
                        GameTextForPlayer(playa, "~r~Frozen", 5000, 3);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Unknown Command!");
            }
        }
        return 1;
    }
    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 (IsPlayerAdmin(playerid))
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        TogglePlayerControllable(playa, 1);
                        GameTextForPlayer(playa, "~w~Unfrozen", 5000, 3);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Unknown Command!");
            }
        }
        return 1;
    }
Reply
#3

thx it works but how to script it that admins can be frozen?
Reply
#4

pawn Код:
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 (IsPlayerAdmin(playerid))
        {
            if(IsPlayerConnected(playa))
            {
                if(playa != INVALID_PLAYER_ID)
                {
                    TogglePlayerControllable(playa, 0);
                    GameTextForPlayer(playa, "~r~Frozen", 5000, 3);
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GRAD2, "Unknown Command!");
        }
    }
    return 1;
}
Reply
#5

yeah thats it thanks^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)