Duty script - require some help
#1

Hey there.
I need a simple and straight forward duty script and I made one.
Basically once you type a command like /duty, the player gets the correct skin and weapons.
However of course this can be spammed to get more ammo.
How do I make it so that when the player types /duty again, his weapons are lost / maybe his skin aswell?
Reply
#2

why dont you force player to class selection when he get's offduty [Only if it's TDM,DM].
Reply
#3

It's not really DM.
I want the player to be entirely disarmed when he uses the command another time.
Reply
#4

Here you go
Use this function to disarm completely
ResetPlayerWeapons(playerid);
Reply
#5

ResetPlayerWeapons(playerid); // loses all weapons
SetPlayerSkin(playerid, skinid); // skinid = put whatever skinID you like
Reply
#6

And how do I make the script check if the player already used the command once?
Reply
#7

Example using zcmd
pawn Код:
static bool:Duty[MAX_PLAYERS char];

CMD:Duty(pid, params[]) {
    if(Duty{pid}) return SendClientMessage(pid, -1, "You are on duty already man!");
    //Rest of stuff
}

CMD:Unduty(pid, params[]) {
    Duty{pid} = false;
    //Strip his weapons and skin
}
Reply
#8

Any way to do exactly the above without zcmd? Purely because I am trying to create a simple small script.

EDIT: Or send a client message only and restrict the player from using /duty if he is already on duty.
Reply
#9

pawn Код:
public OnPlayerCommandText(playerid, cmdtext) {
    if(!strcmp("/duty", cmdtext)) {
        if(Duty{pid}) return SendClientMessage(pid, -1, "You are on duty already man!");
            //Rest of stuff
    }
    if(!strcmp("/unduty", cmdtext)) {
        Duty{pid} = false;
            //Strip his weapons and skin
    }
}
This is not very efficient, but good enough
Reply
#10

pawn Код:
new bool:IsOnDuty[MAX_PLAYERS];
pawn Код:
OnPlayerConnect(playerid)
{
IsOnDuty[playerid] = false;
return 1;
}
pawn Код:
CMD:duty(playerid)
{
    if(IsOnDuty[playerid] == false)
    {
        IsOnDuty[playerid] = true;
        SendClientMessage(playerid, -1, "You're now on duty.");
        // set the players skin, give him weps, etc..
    }
    else if(IsOnDuty[playerid] == true)
    {
        IsOnDuty[playerid] = false;
        ResetPlayerWeapons(playerid);
        SendClientMessage(playerid, -1, "You're now off duty.");
    }
    return 1;
}
Everything in one command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)