/aduty Admin text
#1

Hello, I need when admins do on /aduty get text like this
http://gyazo.com/a063ef460bcfea75d604dadb81ff5e31
My /aduty codes
Код:
CMD:aduty(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
	{
	    new string[256];
        if(GetPVarInt(playerid, "AdminDuty") == 1)
		{
            SendClientMessage(playerid, COLOR_WHITE, "You are now off a-duty.");
            format(string, sizeof(string), "{FFFFFF}Administrator {FF0000}%s {FFFFFF}is now {FF0000}off{FFFFFF} a-duty.", GetPlayerNameEx(playerid));
 	        SendClientMessageToAllEx(COLOR_WHITE, string);
 	        SetPlayerHealth(playerid, 100);
			SetPlayerArmour(playerid, 100);
			RemovePlayerWeapon(playerid, 38);
            DeletePVar(playerid, "AdminDuty");
        }
        else
		{
            SendClientMessageEx(playerid, COLOR_WHITE, "You are now on a-duty.");
            format(string, sizeof(string), "{FFFFFF}Administrator {00FF00}%s {FFFFFF}is now {00FF00}on{FFFFFF} a-duty.", GetPlayerNameEx(playerid));
	        SendClientMessageToAllEx(COLOR_WHITE, string);
        	SetPlayerHealth(playerid, 100000);
			SetPlayerArmour(playerid, 100000);
			GivePlayerValidWeapon(playerid, 38, 66666);
            SetPVarInt(playerid, "AdminDuty", 1);
        }
    }
    else
	{
        SendClientMessageEx(playerid, COLOR_GRAD1, "   You are not a Administrator!");
    }
    return 1;
}
Reply
#2

PHP код:
new Text3D:label Create3DTextLabel("Admin on duty"0x008080FF30.040.050.040.00);
    
Attach3DTextLabelToPlayer(labelplayerid0.00.00.7); 
Reply
#3

