Help with Variables.
#1

When i do /arenaDM and its accesgrainted (permitiracceso) it doesnt allow me to join.



pawn Код:
dcmd_permitiracceso(playerid,params[])
{
    #pragma unused params
    CMDMessageToAdmins(playerid,"Permitiracceso");
    if(AdminEnEvento[playerid] == 0) return SendClientMessage(playerid,red,"Necesitas estar en el arena para poder permitir el acceso. /entrararena");
    if(Acceso[playerid] == 1) return SendClientMessage(playerid,red,"El acceso ya esta disponible, Los usuarios ya pueden entrar.");
    {
        new name[24], string[64];
        GetPlayerName(playerid,name, 24);

        format(string, sizeof(string), "El administrador %s a permitido el acceso al arena DM. /arenaDM");
        SendClientMessageToAll(red, string);
        Acceso[playerid] = 1;
    }
    return 1;
}
dcmd_denegaracceso(playerid,params[])
{
    #pragma unused params
    CMDMessageToAdmins(playerid,"Denegaracceso");
    if(AdminEnEvento[playerid] == 0) return SendClientMessage(playerid,red,"Necesitas estar en el arena para poder permitir el acceso. /entrararena");
    if(denega[playerid] == 0) return SendClientMessage(playerid,red,"El acceso ya esta desactivado!");
    {
        new name[24], string[64];
        GetPlayerName(playerid,name, 24);
        format(string, sizeof(string), "El administrador %s a denegado el acceso al arena DM!");
        SendClientMessageToAll(red, string);
        denega[playerid] = 0;
    }
    return 1;
}
dcmd_arenadm(playerid,params[])
{
    #pragma unused params
    if(denega[playerid] == 0)
    {
         SendClientMessage(playerid,red,"No puedes entrar!");
         return 1;
    }
    if(Acceso[playerid] == 1)
    {
        new rand = random(sizeof(RandomSpawn));
        SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
        SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
        SetPlayerPos(playerid, -2196.7324,864.4483,69.7439);
        SetPlayerVirtualWorld(playerid, 8);
        TogglePlayerControllable(playerid,0);
        SendClientMessage(playerid,red,"Bienvenido /SALIRARENA para salir de aqui!");
    }
    return 1;
   
}
Reply
#2

When I do /arenaDM it doesnt leave me join i mean it doesnt teleport me, not even send me unknown command.
Reply
#3

Why did you make a new variable instead of just doing;
pawn Код:
Acceso[playerid] == 1
and use
pawn Код:
Acceso[playerid] = 0
to deny/allow access

If you did it that way you could simply do -
pawn Код:
dcmd_arenadm(playerid,params[])
{
    #pragma unused params
    if(Acceso[playerid] == 1)
    {
        new rand = random(sizeof(RandomSpawn));
        SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
        SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
        SetPlayerPos(playerid, -2196.7324,864.4483,69.7439);
        SetPlayerVirtualWorld(playerid, 8);
        TogglePlayerControllable(playerid,0);
        SendClientMessage(playerid,red,"Bienvenido /SALIRARENA para salir de aqui!");
    }
    else return SendClientMessage(playerid, 0xFF0000AA, "You don't have acess to the area DM!");
    return 1;
   
}
Reply
#4

I tried and it wont work.
Reply
#5

pawn Код:
SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
SetPlayerPos(playerid, -2196.7324,864.4483,69.7439);
Why use SetPlayerPos twice ?
Reply
#6

Fixed SetPlayerPos, Now how to fix the other thing, When I grant access it wont let me come in :S
Reply
#7

Tested it, It failed again :S
Reply
#8

Fine, I fixed it!

And now this wont unfreeze all the players.....just me...

pawn Код:
dcmd_comenzar(playerid,params[])
{
        #pragma unused params
    if(PlayerInfo[playerid][Level] >= 4) {
        CMDMessageToAdmins(playerid,"Comenzar");
        for(new i = 0; i < MAX_PLAYERS; i++) {
            if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel]) {
                PlayerPlaySound(i,1057,0.0,0.0,0.0); TogglePlayerControllable(playerid,true); PlayerInfo[i][Frozen] = 0;
            }
        }
    }
}
Reply
#9

Quote:
Originally Posted by Super_Panda
Посмотреть сообщение
Fine, I fixed it!

And now this wont unfreeze all the players.....just me...

pawn Код:
dcmd_comenzar(playerid,params[])
{
        #pragma unused params
    if(PlayerInfo[playerid][Level] >= 4) {
        CMDMessageToAdmins(playerid,"Comenzar");
        for(new i = 0; i < MAX_PLAYERS; i++) {
            if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel]) {
                PlayerPlaySound(i,1057,0.0,0.0,0.0); TogglePlayerControllable(playerid,true); PlayerInfo[i][Frozen] = 0;
            }
        }
    }
}
pawn Код:
TogglePlayerControllable(i, true);
EDIT: Having (playerid, true) will only unfreeze the player that has executed the command... in this case... you.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)