Y_Commands not setting to per-group!
#1

Well, Alex(Y-Less) made the Y-Commands to have the ability to be set only to be used by certain groups... And the code I use to do that is here,
pawn Код:
stock SetGroupCommands()
{
    //Alternative Commands
    Command_AddAltNamed("announce", "ann");
    Command_AddAltNamed("adminchat", "ac");
    Command_AddAltNamed("giveallweapon", "gaw");
    Command_AddAltNamed("resetallweapons", "raw");
    Command_AddAltNamed("backpack", "bp");

    //All Players
    Group_SetGlobalCommand(Command_GetID("warn"), false);
    Group_SetGlobalCommand(Command_GetID("announce"), false);
    Group_SetGlobalCommand(Command_GetID("ann"), false);
    Group_SetGlobalCommand(Command_GetID("hide"), false);
    Group_SetGlobalCommand(Command_GetID("unhide"), false);
    Group_SetGlobalCommand(Command_GetID("adminchat"), false);
    Group_SetGlobalCommand(Command_GetID("ac"), false);
    Group_SetGlobalCommand(Command_GetID("reports"), false);
    Group_SetGlobalCommand(Command_GetID("checkreport"), false);

    Group_SetGlobalCommand(Command_GetID("respawn"), false);
    Group_SetGlobalCommand(Command_GetID("resetweapons"), false);
    Group_SetGlobalCommand(Command_GetID("get"), false);
    Group_SetGlobalCommand(Command_GetID("goto"), false);

    Group_SetGlobalCommand(Command_GetID("kick"), false);
    Group_SetGlobalCommand(Command_GetID("slap"), false);
    Group_SetGlobalCommand(Command_GetID("fakechat"), false);
    Group_SetGlobalCommand(Command_GetID("mute"), false);
    Group_SetGlobalCommand(Command_GetID("unmute"), false);
    Group_SetGlobalCommand(Command_GetID("giveweapon"), false);
    Group_SetGlobalCommand(Command_GetID("car"), false);
    Group_SetGlobalCommand(Command_GetID("givecar"), false);

    Group_SetGlobalCommand(Command_GetID("write"), false);
    Group_SetGlobalCommand(Command_GetID("freeze"), false);
    Group_SetGlobalCommand(Command_GetID("unfreeze"), false);
    Group_SetGlobalCommand(Command_GetID("explode"), false);
    Group_SetGlobalCommand(Command_GetID("settime"), false);
    Group_SetGlobalCommand(Command_GetID("setweather"), false);
    Group_SetGlobalCommand(Command_GetID("setgravity"), false);
    Group_SetGlobalCommand(Command_GetID("healall"), false);
    Group_SetGlobalCommand(Command_GetID("armourall"), false);
    Group_SetGlobalCommand(Command_GetID("giveallweapon"), false);
    Group_SetGlobalCommand(Command_GetID("gaw"), false);
    Group_SetGlobalCommand(Command_GetID("resetallweapons"), false);
    Group_SetGlobalCommand(Command_GetID("raw"), false);

    Group_SetGlobalCommand(Command_GetID("ban"), false);
    Group_SetGlobalCommand(Command_GetID("sethealth"), false);
    Group_SetGlobalCommand(Command_GetID("setarmour"), false);
    Group_SetGlobalCommand(Command_GetID("setcarhealth"), false);
    Group_SetGlobalCommand(Command_GetID("fixcar"), false);

    Group_SetGlobalCommand(Command_GetID("setlevel"), false);
    Group_SetGlobalCommand(Command_GetID("setvip"), false);
    Group_SetGlobalCommand(Command_GetID("setcash"), false);
    Group_SetGlobalCommand(Command_GetID("givecash"), false);
    Group_SetGlobalCommand(Command_GetID("takecash"), false);
    Group_SetGlobalCommand(Command_GetID("setscore"), false);
    Group_SetGlobalCommand(Command_GetID("givescore"), false);
    Group_SetGlobalCommand(Command_GetID("takescore"), false);



    //Level 1 Commands
    Group_SetCommand(aGroup[Level1], Command_GetID("warn"), true);
    Group_SetCommand(aGroup[Level1], Command_GetID("announce"), true);
    Group_SetCommand(aGroup[Level1], Command_GetID("ann"), true);
    Group_SetCommand(aGroup[Level1], Command_GetID("hide"), true);
    Group_SetCommand(aGroup[Level1], Command_GetID("unhide"), true);
    Group_SetCommand(aGroup[Level1], Command_GetID("adminchat"), true);
    Group_SetCommand(aGroup[Level1], Command_GetID("ac"), true);
    Group_SetCommand(aGroup[Level1], Command_GetID("reports"), true);
    Group_SetCommand(aGroup[Level1], Command_GetID("checkreport"), true);

    //Level 2 Commands
    Group_SetCommand(aGroup[Level2], Command_GetID("respawn"), true);
    Group_SetCommand(aGroup[Level2], Command_GetID("resetweapons"), true);
    Group_SetCommand(aGroup[Level2], Command_GetID("get"), true);
    Group_SetCommand(aGroup[Level2], Command_GetID("goto"), true);

    //Level 3 Commands
    Group_SetCommand(aGroup[Level3], Command_GetID("kick"), true);
    Group_SetCommand(aGroup[Level3], Command_GetID("slap"), true);
    Group_SetCommand(aGroup[Level3], Command_GetID("fakechat"), true);
    Group_SetCommand(aGroup[Level3], Command_GetID("mute"), true);
    Group_SetCommand(aGroup[Level3], Command_GetID("unmute"), true);
    Group_SetCommand(aGroup[Level3], Command_GetID("giveweapon"), true);
    Group_SetCommand(aGroup[Level3], Command_GetID("car"), true);
    Group_SetCommand(aGroup[Level3], Command_GetID("givecar"), true);

    //Level 4 Commands
    Group_SetCommand(aGroup[Level4], Command_GetID("write"), true);
    Group_SetCommand(aGroup[Level4], Command_GetID("freeze"), true);
    Group_SetCommand(aGroup[Level4], Command_GetID("unfreeze"), true);
    Group_SetCommand(aGroup[Level4], Command_GetID("explode"), true);
    Group_SetCommand(aGroup[Level4], Command_GetID("settime"), true);
    Group_SetCommand(aGroup[Level4], Command_GetID("setweather"), true);
    Group_SetCommand(aGroup[Level4], Command_GetID("setgravity"), true);
    Group_SetCommand(aGroup[Level4], Command_GetID("healall"), true);
    Group_SetCommand(aGroup[Level4], Command_GetID("armourall"), true);
    Group_SetCommand(aGroup[Level4], Command_GetID("giveallweapon"), true);
    Group_SetCommand(aGroup[Level4], Command_GetID("gaw"), true);
    Group_SetCommand(aGroup[Level4], Command_GetID("resetallweapons"), true);
    Group_SetCommand(aGroup[Level4], Command_GetID("raw"), true);

    //Level 5 Commands
    Group_SetCommand(aGroup[Level5], Command_GetID("ban"), true);
    Group_SetCommand(aGroup[Level5], Command_GetID("sethealth"), true);
    Group_SetCommand(aGroup[Level5], Command_GetID("setarmour"), true);
    Group_SetCommand(aGroup[Level5], Command_GetID("setcarhealth"), true);
    Group_SetCommand(aGroup[Level5], Command_GetID("fixcar"), true);

    //Level 6 Commands
    Group_SetCommand(aGroup[Level6], Command_GetID("setlevel"), true);
    Group_SetCommand(aGroup[Level6], Command_GetID("setvip"), true);
    Group_SetCommand(aGroup[Level6], Command_GetID("setcash"), true);
    Group_SetCommand(aGroup[Level6], Command_GetID("givecash"), true);
    Group_SetCommand(aGroup[Level6], Command_GetID("takecash"), true);
    Group_SetCommand(aGroup[Level6], Command_GetID("setscore"), true);
    Group_SetCommand(aGroup[Level6], Command_GetID("givescore"), true);
    Group_SetCommand(aGroup[Level6], Command_GetID("takescore"), true);

    //Rcon Only
    Group_SetCommand(aGroup[Rcon], Command_GetID("setlevel"), true);
}
Problem?

