Command problem
#1

I made 2 admin Commands and they work...BUT when the admin goes onduty they dont change to the color ID as the are set to...any ideas why?

Code:

Код:
COMMAND:onduty(playerid,params[])
{
    if(pInfo[playerid][Adminlevel] >= 1)
	{
	    SetPlayerHealth(playerid,99999);
	    SetPlayerArmour(playerid,99999);
	    SetPlayerColor(playerid,COLOR_RED);
	    GivePlayerWeapon(playerid,38,99999);
	    SendClientMessageToAll(COLOR_RED,"A ADMIN is now on DUTY! The ADMIN is defined as a RED player.");
	}
	return 1;
}
COMMAND:offduty(playerid,params[])
{
    if(pInfo[playerid][Adminlevel] >= 1)
	{
	    SetPlayerHealth(playerid,100);
	    SetPlayerArmour(playerid,100);
	    SetPlayerColor(playerid,COLOR_WHITE);
	    SendClientMessageToAll(COLOR_RED,"The ADMIN is now OFF-DUTY.");
	}
	return 1;
}
Reply
#2

Код:
    SetPlayerColor(playerid, 0xAA3333AA);
?
Reply
#3

At the top of script:

pawn Код:
new bool:OnDuty[MAX_PLAYERS];
An single command:

pawn Код:
CMD:duty(playerid, params[])
{
    new name[MAX_PLAYER_NAME], string[144];
    GetPlayerName(playerid, name, sizeof(name));
    if(pInfo[playerid][Adminlevel] >= 1)
    {
        if(OnDuty[playerid] == false)
        {
            SetPlayerHealth(playerid,99999);
            SetPlayerArmour(playerid,99999);
            SetPlayerColor(playerid, 0xFF0000FF);
            GivePlayerWeapon(playerid,38,99999);
            SendClientMessageToAll(COLOR_RED,"Administrator %s it's now On-Duty.");
            OnDuty[playerid] = true;
        }
        else if(OnDuty[playerid] == true)
        {
            SetPlayerHealth(playerid,100);
            SetPlayerArmour(playerid,100);
            SetPlayerColor(playerid, 0xFFFFFFFF);
            SendClientMessageToAll(COLOR_RED,"Administrator %s it's now Off-Duty.");
            OnDuty[playerid] = false;
        }
    }
    else
    {
        SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}You aren't authorized to use this command.");
    }
    return 1;
}
Reply
#4

Thanks HY after 24 hours i will rep ya :P
Reply
#5

Yea scratch that ^^ um now when we do the duty command the server closes....how do I fix that?
Reply
#6

Thatґs because HY has no idea what he is doing...

pawn Код:
CMD:duty(playerid, params[])
{
    new name[MAX_PLAYER_NAME], string[64];
    GetPlayerName(playerid, name, sizeof(name));
    if(pInfo[playerid][Adminlevel] >= 1)
    {
        if(OnDuty[playerid] == false)
        {
            SetPlayerHealth(playerid,99999);
            SetPlayerArmour(playerid,99999);
            SetPlayerColor(playerid, 0xFF0000FF);
            GivePlayerWeapon(playerid,38,99999);
            format(string, sizeof(string), "Administrator %s is now On-Duty.", name);
            SendClientMessageToAll(COLOR_RED, string);
            OnDuty[playerid] = true;
        }
        else if(OnDuty[playerid] == true)
        {
            SetPlayerHealth(playerid,100);
            SetPlayerArmour(playerid,100);
            SetPlayerColor(playerid, 0xFFFFFFFF);
            format(string, sizeof(string), "Administrator %s is now Off-Duty.", name);
            SendClientMessageToAll(COLOR_RED, string);
            OnDuty[playerid] = false;
        }
    }
    else
    {
        SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}You aren't authorized to use this command.");
    }
    return 1;
}
Reply
#7

lol Thanks will try it now
Reply
#8

yours worked :P thanks
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)