How to make different levels -
Jithu - 23.02.2018
i want to make different levels for admin.... how can i make it.It is booooooooooooooorrrrrring to do if(IsPlayerAdmin(playerid))
So please someone can help me in it?
I want to make admin system..!!
Re: How to make different levels -
dexi - 23.02.2018
Store the adminlevel in an array, then you can refer to it easily.
Re: How to make different levels -
Jithu - 23.02.2018
Please can you tell me how??
i just need 1 example, because i wanna use in my script
Re: How to make different levels -
PepsiCola23 - 23.02.2018
its like you store level ( PlayerData[playerid][level] , you make a new variable for admin ( [playerid][admin], and at the admins commands check if his [admin] level is big enough.
Re: How to make different levels -
dexi - 23.02.2018
new PlayerAdmin[MAX_PLAYERS];
On connect store and load this variable.
Make a 'makeadmin' command then just check the level for using it, ex.:
CMD:makeadmin(blabla) {
blabla
if(PlayerAdmin[playerid] != 3) return SCM(blabla, "You need to be level 3 admin.");
PlayerAdmin[another] = level;
return 1;
}
Re: How to make different levels -
Jithu - 23.02.2018
Quote:
Originally Posted by PepsiCola23
its like you store level ( PlayerData[playerid][level] , you make a new variable for admin ( [playerid][admin], and at the admins commands check if his [admin] level is big enough.
|
Is this an example??
i just want an example because i understand everything from an exaple
Re: How to make different levels -
Jithu - 23.02.2018
Please someone give me an good example , these example doesn't works for me, i didnt did copy/paste
Re: How to make different levels -
dexi - 23.02.2018
You can find ""examples"" in the filterscripts thread.
Re: How to make different levels -
PepsiCola23 - 23.02.2018
a simple search would have leaded you to 100+ examples.
https://sampforum.blast.hk/showthread.php?tid=303794
Re: How to make different levels -
wallen - 23.02.2018
Quote:
Originally Posted by PepsiCola23
its like you store level ( PlayerData[playerid][level] , you make a new variable for admin ( [playerid][admin], and at the admins commands check if his [admin] level is big enough.
|
Exactly what this guy said above, you need to store the player enumerator.
PHP код:
enum AdminLevel
{
Level
}
new PlayerInfo[MAX_PLAYERS][AdminLevel];
So once we did a enum for the player, it's now going to be like PlayerInfo[playerid][Level], now let's come to the commands (i will use ZCMD because it's faster, simple and pretty much viable compared to strcmp).
PHP код:
CMD:sethp(playerid, params[])
{
if(PlayerInfo[playerid][Level] < 1) return SendClientMessage(playerid, -1, "{C3C3C3}(INFO) You don't have the priviliges to use this command.");
{
new amount, str[128], target;
if(sscanf(params, "ui", target, amount)) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) /sethp [id] [amount]");
format(str, sizeof(str), "{EFB509}(INFO) An admin has set your health to %d", amount);
SendClientMessage(target, -1, str);
SetPlayerHealth(target, amount);
return 1;
}
That's a simple Admin Command, with this
PHP код:
if(PlayerInfo[playerid][Level] < 1)
you check if the player has enough admin level to run the command.
PS: you should just starting learning about player enumerations, you are like stuck on a simple code