SA-MP Forums Archive
Making a command useable for two different groups (VIPs and Admins) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Making a command useable for two different groups (VIPs and Admins) (/showthread.php?tid=349710)



Making a command useable for two different groups (VIPs and Admins) - OleKristian95 - 09.06.2012

Hello I want to have a command that can be used for two different groups,
as you can see this command works for admins:
pawn Код:
CMD:vr(playerid,params[]) {
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 1) {
        if (IsPlayerInAnyVehicle(playerid)) {
            RepairVehicle(GetPlayerVehicleID(playerid));
            SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
            RecentVR[playerid] =1;
            return GameTextForPlayer(playerid,"~green~Vehicle Repaired", 2000, 3);
        } else return SendClientMessage(playerid,red,"Error: You are not in a vehicle");
    } else return SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command");}
But I want VIPs to able to use the same command:
pawn Код:
if(PlayerInfo[playerid][VIPMember] >= 1) {
but I dont know if this works or how I can do it so I need some help please.. :/


Re : Making a command useable for two different groups (VIPs and Admins) - ricardo178 - 09.06.2012

pawn Код:
if(PlayerInfo[playerid][Level] >= 1 || PlayerInfo[playerid][VIPMember] >= 1) {



Re: Making a command useable for two different groups (VIPs and Admins) - Revo - 09.06.2012

pawn Код:
if (PlayerInfo[playerid][playerVIP] == 1 || PlayerInfo[playerid][playerAdmin] == 1)
{
//run code.
}
Is this what you want? (the || indicates OR)


AW: Making a command useable for two different groups (VIPs and Admins) - JhnzRep - 09.06.2012

pawn Код:
CMD:vr(playerid,params[]) {
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 1 ||PlayerInfo[playerid][VIPMember] >=  ) {
        if (IsPlayerInAnyVehicle(playerid)) {
            RepairVehicle(GetPlayerVehicleID(playerid));
            SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
            RecentVR[playerid] =1;
            return GameTextForPlayer(playerid,"~green~Vehicle Repaired", 2000, 3);
        } else return SendClientMessage(playerid,red,"Error: You are not in a vehicle");
    } else return SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command");}



Re: Making a command useable for two different groups (VIPs and Admins) - OleKristian95 - 09.06.2012

Are you guys sure that this will let VIPs that arent ADMIN can use the command?
Like are you sure if a player only needs to be in one of the groups to be able to use the command and not the both at same time.


Re: Making a command useable for two different groups (VIPs and Admins) - JhnzRep - 09.06.2012

I am sure, "||" means or.


Re : Re: Making a command useable for two different groups (VIPs and Admins) - ricardo178 - 09.06.2012

Quote:
Originally Posted by OleKristian95
Посмотреть сообщение
Are you guys sure that this will let VIPs that arent ADMIN can use the command?
Like are you sure if a player only needs to be in one of the groups to be able to use the command and not the both at same time.
I am 100% sure...


Re: Making a command useable for two different groups (VIPs and Admins) - OleKristian95 - 09.06.2012

Ok, thanks alot for the help guy