Admin duty simple command help
#1

If player is admin, he types /aduty he will get the skin and minigun and health, armour but also he will get Error Unknown command!....
And when he types again /aduty he is not off duty, nothing happens except he also gets minigun, armour, health and skin 217.
I think there is something missing and that's what if player is not an admin.
On top of the script i have:
PHP код:
new OnDuty[MAX_PLAYERS]; 
PHP код:
dcmd_aduty(playerid,params[])
    
{
    new 
skin GetPlayerSkin(playerid);
    
// if the player isnt a rcon admin then this message will be sent to him.
    
if(!IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] > 0)
    
SendClientMessage(playeridCOLOR_ERROR"Unknown Command! Type /cmds For Available Commands.");
    if(
OnDuty[playerid] == 0)
    {
        
SetPlayerSkin(playerid,217);
        
SetPlayerHealth(playerid,9999);
        
SetPlayerArmour(playerid,9999);
        
GivePlayerWeapon(playerid,38,9999);
        
OnDuty[playerid] = 1;
    }
    else
    {
        
SetPlayerSkin(playerid,skin);
        
SetPlayerHealth(playerid,100);
        
OnDuty[playerid] = 0;
    }
    return 
1;

Reply
#2

PHP код:
dcmd_aduty(playerid,params[]) 
     

    new 
skin GetPlayerSkin(playerid); 
    
// if the player isnt a rcon admin then this message will be sent to him. 
    
if(!IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] > 0
    
SendClientMessage(playeridCOLOR_ERROR"Unknown Command! Type /cmds For Available Commands."); 
    if(
OnDuty[playerid] == 0
    { 
        
SetPlayerSkin(playerid,217); 
        
SetPlayerHealth(playerid,9999); 
        
SetPlayerArmour(playerid,9999); 
        
GivePlayerWeapon(playerid,38,9999); 
        
OnDuty[playerid] = 1
    } 
    if(
OnDuty[playerid] == 1
    { 
        
SetPlayerSkin(playerid,skin); 
        
SetPlayerHealth(playerid,100); 
        
OnDuty[playerid] = 0
    } 
    return 
1

i have made few cmds like this turn on and off they works fine by this method

Also remove this
PHP код:
if(!IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] > 0
    
SendClientMessage(playeridCOLOR_ERROR"Unknown Command! Type /cmds For Available Commands."); 
and use this
PHP код:
if(!IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playeridCOLOR_ERROR"You are not authorized to use this cmd."); 
Reply
#3

Код:
    if(!IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] > 0) 
    return SendClientMessage(playerid, COLOR_ERROR, "Unknown Command! Type /cmds For Available Commands.");
here! if the player is not admin or logged into rcon, the command will return Unknown command.
Reply
#4

Quote:
Originally Posted by UFF
Посмотреть сообщение
Код:
    if(!IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] > 0) 
    return SendClientMessage(playerid, COLOR_ERROR, "Unknown Command! Type /cmds For Available Commands.");
here! if the player is not admin or logged into rcon, the command will return Unknown command.
Returns Error message to a admin "Unknowm Command..." without giving minigun, health, armour and skin.
Reply
#5

check my it will help u man
Reply
#6

Quote:
Originally Posted by CaptainBoi
Посмотреть сообщение
PHP код:
if(!IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] > 0
    
SendClientMessage(playeridCOLOR_ERROR"Unknown Command! Type /cmds For Available Commands."); 
and use this
PHP код:
if(!IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playeridCOLOR_ERROR"You are not authorized to use this cmd."); 
Try CaptainBoi's code
Reply
#7

Quote:
Originally Posted by CaptainBoi
Посмотреть сообщение
check my it will help u man
I did, does the same thing. Iam logged in as admin and i type /aduty...Guess what? Error shows and i don't get minigun and skin. I tried to login rcon and use again /aduty. This time i get the minigun and health, armour but not the skin
Reply
#8

Код:
if(!IsPlayerAdmin(playerid))
if(PlayerInfo[playerid][pAdminLevel] < 1)
  return SendClientMessage(playerid, COLOR_ERROR, "You are not authorized to use this cmd.");
Try this
Reply
#9

PHP код:
//onplayerconnect
OnDuty[playerid] = 0;
dcmd_aduty(playerid,params[])  
      
{  
    new 
skin GetPlayerSkin(playerid);  
    
// if the player isnt a rcon admin then this message will be sent to him.  
    
if(!IsPlayerAdmin(playerid) && PlayerInfo[playerid][pAdminLevel] < 1)  return SendClientMessage(playeridCOLOR_ERROR"Unknown Command! Type /cmds For Available Commands.");  

    if(
OnDuty[playerid] == 0)  
    {  
        
SetPlayerSkin(playerid,217);  
        
SetPlayerHealth(playerid,9999);  
        
SetPlayerArmour(playerid,9999);  
        
GivePlayerWeapon(playerid,38,9999);  
        
OnDuty[playerid] = 1;  
    }  
    if(
OnDuty[playerid] == 1)  
    {  
        
SetPlayerSkin(playerid,skin);  
        
SetPlayerHealth(playerid,100);  
        
ResetPlayerWeapons(playerid);
        
OnDuty[playerid] = 0;  
    }  
    return 
1;  

Check
Reply
#10

Quote:
Originally Posted by CaptainBoi
Посмотреть сообщение
PHP код:
//onplayerconnect
OnDuty[playerid] = 0;
dcmd_aduty(playerid,params[])  
      
{  
    new 
skin GetPlayerSkin(playerid);  
    
// if the player isnt a rcon admin then this message will be sent to him.  
    
if(!IsPlayerAdmin(playerid) && PlayerInfo[playerid][pAdminLevel] < 1)  return SendClientMessage(playeridCOLOR_ERROR"Unknown Command! Type /cmds For Available Commands.");  
    if(
OnDuty[playerid] == 0)  
    {  
        
SetPlayerSkin(playerid,217);  
        
SetPlayerHealth(playerid,9999);  
        
SetPlayerArmour(playerid,9999);  
        
GivePlayerWeapon(playerid,38,9999);  
        
OnDuty[playerid] = 1;  
    }  
    if(
OnDuty[playerid] == 1)  
    {  
        
SetPlayerSkin(playerid,skin);  
        
SetPlayerHealth(playerid,100);  
        
ResetPlayerWeapons(playerid);
        
OnDuty[playerid] = 0;  
    }  
    return 
1;  

Check
Player just freezes for a 1 sec and nothing happens, i don't even get a message error
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)