[ZCMD] How to make Admin duty command. -
Audi_Quattrix - 14.06.2012
Open your Gamemode
On top of Gamemode add:
pawn Code:
#define COLOR_DRED 0xFF0000AA //defines red color
new aDuty[MAX_PLAYERS];
Under OnPlayerConnect add:
pawn Code:
aDuty[playerid] = 0; //Set player off duty when connects
Under OnPlayerDisconnect add:
pawn Code:
aDuty[playerid] = 0; //set player off duty when disconnects
Add this where you place your commands in gamemode:
pawn Code:
CMD:aduty(playerid) //Doesnt need params function
{
if(PlayerInfo[playerid][pAdmin] >=1 || IsPlayerAdmin(playerid)) //If you use rcon admin delete (PlayerInfo[playerid][pAdmin] >=1 ||
{
if (aDuty[playerid] == 0) //Check if player is on duty
{
new string[128];
new Float:x,Float:y,Float:z;
new Text3D:label = Create3DTextLabel("Admin On Duty!", COLOR_DRED,x,y,z, 40.0, 0, 0); //Creates 3d text label at player position
GetPlayerPos(playerid,x,y,z); //Looks for players position
SetPlayerHealth(playerid,999999); //makes player godmode
SetPlayerColor(playerid,COLOR_DRED); //set admin colour red
SetPlayerSkin(playerid,294); //set admin skin to 294
format(string,sizeof(string), "%s is now on Duty!",GetPlayerNameEx(playerid)); //here you format string to send to players
SendClientMessageToAll(COLOR_DRED,string); //send string to players
SendClientMessage(playerid,COLOR_DRED,"You are now on duty!"); //Tell admin he is now on duty
Attach3DTextLabelToPlayer(label,playerid,0.0, 0.0, 0.7); //attach 3d text label made before to player
aDuty[playerid] = 1; //Set player on duty
}
else if (aDuty[playerid] == 1) //Check if player is on duty
{
new string[128];
new Float:x,Float:y,Float:z;
new Text3D:label = Create3DTextLabel("Admin On Duty!", COLOR_DRED,x,y,z, 40.0, 0, 0);
Delete3DTextLabel(label); //Delete 3d text label saying "Admin On Duty!"
SetPlayerHealth(playerid,100); //sets player health back to 100
format(string,sizeof(string)," %s is now off Duty!",GetPlayerNameEx(playerid)); //Format string to send to players
SendClientMessageToAll(COLOR_DRED,string); //send players string
SendClientMessage(playerid, COLOR_DRED,"You are now off duty!"); //send admin message he is off duty
aDuty[playerid] = 0; //sets admin off duty
}
}
else
SendClientMessage(playerid,COLOR_DRED,"You are not high level enough!"); //Error message to send to players who arent admins
return 1;
}
EDIT:
Probably you will need this too
Add it somewhere
pawn Code:
stock GetPlayerNameEx(playerid) //This is stock i made to make Getting players name easier
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
return Name;
}
Re: [ZCMD] How to make Admin duty command. -
Revo - 14.06.2012
This isn't much of a tutorial, had I been a complete new scriptor I wouldn't have a single clue what 99% of your code does as nothing gets explained.
"Add this, this and this and you're done!"
Re: [ZCMD] How to make Admin duty command. -
Djole1337 - 14.06.2012
Ugh...You just pasted code... Almost nothing explained.
Everyone knows that SetPlayerHealth(playerid,999999); makes you invincible...
Re: [ZCMD] How to make Admin duty command. -
Jonny5 - 14.06.2012
well you dont explain much its put this here and this here.....
a tutorial is meant to
tutor someone,
think back to school, does a tutor do your work for you or
teach you what you need to know to complete your work on your own?
and as this is a newbie subject you should really try to avoid using custom functions such as
GetPlayerNameEx
without providing them also.
i think a few small edits and you could turn this into a useful tutorial for someone looking to LEARN this.
Re: [ZCMD] How to make Admin duty command. -
Revo - 14.06.2012
Quote:
EDIT:
Probably you will need this too
Add it somewhere
|
Are we being serious here?
Made me lol..
Re: [ZCMD] How to make Admin duty command. -
dino_d_carter - 03.12.2012
Well done
) +rep
Re: [ZCMD] How to make Admin duty command. -
showarn - 04.12.2012
the script is kinda bugged with the
Quote:
new Text3D:label = Create3DTextLabel("Admin On Duty!", COLOR_DRED,x,y,z, 40.0, 0, 0);
Delete3DTextLabel(label); //Delete 3d text label saying "Admin On Duty!"
|
since it wont work
Re: [ZCMD] How to make Admin duty command. -
Vince - 04.12.2012
Quote:
Originally Posted by showarn
the script is kinda bugged with the
since it wont work
|
I was about to say that. Scope of the variable 'label' is all wrong.
Re: [ZCMD] How to make Admin duty command. -
Djean - 25.12.2012
Not much of a tutorial but it is good to use.
Re: [ZCMD] How to make Admin duty command. -
Godmask - 10.11.2013
Nice. Might use
Re: [ZCMD] How to make Admin duty command. -
newbie scripter - 10.11.2013
i think it didn't explain about PlayerInfo[playerid][pAdmin]
NOTE: this is 2012 topic
Re: [ZCMD] How to make Admin duty command. -
Audi_Quattrix - 18.11.2013
Quote:
Originally Posted by newbie scripter
i think it didn't explain about PlayerInfo[playerid][pAdmin]
|
Sorry
Re: [ZCMD] How to make Admin duty command. -
d0nTtoucH - 03.09.2014
guys . how to solve the 3d text label..it wont remove.. when i go off duty ..
Re: [ZCMD] How to make Admin duty command. -
HumbleGuy - 25.07.2016
how to add weapon minigun on duty
Re: [ZCMD] How to make Admin duty command. -
FrAnKiN1 - 25.07.2016
GivePlayerWeapon(playerid, 38, 9999);
Re: [ZCMD] How to make Admin duty command. -
HumbleGuy - 25.07.2016
done sir thanks