how to create /onduty???
#1

Please say me how can i create /onduty command for admin lvl1 and /offduty and when anyone player type /admins show onduty admins?
Reply
#2

pawn Код:
new Duty[ MAX_PLAYERS ]

CMD:onduty(playerid, params[])
{
    if( Duty[ playerid ] == 0 )
    {
        Duty[ playerid ] = 1;
        SetPlayerSkin(playerid, 294);
        GivePlayerWeapon(playerid, 38, 999);
       
        // Get the player's skin and store it.
    }
    else
    {
        Duty[ playerid ] = 0;
        RemovePlayerWeapons(playerid);
        // Set the old players skin back.
    }
    return 1;
}
Reply
#3

here, try this, made in the small reply box, may contain error. if there are, feel free to post.
pawn Код:
//in your enum
enum blah
{
 //other things
 pDuty,
}
//or somewhere else
new pDuty[MAX_PLAYERS];
CMD:onduty(playerid, params[])
{
    new str[128] , pname[MAX_PLAYER_NAME];
    if(adminlevel/*replace with your enum or variable w/e*/ < 1) return SendClientMessage(playerid, -1, "You are not an admin");
    if(pDuty[playerid] == 1) return SendClientMessage(playerid, -1, "Already OnDuty");
    pDuty[playerid] = 1;
    GetPlayerName(playerid, pname, sizeof(pname));
    format(str, sizeof(str), "%s went onduty", pname);
    SendClientMessageToAll(-1, str);
    // SetPlayerHealth or GivePlayerWeapon here, or anything you wanna add
    return 1;
}

CMD:offduty(playerid, params[])
{
    new str[128] , pname[MAX_PLAYER_NAME];
    if(adminlevel/*replace with your enum or variable w/e*/ < 1) return SendClientMessage(playerid, -1, "You are not an admin");
    if(pDuty[playerid] == 0) return SendClientMessage(playerid, -1, "Already OffDuty");
    pDuty[playerid] = 0;
    GetPlayerName(playerid, pname, sizeof(pname));
    format(str, sizeof(str), "%s went offduty", pname);
    SendClientMessageToAll(-1, str);
    return 1;
}
CMD:admins(playerid, params[])
{
    new str[128], pname[MAX_PLAYER_NAME];
    for(new i; i<MAX_PLAYERS; i++)
    {
        if(adminlevel/*replace with your variable*/ >= 1 && pDuty[playerid] == 1)
        {
            GetPlayerName(playerid, pname, sizeof(pname));
            format(str, sizeof(str), "Admin level :%d - %s(%d)", adminlevel/*your variable*/, pname, playerid);
            SendClientMessage(playerid, -1, str);
        }
    }    
    return 1;
}
Reply
#4

6 errors

Код:
C:\Documents and Settings\rado\Desktop\original dff and txd\truck server\gamemodes\PPC_Trucking.pwn(1509) : error 021: symbol already defined: "pDuty"
C:\Documents and Settings\rado\Desktop\original dff and txd\truck server\gamemodes\PPC_Trucking.pwn(1513) : error 017: undefined symbol "adminlevel"
C:\Documents and Settings\rado\Desktop\original dff and txd\truck server\gamemodes\PPC_Trucking.pwn(1514) : error 028: invalid subscript (not an array or too many subscripts): "pDuty"
C:\Documents and Settings\rado\Desktop\original dff and txd\truck server\gamemodes\PPC_Trucking.pwn(1514) : warning 215: expression has no effect
C:\Documents and Settings\rado\Desktop\original dff and txd\truck server\gamemodes\PPC_Trucking.pwn(1514) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\rado\Desktop\original dff and txd\truck server\gamemodes\PPC_Trucking.pwn(1514) : error 029: invalid expression, assumed zero
C:\Documents and Settings\rado\Desktop\original dff and txd\truck server\gamemodes\PPC_Trucking.pwn(1514) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Reply
#5

did you just...copy paste -.-
read the comments that i wrote. and understand the code
Reply
#6

can you give me strcmp ?
Reply
#7

ok wherE?
Reply
#8

bumppp...................
give me strcmp commands plzzz
Reply
#9

Foreever u didnt now tell me in ******** that u making server
https://www.********.com/Shubhambboy
Reply
#10

Quote:

CMD:aduty(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, -1, "This is an admin only command!");
if(PlayerInfo[playerid][pAdminDuty] == 0)
{

SendClientMessage(playerid, COLOR_GREEN, "You are now on administrative duty! Remember to check /reports!");
PlayerInfo[playerid][pAdminDuty] = 1;
SetPlayerHealth(playerid, 100000);
SetPlayerArmour(playerid, 100000);
new string[128];
format(string, sizeof(string), "Administrator %s is now on Admin Duty! (/report for assistance)", GetPlayerNameEx(playerid));
SendClientMessageToAllEx(COLOR_YELLOW, string);
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are now off admin duty!");
new string[128];
format(string, sizeof(string), "Administrator %s is now off Admin Duty! (Do not /report for him/her!)", GetPlayerNameEx(playerid));
SendClientMessageToAllEx(COLOR_LIGHTRED, string);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 50);
PlayerInfo[playerid][pAdminDuty] = 0;
}
return 1;
}

Here I use this for my community has well, Im not sure If it will help but It works good for Me!

REP+
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)