/aduty
#1

Hello (again)

Can someone help me with an /aduty command ? I killed my brain trying to make it ...
Reply
#2

pawn Код:
dcmd_onduty(playerid,params[])
{
    #pragma unused params
    if (AccInfo[playerid][Level] >= 1)
    {
        if(AccInfo[playerid][OnDuty] == 0)
        {
            AccInfo[playerid][OnDuty] = 1;
            return SendClientMessage(playerid,green,"You are now in [Duty Mode] ");
        }
        else
        {
            AccInfo[playerid][OnDuty] = 0;
            return SendClientMessage(playerid,orange,"You are now in [Playing Mode] ");
        }
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by kbalor
Посмотреть сообщение
pawn Код:
dcmd_onduty(playerid,params[])
{
    #pragma unused params
    if (AccInfo[playerid][Level] >= 1)
    {
        if(AccInfo[playerid][OnDuty] == 0)
        {
            AccInfo[playerid][OnDuty] = 1;
            return SendClientMessage(playerid,green,"You are now in [Duty Mode] ");
        }
        else
        {
            AccInfo[playerid][OnDuty] = 0;
            return SendClientMessage(playerid,orange,"You are now in [Playing Mode] ");
        }
    }
    return 1;
}
Why would you just copy and paste ? I'm pretty sure he doesnt have the AccInfo variable ...

This is a very simple one I just put together, I have a much more advanced one. Try this:

pawn Код:
// top of script

new OnDuty[MAX_PLAYERS];

// command USING ZCMD

CMD:duty(playerid,params[])
{
    // if the player isnt logged into rcon , it will send the below message (change it to your desire)
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"Invalid Command.  Type /commands For A List Of Commands.");
   
    if(OnDuty[playerid] == 0)
    {
        GameTextForPlayer(playerid,"~g~ on duty");
       
        SetPlayerSkin(playerid,skinid); // set your desired skin here
       
        SetPlayerHealth(playerid,100000);
       
        GivePlayerWeapon(playerid,38,133337);
       
        OnDuty[playerid] = 1;
    }
    else
    {
        GameTextForPlayer(playerid,"~r~ off duty");
        SetPlayerSkin(playerid,skinid); // set your desired skin here
       
        SetPlayerHealth(playerid,100);
       
        ResetPlayerWeapons(playerid);
       
        OnDuty[playerid] = 0;
    }
    return 1;
}
This is just an example, edit it to how you desire.
Reply
#4

Thanks but i don't want in RCON , just from admin level 1 to 1338 and without using zcmd ...
Reply
#5

Quote:
Originally Posted by Sp3cter
Посмотреть сообщение
Thanks but i don't want in RCON , just from admin level 1 to 1338 and without using zcmd ...
You can use what gto saids.
Reply
#6

Quote:
Originally Posted by Sp3cter
Посмотреть сообщение
Thanks but i don't want in RCON , just from admin level 1 to 1338 and without using zcmd ...
What is your script admin variables? Do you have something like PlayerInfo[playerid][Level] / pInfo[playerid][Level] , etc ... ?

Here is the command in strcmp, placed it under OnPlayerCommandText:

pawn Код:
if (strcmp("/duty", cmdtext, true, 5) == 0)
{
    // if the player isnt logged into rcon , it will send the below message (change it to your desire)
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"Invalid Command.  Type /commands For A List Of Commands.");

    if(OnDuty[playerid] == 0)
    {
        GameTextForPlayer(playerid,"~g~ on duty");

        SetPlayerSkin(playerid,skinid); // set your desired skin here

        SetPlayerHealth(playerid,100000);

        GivePlayerWeapon(playerid,38,133337);

        OnDuty[playerid] = 1;
    }
    else
    {
        GameTextForPlayer(playerid,"~r~ off duty");
        SetPlayerSkin(playerid,skinid); // set your desired skin here

        SetPlayerHealth(playerid,100);

        ResetPlayerWeapons(playerid);

        OnDuty[playerid] = 0;
    }
    return 1;
}
Reply
#7

Quote:

PlayerInfo[playerid][pAdmin] >= 1

And OnDuty[playerid] = 1; cand be [pduty] or same ?
Reply
#8

If that is your admin variable, everything should be like this:

pawn Код:
if (strcmp("/duty", cmdtext, true, 5) == 0)
{
    if(PlayerInfo[playerid][pAdmin] <= 0) return SendClientMessage(playerid,-1,"Invalid Command.  Type /commands For A List Of Commands.");

    if(OnDuty[playerid] == 0)
    {
        GameTextForPlayer(playerid,"~g~ on duty");

        SetPlayerSkin(playerid,skinid); // set your desired skin here

        SetPlayerHealth(playerid,100000);

        GivePlayerWeapon(playerid,38,133337);

        OnDuty[playerid] = 1;
    }
    else
    {
        GameTextForPlayer(playerid,"~r~ off duty");
        SetPlayerSkin(playerid,skinid); // set your desired skin here

        SetPlayerHealth(playerid,100);

        ResetPlayerWeapons(playerid);

        OnDuty[playerid] = 0;
    }
    return 1;
}
It should work, all I changed was the !IsPlayerAdmin part
Reply
#9

Some warnings on

GameTextForPlayer(playerid,"~g~ on duty");

(2344 : warning 202: number of arguments does not match definition
(2344 : warning 202: number of arguments does not match definition
(23460) : warning 202: number of arguments does not match definition
(23460) : warning 202: number of arguments does not match definition
Reply
#10

Oops my fault, replace both with:

GameTextForPlayer(playerid,"~g~ on duty", 5000, 3);

GameTextForPlayer(playerid,"~r~ off duty", 5000, 3);
Reply
#11

Thanks alot
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)