SA-MP Forums Archive
/aduty - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /aduty (/showthread.php?tid=367640)



/aduty - Sp3cter - 10.08.2012

Hello (again)

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


Re: /aduty - kbalor - 10.08.2012

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;
}



Re: /aduty - grand.Theft.Otto - 10.08.2012

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.


Re: /aduty - Sp3cter - 10.08.2012

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


Re: /aduty - kbalor - 10.08.2012

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.


Re: /aduty - grand.Theft.Otto - 10.08.2012

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;
}



Re: /aduty - Sp3cter - 10.08.2012

Quote:

PlayerInfo[playerid][pAdmin] >= 1

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


Re: /aduty - grand.Theft.Otto - 10.08.2012

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


Re: /aduty - Sp3cter - 10.08.2012

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


Re: /aduty - grand.Theft.Otto - 10.08.2012

Oops my fault, replace both with:

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

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


Re: /aduty - Sp3cter - 10.08.2012

Thanks alot