Help with admin commands ?
#1

Hy there ! How can I make commands that just admins can use it ?
Reply
#2

https://sampwiki.blast.hk/wiki/IsPlayerAdmin

Thanks.
Reply
#3

yay a nice person!, Well bud, You need a admn system, or a Account system. If you have a account system ad a variable called level or adminlevel or whatever, and Do somthing like thsis.

heres a admin command of mine you can kinda get an idea from

PHP код:
CMD:unmute(playeridparams[])
{
    new 
id;
    new 
victimname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME];
    if(
GetPVarInt(playerid"Level") >= 1)
    {
    if (
sscanf(params"u"id)) return SendClientMessage(playeridCOLOR_REDSERVER_BOT "USAGE: /unmute [id]");
    if (
id == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_REDSERVER_BOT "This player is not connected");
    if(
GetPVarInt(playerid"Level") >= 2) return SendClientMessage(playeridCOLOR_REDSERVER_BOT "Cannot unmute this person!");
    
IsMuted[id] = 0;
    new 
stri[128];
    
GetPlayerName(idvictimnamesizeof(victimname));
    
GetPlayerName(playeridadminnamesizeof(adminname));
    
format(stri,128,SERVER_BOT "%s(%d) has unmuted %s(%d)",adminnameplayeridvictimnameid);
    
SendClientMessageToAll(COLOR_GREEN,stri);
    return 
1;
    }else return 
SendClientMessage(playerid,COLOR_RED,SERVER_BOT "You arent Authorised!");} 
Reply
#4

Quote:
Originally Posted by -Rebel Son-
Посмотреть сообщение
yay a nice person!, Well bud, You need a admn system, or a Account system. If you have a account system ad a variable called level or adminlevel or whatever, and Do somthing like thsis.

heres a admin command of mine you can kinda get an idea from

PHP код:
CMD:unmute(playeridparams[])
{
    new 
id;
    new 
victimname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME];
    if(
GetPVarInt(playerid"Level") >= 1)
    {
    if (
sscanf(params"u"id)) return SendClientMessage(playeridCOLOR_REDSERVER_BOT "USAGE: /unmute [id]");
    if (
id == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_REDSERVER_BOT "This player is not connected");
    if(
GetPVarInt(playerid"Level") >= 2) return SendClientMessage(playeridCOLOR_REDSERVER_BOT "Cannot unmute this person!");
    
IsMuted[id] = 0;
    new 
stri[128];
    
GetPlayerName(idvictimnamesizeof(victimname));
    
GetPlayerName(playeridadminnamesizeof(adminname));
    
format(stri,128,SERVER_BOT "%s(%d) has unmuted %s(%d)",adminnameplayeridvictimnameid);
    
SendClientMessageToAll(COLOR_GREEN,stri);
    return 
1;
    }else return 
SendClientMessage(playerid,COLOR_RED,SERVER_BOT "You arent Authorised!");} 
No. that's hard for him to understand cuz he is newbie scripter and first of all he need to learn from https://sampwiki.blast.hk/wiki/IsPlayerAdmin

Not directly start making admin fs or gm.
Reply
#5

But here is not explained how to make admin command just admin spawn . I just wanna know how to OnPlayerTextCommand make command just for admins
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)