[Help] Command Does Not Work
#1

pawn Код:
ACMD:congelarevento[1](playerid, params[])
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(e_Participando[i] == true)
        {
            TogglePlayerControllable(i, 0);
        }
    }

    new str[544];
    format(str, sizeof(str), "[ > ] O Administrador {FFFFFF}%s{00D0F6} congelou todos participantes do evento!", name);
    SendClientMessageToAll(COLOR_LIGHTBLUE, str);
    return 1;
}

it is meant to freeze only those who are participating in the event, so I did a check, in case you are participating in the event is as (true), following the command, it was supposed for everyone who is participating to be frozen, but that does not happen, you know why?
Reply
#2

Hello, your code should work OK you did everything right.

Is it freezing only few people or it does not freeze anyone at all?

Are you sure e_Participando variable is the only variable for event participants.

You should loop online players using IsPlayerConnected with e_Partricipando like this:-
pawn Код:
if(IsPlayerConnected(i)&==&== e_Participando[i] == true)
consider using 128 array size for sending a message because that is the maximum characters what one line can hold
Reply
#3

The command does not freeze anyone, the part below compiles and executes everything right, but in the game does not work:

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(e_Participando[i] == true)
        {
            TogglePlayerControllable(i, 0);
        }
    }
The funniest thing is that it has another command, which also has the same function, except that it is with all the players of the server and not only with those who are in the event, see:

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
    TogglePlayerControllable(i, 0);
a tried to put this, how you wrote:

pawn Код:
if(IsPlayerConnected(i)&==&== e_Participando[i] == true)
But he gives me back this errors that had not happened on compile before

SS/Core/Admin/Admin-MasterCMD.pwn(184) : error 022: must be lvalue (non-constant)
SS/Core/Admin/Admin-MasterCMD.pwn(184) : error 029: invalid expression, assumed zero
SS/Core/Admin/Admin-MasterCMD.pwn(184) : error 029: invalid expression, assumed zero
SS/Core/Admin/Admin-MasterCMD.pwn(184) : fatal error 107: too many error messages on one line

So, I think that maybe this is that makes the code fail in game, but I do not know why:
pawn Код:
if(e_Participando[i] == true)
        {
            TogglePlayerControllable(i, 0);
        }
Reply
#4

wtf...
those " = " came itself, sorry it should be like this:-
pawn Код:
if(IsPlayerConnected(i) && e_Participando[i] == true)
yes i know it should compile and it should technically be working, now only problem i can think of is that you are missing something.
EDIT: what event system are you using maybe i can take a look or something
Reply
#5

lol, it happens.

I put it like you said but it still does not work, I give the command and it does not freeze anyone.
Reply
#6

if(e_Participando[i] == true)
pawn Код:
e_Participando
Are you sure this is defined as a bool?
If so try changing it, make it 0/1 instead of true/false.
bool is supposed to work like this far as i know
pawn Код:
if(e_participando{i} == value)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)