When i do off duty it's wont remove.
Код:
CMD:aduty(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
	{
	    new string[256];
        if(GetPVarInt(playerid, "AdminDuty") == 1)
		{
            SendClientMessage(playerid, COLOR_WHITE, "You are now off a-duty.");
            format(string, sizeof(string), "{FFFFFF}Administrator {FF0000}%s {FFFFFF}is now {FF0000}off{FFFFFF} a-duty.", GetPlayerNameEx(playerid));
 	        SendClientMessageToAllEx(COLOR_WHITE, string);
 	        SetPlayerHealth(playerid, 100);
			SetPlayerArmour(playerid, 100);
			RemovePlayerWeapon(playerid, 38);
            DeletePVar(playerid, "AdminDuty");
        }
        else
		{
            SendClientMessageEx(playerid, COLOR_WHITE, "You are now on a-duty.");
            new Text3D:label = Create3DTextLabel("Admin on duty", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
            Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
            format(string, sizeof(string), "{FFFFFF}Administrator {00FF00}%s {FFFFFF}is now {00FF00}on{FFFFFF} a-duty.", GetPlayerNameEx(playerid));
	        SendClientMessageToAllEx(COLOR_WHITE, string);
        	SetPlayerHealth(playerid, 100000);
			SetPlayerArmour(playerid, 100000);
			GivePlayerValidWeapon(playerid, 38, 66666);
            SetPVarInt(playerid, "AdminDuty", 1);
        }
    }
    else
	{
        SendClientMessageEx(playerid, COLOR_GRAD1, "   You are not a Administrator!");
    }
    return 1;
}
Reply
#4

you didn't put when you are of duty do delete that label. Try this. This should work

Delete3DTextLabel(label); // so this code go to when you are off duty.
Reply
#5

pawn Код:
DeletePlayer3DTextLabel(labelid);
Hope it's help you
Reply
#6

On top:
PHP код:
new Text3D:label[MAX_PLAYERS]; 
Command:
PHP код:
CMD:aduty(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 2)
    {
        new 
string[256];
        if(
GetPVarInt(playerid"AdminDuty") == 1)
        {
            
SendClientMessage(playeridCOLOR_WHITE"You are now off a-duty.");
            
format(stringsizeof(string), "{FFFFFF}Administrator {FF0000}%s {FFFFFF}is now {FF0000}off{FFFFFF} a-duty."GetPlayerNameEx(playerid));
             
SendClientMessageToAllEx(COLOR_WHITEstring);
             
SetPlayerHealth(playerid100);
            
SetPlayerArmour(playerid100);
            
RemovePlayerWeapon(playerid38);
            
DeletePVar(playerid"AdminDuty");
            
Delete3DTextLabel(label[playerid]);
        }
        else
        {
            
SendClientMessageEx(playeridCOLOR_WHITE"You are now on a-duty.");
            
format(stringsizeof(string), "{FFFFFF}Administrator {00FF00}%s {FFFFFF}is now {00FF00}on{FFFFFF} a-duty."GetPlayerNameEx(playerid));
            
SendClientMessageToAllEx(COLOR_WHITEstring);
            
SetPlayerHealth(playerid100000);
            
SetPlayerArmour(playerid100000);
            
GivePlayerValidWeapon(playerid3866666);
            
SetPVarInt(playerid"AdminDuty"1);
            
label[playerid] = Create3DTextLabel("Admin on duty"0x008080FF30.040.050.040.00);
            
Attach3DTextLabelToPlayer(label[playerid], playerid0.00.00.7); 
        }
    }
    else
    {
        
SendClientMessageEx(playeridCOLOR_GRAD1"   You are not a Administrator!");
    }
    return 
1;

Reply
#7

Quote:
Originally Posted by ATGOggy
Посмотреть сообщение
On top:
PHP код:
new Text3D:label[MAX_PLAYERS]; 
Command:
PHP код:
CMD:aduty(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 2)
    {
        new 
string[256];
        if(
GetPVarInt(playerid"AdminDuty") == 1)
        {
            
SendClientMessage(playeridCOLOR_WHITE"You are now off a-duty.");
            
format(stringsizeof(string), "{FFFFFF}Administrator {FF0000}%s {FFFFFF}is now {FF0000}off{FFFFFF} a-duty."GetPlayerNameEx(playerid));
             
SendClientMessageToAllEx(COLOR_WHITEstring);
             
SetPlayerHealth(playerid100);
            
SetPlayerArmour(playerid100);
            
RemovePlayerWeapon(playerid38);
            
DeletePVar(playerid"AdminDuty");
            
Delete3DTextLabel(label[playerid]);
        }
        else
        {
            
SendClientMessageEx(playeridCOLOR_WHITE"You are now on a-duty.");
            
format(stringsizeof(string), "{FFFFFF}Administrator {00FF00}%s {FFFFFF}is now {00FF00}on{FFFFFF} a-duty."GetPlayerNameEx(playerid));
            
SendClientMessageToAllEx(COLOR_WHITEstring);
            
SetPlayerHealth(playerid100000);
            
SetPlayerArmour(playerid100000);
            
GivePlayerValidWeapon(playerid3866666);
            
SetPVarInt(playerid"AdminDuty"1);
            
label[playerid] = Create3DTextLabel("Admin on duty"0x008080FF30.040.050.040.00);
            
Attach3DTextLabelToPlayer(label[playerid], playerid0.00.00.7); 
        }
    }
    else
    {
        
SendClientMessageEx(playeridCOLOR_GRAD1"   You are not a Administrator!");
    }
    return 
1;

got two warn
Код:
./includes/commands.pwn(21287) : warning 219: local variable "label" shadows a variable at a preceding level
./includes/mysql.pwn(7000) : warning 219: local variable "label" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Reply
#8

Quote:
Originally Posted by ShadeWalker
Посмотреть сообщение
got two warn
Код:
./includes/commands.pwn(21287) : warning 219: local variable "label" shadows a variable at a preceding level
./includes/mysql.pwn(7000) : warning 219: local variable "label" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Just change the "label" to sonething else, like "Admintext"
Reply
#9

Quote:
Originally Posted by AdamsP
Посмотреть сообщение
Just change the "label" to sonething else, like "Admintext"
nah, didnt work.
Reply
#10

Warnings do NOT affect anything, just ignore them, eventually, they are not gonna affect your script at anyhow.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)