/freeze and /unfreeze
#1

/freeze makes admin that does that command frozen, can someone help me what's wrong with it? and /unfreeze does the same
Код:
CMD:freeze(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
	    new giveplayerid;
	    if(!sscanf(params, "u", giveplayerid))
	    {
	        if(gPlayerLogged[giveplayerid] == 1)
	        {
      			new targetlevel = PlayerInfo[giveplayerid][pAdmin];
		        new playerlevel = PlayerInfo[playerid][pAdmin];
		        if(playerlevel > targetlevel)
		        {
	            	PlayerInfo[giveplayerid][pFreeze] = 1;
					GameTextForPlayer(giveplayerid, "FREEZE", 1500, 3);
					TogglePlayerControllable(giveplayerid, 0);
					OnPlayerUpdateEx(giveplayerid);
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "Anda tidak dapat menggunakannya ke level yang lebih tinggi!");
				}
			}
		}
		else
		{
		    SendClientMessage(playerid, COLOR_GREY, "PENGGUNAAN: /freeze [playerid]");
		}
	}
	return 1;
}
Reply
#2

I Made This Hope It Helps You:

Add this on top Of Your Script:


Код:
new Float:FX[MAX_PLAYERS], Float:FY[MAX_PLAYERS], Float:FZ[MAX_PLAYERS];
new IsFrozen[MAX_PLAYERS]; 
new playerb;
CMD:

Код:
CMD:freeze(playerid, params[]) // ZCMD Start
{
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /freeze [playerid]"); // SSCANF check if we entered an id or not
    if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, 0xFFFFFFAA, "Invalid player id"); // Check if the player id we entered is valid
    if(IsFrozen[playerb]) return SendClientMessage(playerid, 0xFFFFFFAA, "Player is already frozen."); // Check if the player is frozen already
    IsFrozen[playerb] = 1; // Sets the player's frozen variable to 1
    GetPlayerPos(playerb, FX[playerb], FY[playerb], FZ[playerb]); // Saves the player's coordinates to the variables we defined at the top
    SendClientMessage(playerb, 0xFFFFFFAA, "You have been frozen."); // Sends a message to the player informing him about being frozen
    return 1;
}

CMD:unfreeze(playerid, params[]) // ZCMD Start
{
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /unfreeze [playerid]");// SSCANF check if we entered an id or not
    if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, 0xFFFFFFAA, "Invalid player id"); // Check if the player id we entered is valid
    if(!IsFrozen[playerb]) return SendClientMessage(playerid, 0xFFFFFFAA, "Player is not frozen.");  // Check if the player is not frozen
    IsFrozen[playerb] = 0; // Sets the player's frozen variable to 0
    SendClientMessage(playerb, 0xFFFFFFAA, "You have been unfrozen."); // Sends a message to the player informing him about being unfrozen
    return 1;
}
Under OnPlayerUpdate

Код:
if(IsFrozen[playerid]) // Check to make sure the player is frozen
{
    if(GetPlayerWeapon(playerid) != 0) // Check to see if the player is holding a weapon
    {
        SetPlayerArmedWeapon(playerid, 0); // Hides the weapon from player's hand, to prevent shooting while standing still
    }
    new Float:FFX, Float:FFY, Float:FFZ; // Variables we will use to compare to the ones we defined at the top
    GetPlayerPos(playerid, FFX, FFY, FFZ); // Getting the player's current position
    if(FX[playerid] != FFX || FY[playerid] != FFY || FZ[playerid] != FFZ) // Check to see if the player has moved
    {
        SetPlayerPos(playerid, FX[playerid], FY[playerid], FZ[playerid]); // Sets his position back to the coordinates he was frozen at
    }
}
Hope this helps u
Reply
#3

Just edit LuxAdmin script.
Reply
#4

Okay, thanks for helping guys!
Reply
#5

^^^No Problem Dude!

(If u want u can rep me, Im in a real need of it , But rep if u want)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)