04.03.2014, 06:27
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,
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...
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:
But when I try to do any of ADMIN the commands while in game, they don't work.. But all regular commands work...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);
}
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...