SA-MP Forums Archive
all freeze command - 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: all freeze command (/showthread.php?tid=531394)



all freeze command - XGreen - 12.08.2014

hi guys, i want to make this script to freeze only players that doesnt have admin levels:
PHP код:
CMD:freezeall(playeridparams[])
{
    if(
pInfo[playerid][pAdminLevel] < 3) return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    foreach (new 
Player)
    {
        if(
pInfo[playerid][pAdminLevel] >= 0)
        {
            
TogglePlayerControllable(i0);
        }
    }
    new 
pname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpname,sizeof(pname));
    new 
string[60];
    
format(string,sizeof(string), "{FF0000}Admin %s {FFFFFF} has frozen everyone!"pname);
    
SendClientMessageToAll(-1string);
    return 
1;




Re: all freeze command - Stinged - 12.08.2014

pawn Код:
CMD:freezeall(playerid, params[])
{
    if(pInfo[playerid][pAdminLevel] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    foreach (new i : Player)
    {
        if(pInfo[playerid][pAdminLevel] == 0)
        {
            TogglePlayerControllable(i, 0);
        }
    }
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname,sizeof(pname));
    new string[68];
    // This string uses more than 60 characters
    // Name(24 char) + {FF0000}Admin  {FFFFFFF}has frozen everyone! = 68
    format(string,sizeof(string), "{FF0000}Admin %s {FFFFFF}has frozen everyone!", pname);
    SendClientMessageToAll(-1, string);
    return 1;
}



Re: all freeze command - Affan - 12.08.2014

Quote:
Originally Posted by Stinged
Посмотреть сообщение
pawn Код:
CMD:freezeall(playerid, params[])
{
    if(pInfo[playerid][pAdminLevel] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    foreach (new i : Player)
    {
        if(pInfo[playerid][pAdminLevel] == 0)
        {
            TogglePlayerControllable(i, 0);
        }
    }
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname,sizeof(pname));
    new string[68];
    // This string uses more than 60 characters
    // Name(24 char) + {FF0000}Admin  {FFFFFFF}has frozen everyone! = 68
    format(string,sizeof(string), "{FF0000}Admin %s {FFFFFF}has frozen everyone!", pname);
    SendClientMessageToAll(-1, string);
    return 1;
}
You mean
pawn Код:
CMD:freezeall(playerid, params[])
{
    if(pInfo[playerid][pAdminLevel] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    foreach (new i : Player)
    {
        if(pInfo[i][pAdminLevel] == 0) // Checks if the looped players are not admin
        {
            TogglePlayerControllable(i, 0);
        }
    }
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname,sizeof(pname));
    new string[68];
    // This string uses more than 60 characters
    // Name(24 char) + {FF0000}Admin  {FFFFFFF}has frozen everyone! = 68
    format(string,sizeof(string), "{FF0000}Admin %s {FFFFFF}has frozen everyone!", pname);
    SendClientMessageToAll(-1, string);
    return 1;
}



Re: all freeze command - Stinged - 12.08.2014

Quote:
Originally Posted by Affan
Посмотреть сообщение
You mean
pawn Код:
CMD:freezeall(playerid, params[])
{
    if(pInfo[playerid][pAdminLevel] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    foreach (new i : Player)
    {
        if(pInfo[i][pAdminLevel] == 0) // Checks if the looped players are not admin
        {
            TogglePlayerControllable(i, 0);
        }
    }
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname,sizeof(pname));
    new string[68];
    // This string uses more than 60 characters
    // Name(24 char) + {FF0000}Admin  {FFFFFFF}has frozen everyone! = 68
    format(string,sizeof(string), "{FF0000}Admin %s {FFFFFF}has frozen everyone!", pname);
    SendClientMessageToAll(-1, string);
    return 1;
}
Yes, I made a mistake, use this instead of mine (I used playerid instead of i in the loop admin check)