Having trouble with functions, stocks.
#1

So, here is the problem- I've tried making an "IsPlayerSuperAdmin" stock, but I have no idea how to do it.
I've made the following commands, but when one player is doing /login with the right password, it gives the whole server "IsPlayerSuperAdmin" permissions.
Here is the code:
Код:
new superadmin;
stock IsPlayerSuperAdmin(playerid)
{




 if(superadmin==1){
      return 1;
    }
  return 0;
}
Other commands I've made:
Код:
CMD:login(playerid, params[]){
    new password;
    if(sscanf(params, "i",password))return SendClientMessage(playerid, 0x33AA33AA, "USAGE: /login [PASSWORD]");
    if(password != blablabla) return SendClientMessage(playerid, 0x33AA33AA, "Wrong Password.");
    superadmin=1;
    SendClientMessage(playerid, 0x33AA33AA, "You have logged in.");
    return 1;
    }
Код:
CMD:kill(playerid, params[]){
    new TargetID;
    if(!IsPlayerSuperAdmin(playerid)) return SendClientMessage(playerid,-1,"You're not connected as a super Admin.");
    if(sscanf(params, "u", TargetID))return SendClientMessage(playerid, 0x33AA33AA, "USAGE: /kill [Target ID]");
    if(!IsPlayerConnected(TargetID)) return SendClientMessage(playerid, 0x33AA33AA, "This player isn't connected.");
    SetPlayerHealth(TargetID, 0.0);
    SendClientMessage(playerid, 0x33AA33AA, "You have killed the player.");
    return 1;
    }
Reply


Messages In This Thread
Having trouble with functions, stocks. - by XpoZzA - 27.09.2018, 10:01
Re: Trouble with functions, stocks. - by jasperschellekens - 27.09.2018, 10:07
Re: Having trouble with functions, stocks. - by XpoZzA - 27.09.2018, 10:13
Re: Having trouble with functions, stocks. - by jasperschellekens - 27.09.2018, 10:14
Re: Having trouble with functions, stocks. - by Dayrion - 27.09.2018, 10:58
Re: Having trouble with functions, stocks. - by XpoZzA - 27.09.2018, 11:26
Re: Having trouble with functions, stocks. - by TheToretto - 27.09.2018, 12:17

Forum Jump:


Users browsing this thread: 2 Guest(s)