Some Admin Commands?
#1

Can any one give me /freeze, /freezeall and /unfreeze and /unfreezeall Command?
Reply
#2

pawn Код:
CMD:freeze(playerid,params[])
{
    new id;
    if(sscanf(params,"u",id)) return SendClientMessage(playerid,-1,"USAGE: /freeze [playerid]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"ERROR: Invalid playerid");
    TogglePlayerControllable(id,0);
    GameTextForPlayer(id,"~r~frozen",4000,4);
    return 1;
}

CMD:unfreeze(playerid,params[])
{
    new id;
    if(sscanf(params,"u",id)) return SendClientMessage(playerid,-1,"USAGE: /unfreeze [playerid]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"ERROR: Invalid playerid");
    TogglePlayerControllable(id,1);
    GameTextForPlayer(id,"~r~unfrozen",4000,4);
    return 1;
}

CMD:unfreezeall(playerid,params[])
{
    foreach(new i:Player)
    {
        TogglePlayerControllable(i,1);
        GameTextForPlayer(i,"~r~unfrozen",4000,4);
    }
    return 1;
}

CMD:freezeall(playerid,params[])
{
    foreach(new i:Player)
    {
        TogglePlayerControllable(i,0);
        GameTextForPlayer(i,"~r~frozen",4000,4);
    }
    return 1;
}
Don't forget to include foreach and zcmd.
Reply
#3

Got these Errors:

pawn Код:
E:\SCRIPT\gamemodes\Gamemode.pwn(1326) : error 029: invalid expression, assumed zero
E:\SCRIPT\gamemodes\Gamemode.pwn(1326) : error 017: undefined symbol "Playerid"
E:\SCRIPT\gamemodes\Gamemode.pwn(1326) : error 029: invalid expression, assumed zero
E:\SCRIPT\gamemodes\Gamemode.pwn(1326) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Line 1326 is:

pawn Код:
foreach(new i:Playerid)
Reply
#4

foreach(new i:Player)
Reply
#5

Yes same problem with

pawn Код:
foreach(new i:Player)
Reply
#6

Did you include foreach.inc?
Reply
#7

I made it in a little fs there:
pawn Код:
#include <a_samp>
#include <foreach>
#include <sscanf2>
#include <zcmd>

CMD:freeze(playerid,params[])
{
    new id;
    if(sscanf(params,"u",id)) return SendClientMessage(playerid,-1,"USAGE: /freeze [playerid]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"ERROR: Invalid playerid");
    TogglePlayerControllable(id,0);
    GameTextForPlayer(id,"~r~frozen",4000,4);
    return 1;
}

CMD:unfreeze(playerid,params[])
{
    new id;
    if(sscanf(params,"u",id)) return SendClientMessage(playerid,-1,"USAGE: /unfreeze [playerid]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"ERROR: Invalid playerid");
    TogglePlayerControllable(id,1);
    GameTextForPlayer(id,"~r~unfrozen",4000,4);
    return 1;
}

CMD:unfreezeall(playerid,params[])
{
    foreach(new i:Player)
    {
        TogglePlayerControllable(i,1);
        GameTextForPlayer(i,"~r~unfrozen",4000,4);
    }
    return 1;
}

CMD:freezeall(playerid,params[])
{
    foreach(new i:Player)
    {
        TogglePlayerControllable(i,0);
        GameTextForPlayer(i,"~r~frozen",4000,4);
    }
    return 1;
}
So if you have the includes it should work fine.
There are links for them:
Foreach
Sscanf
ZCMD
Reply
#8

Yes I included it. But It is giving errors which defined above already !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)