Duty script - require some help -
needhack - 24.02.2013
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?
Re: Duty script - require some help -
jiwan - 24.02.2013
why dont you force player to class selection when he get's offduty [Only if it's TDM,DM].
Re: Duty script - require some help -
needhack - 24.02.2013
It's not really DM.
I want the player to be entirely disarmed when he uses the command another time.
Re: Duty script - require some help -
jiwan - 24.02.2013
Here you go
Use this function to disarm completely
ResetPlayerWeapons(playerid);
Re: Duty script - require some help -
savi0ur - 24.02.2013
ResetPlayerWeapons(playerid); // loses all weapons
SetPlayerSkin(playerid, skinid); // skinid = put whatever skinID you like
Re: Duty script - require some help -
needhack - 24.02.2013
And how do I make the script check if the player already used the command once?
Re: Duty script - require some help -
Misiur - 24.02.2013
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
}
Re: Duty script - require some help -
needhack - 24.02.2013
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.
Re: Duty script - require some help -
Misiur - 24.02.2013
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
Re: Duty script - require some help -
Da_Noob - 24.02.2013
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.