How would i do this
#1

I am trying to make it so when a player does /adminduty that players name changes ( I have already done that ) but want i want it to do is when you /adminduty again to go off admin duty your name changes back to the original


pawn Код:
CMD:adminduty(playerid, params[])
{
    if(PlayerData[ID][AdminDuty] == 0)
    if(PlayerData[ID][AdminLevel] >= 1)
    {
        SetPlayerName(playerid, PlayerData[playerid][AdminName]);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are now on admin duty");
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /adminduty to go on admin duty");
        format(str2, sizeof(str2),"Admin %s Is now online",PlayerData[playerid][AdminName]);
        SetPlayerColor(playerid, COLOR_NAVY);
        SendClientMessageToAll(COLOR_GREEN,str2);
    }
    return 1;
}

Thank You


Please Help Me Please
Reply
#2

Quote:
Originally Posted by Scripter12345
Посмотреть сообщение
I am trying to make it so when a player does /adminduty that players name changes ( I have already done that ) but want i want it to do is when you /adminduty again to go off admin duty your name changes back to the original


pawn Код:
CMD:adminduty(playerid, params[])
{
    if(PlayerData[ID][AdminDuty] == 0)
    if(PlayerData[ID][AdminLevel] >= 1)
    {
        SetPlayerName(playerid, PlayerData[playerid][AdminName]);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are now on admin duty");
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /adminduty to go on admin duty");
        format(str2, sizeof(str2),"Admin %s Is now online",PlayerData[playerid][AdminName]);
        SetPlayerColor(playerid, COLOR_NAVY);
        SendClientMessageToAll(COLOR_GREEN,str2);
    }
    return 1;
}


Thank You


Please Help Me Please
pawn Код:
CMD:adminduty(playerid, params[])
{
    if(PlayerData[ID][AdminDuty] == 0)
    if(PlayerData[ID][AdminLevel] >= 1)
    {
        SetPlayerName(playerid, PlayerData[playerid][AdminName]);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are now on admin duty");
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /adminduty to go on admin duty");
        format(str2, sizeof(str2),"Admin %s Is now online",PlayerData[playerid][AdminName]);
        SetPlayerColor(playerid, COLOR_NAVY);
        SendClientMessageToAll(COLOR_GREEN,str2);
        else
        {
            // Do off duty stuff here!
        }
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by HazardGaming
Посмотреть сообщение
pawn Код:
CMD:adminduty(playerid, params[])
{
    if(PlayerData[ID][AdminDuty] == 0)
    if(PlayerData[ID][AdminLevel] >= 1)
    {
        SetPlayerName(playerid, PlayerData[playerid][AdminName]);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are now on admin duty");
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /adminduty to go on admin duty");
        format(str2, sizeof(str2),"Admin %s Is now online",PlayerData[playerid][AdminName]);
        SetPlayerColor(playerid, COLOR_NAVY);
        SendClientMessageToAll(COLOR_GREEN,str2);
        else
        {
            // Do off duty stuff here!
        }
    }
    return 1;
}
I mean how would i be able to get it so when that player goes off duty the players name changes back to the original one


Thank You


Please Help Me Please
Reply
#4

Urmm
pawn Код:
stock GetName(playerid)
{
    new
        Name[24];
    GetPlayerName(playerid, Name, 24);
    return Name;
}
(dunno if this would work..)
GetPlayerName(playerid); < Try it all.. add the stock at the end of your gamemode.
Reply
#5

pawn Код:
CMD:adminduty(playerid, params[])
{
    if(PlayerData[ID][AdminLevel] >= 1)
    {
        if(PlayerData[ID][AdminDuty] == 0)
        {
            GetPlayerName(playerid, PlayerData[playerid][OrginalName], 24);
            SetPlayerName(playerid, PlayerData[playerid][AdminName]);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are now on admin duty");
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /adminduty to go on admin duty");
            format(str2, sizeof(str2),"Admin %s Is now online",PlayerData[playerid][AdminName]);
            SetPlayerColor(playerid, COLOR_NAVY);
            SendClientMessageToAll(COLOR_GREEN,str2);
        }
        else
        {
            SetPlayerName(playerid, PlayerData[playerid][OrginalName]);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are now off admin duty");
            format(str2, sizeof(str2),"Admin %s Is now offline",PlayerData[playerid][AdminName]);
            SetPlayerColor(playerid, COLOR_NAVY);
            SendClientMessageToAll(COLOR_GREEN,str2);
        }
    }
    return 1;
}
Put OrginalName[MAX_PLAYER_NAME] into your enum.

EDIT I will put it into the cmd.
Reply
#6

Quote:
Originally Posted by Roel
Посмотреть сообщение
pawn Код:
CMD:adminduty(playerid, params[])
{
    if(PlayerData[ID][AdminLevel] >= 1)
    {
        if(PlayerData[ID][AdminDuty] == 0)
        {
            GetPlayerName(playerid, PlayerData[playerid][OrginalName], 24);
            SetPlayerName(playerid, PlayerData[playerid][AdminName]);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are now on admin duty");
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /adminduty to go on admin duty");
            format(str2, sizeof(str2),"Admin %s Is now online",PlayerData[playerid][AdminName]);
            SetPlayerColor(playerid, COLOR_NAVY);
            SendClientMessageToAll(COLOR_GREEN,str2);
        }
        else
        {
            SetPlayerName(playerid, PlayerData[playerid][OrginalName]);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are now off admin duty");
            format(str2, sizeof(str2),"Admin %s Is now offline",PlayerData[playerid][AdminName]);
            SetPlayerColor(playerid, COLOR_NAVY);
            SendClientMessageToAll(COLOR_GREEN,str2);
        }
    }
    return 1;
}
Put OrginalName[MAX_PLAYER_NAME] into your enum.

EDIT I will put it into the cmd.
Still not working


If i do /adminduty it keeps just saying "You are now on admin duty"

Please Help Me


Thank You


Please Help Me Please
Reply
#7

Please Help Me


Thank You


Please Help Me Please
Reply
#8

pawn Код:
CMD:adminduty(playerid, params[])
{
    if(PlayerData[playerid][AdminLevel] >= 1)
    {
        if(PlayerData[playerid][AdminDuty] == 0)
        {
            GetPlayerName(playerid, PlayerData[playerid][OrginalName], 24);
            SetPlayerName(playerid, PlayerData[playerid][AdminName]);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are now on admin duty");
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /adminduty to go on admin duty");
            format(str2, sizeof(str2),"Admin %s Is now online",PlayerData[playerid][AdminName]);
            SetPlayerColor(playerid, COLOR_NAVY);
            SendClientMessageToAll(COLOR_GREEN,str2);
PlayerData[playerid][AdminDuty] = 1;
        }
        else
        {
            SetPlayerName(playerid, PlayerData[playerid][OrginalName]);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are now off admin duty");
            format(str2, sizeof(str2),"Admin %s Is now offline",PlayerData[playerid][AdminName]);
            SetPlayerColor(playerid, COLOR_NAVY);
            SendClientMessageToAll(COLOR_GREEN,str2);
PlayerData[playerid][AdminDuty] = 0;
        }
    }
    return 1;
}
Sorry my mistake. Now it should work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)