They dont get set at all! When i'm in game, I know my level is correct by doing /admins... Also I know Im in the correct admin group because after a player logs in, I run THIS:
pawn Код:
stock SetPlayerAdminandVIPGroup(playerid)
{
    Group_SetPlayer(aGroup[Level1], playerid, false);
    Group_SetPlayer(aGroup[Level2], playerid, false);
    Group_SetPlayer(aGroup[Level3], playerid, false);
    Group_SetPlayer(aGroup[Level4], playerid, false);
    Group_SetPlayer(aGroup[Level5], playerid, false);
    Group_SetPlayer(aGroup[Level6], playerid, false);
    if(pData[playerid][Level] >= 1)Group_SetPlayer(aGroup[Level1], playerid, true);
    if(pData[playerid][Level] >= 2)Group_SetPlayer(aGroup[Level2], playerid, true);
    if(pData[playerid][Level] >= 3)Group_SetPlayer(aGroup[Level3], playerid, true);
    if(pData[playerid][Level] >= 4)Group_SetPlayer(aGroup[Level4], playerid, true);
    if(pData[playerid][Level] >= 5)Group_SetPlayer(aGroup[Level5], playerid, true);
    if(pData[playerid][Level] == 6)Group_SetPlayer(aGroup[Level6], playerid, true);

    Group_SetPlayer(vGroup[Bronze], playerid, false);
    Group_SetPlayer(vGroup[Silver], playerid, false);
    Group_SetPlayer(vGroup[Golden], playerid, false);
    if(pData[playerid][VIP] >= 1)Group_SetPlayer(vGroup[Bronze], playerid, true);
    if(pData[playerid][VIP] >= 2)Group_SetPlayer(vGroup[Silver], playerid, true);
    if(pData[playerid][VIP] == 3)Group_SetPlayer(vGroup[Golden], playerid, true);

    if(!IsPlayerAdmin(playerid))Group_SetPlayer(aGroup[Rcon], playerid, false);
    if(IsPlayerAdmin(playerid))Group_SetPlayer(aGroup[Rcon], playerid, true);
}
But when I try to do any of ADMIN the commands while in game, they don't work.. But all regular commands work...









Also, can someone tell me how to detect when a player logs in to RCON and get his id? OnRconLoginAttempt doesnt give the players id...
Reply
#2

Bump
Reply
#3

1) Wait 24 hours before bumping, not 1.

2) Which version of YSI are you using?

3) You can't, because multiple people can have the same ID and the person logging in may not even be a player (the "R" in "RCON" is "remote").
Reply
#4

Quote:
Originally Posted by ColeMiner
Посмотреть сообщение
1) Wait 24 hours before bumping, not 1.

2) Which version of YSI are you using?

3) You can't, because multiple people can have the same ID and the person logging in may not even be a player (the "R" in "RCON" is "remote").
So, for the RCON thing, how would I go about setting RCON commands... I tried this,

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
    if(success))
    {
        foreach(Player, i)
        {
            SetPlayerAdminandVIPGroup(i);
        }
    }
    return 1;
}
(If you look at the last part of the SetPlayerAdminandVIPGroup function you will see why I thought it would work.)





And also, its the latest actual version (Not 4, 3.1)... And I figured that problem out, you cant set the groups commands in OnGameModeInit for some reason, so I set a timer to call SetGroupCommands and it solved the problem...
Reply
#5

That sounds like a bug on my part. Anyway, does setting them in "public OnScriptInit" work? That is a custom callback added by YSI (it is called at the start of a script regardless of the type of the script).
Reply
#6

(I've worked with OnScriptInit before, I know what it is)

I'll have a go at it when I get back to my computer...

And also, you can only use OnRconCommand in filterscripts, I wonder if you can only detect the correct IP in filterscripts, using sscanf to match ips with foreach(player, i) doesnt find any players with a matching IP, but its the same way LuxAdmin, JAdmin and other admin scripts use 2 rcon passwords...

EDIT: I just wanna mention, out of all my script using YSI, this new one is the best! I finally got Y-Commands pretty much right now, and also finally got Y-Classes and Y-Groups implemented the way they should be, advanced class selection, I even made a way to create a store using Y-Classes(Sets the player in his own world, resets all of his groups except admin, puts player in store group and then I have objects created and the cameras on OnPlayerClassSelection face the objects not the CJ skin... There is so many possibilities with YSI! Its unlimited!)
Reply
#7

Thanks for that, its good to hear when people enjoy my work.

IIRC OnRconCommand does work in the gamemode, but only if a filterscript has it and returns (bug in the server).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)