SA-MP Forums Archive
[ZCMD]Problem Showing player name went type cmd - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [ZCMD]Problem Showing player name went type cmd (/showthread.php?tid=473883)



[ZCMD]Problem Showing player name went type cmd - donhu789 - 05.11.2013

pawn Код:
CMD:onduty(playerid,params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 1)
    {
        if(PlayerInfo[playerid][OnDuty] == 0)
        {
            PlayerInfo[playerid][OnDuty] = 1;
            return SendClientMessage(playerid,orange,"|- You are now in \"Duty Mode\" -|");
        }
        else
        {
            PlayerInfo[playerid][OnDuty] = 0;
            return SendClientMessage(playerid,orange,"|- You are now in \"Playing Mode\"-|");
        }
    }
    return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}

Guy Cann you make my the commands went Admin preass on it say:

* Administrator John [ID:15] is now On duty.


And if he preass again is show:

* Administrator John [ID:15] is No Longer on duty.


Can you guys help ?



-Please Help +REP +REP +REP

-Regards donhu789


Re: [ZCMD]Problem Showing player name went type cmd - iGetty - 05.11.2013

Untested but should work:

pawn Код:
CMD:onduty(playerid,params[])
{
    #pragma unused params
    new name[24], string[128];
    GetPlayerName(playerid, name, sizeof(name));
    if(PlayerInfo[playerid][Level] >= 1)
    {
        if(PlayerInfo[playerid][OnDuty] == 0)
        {
            PlayerInfo[playerid][OnDuty] = 1;
            format(string, sizeof(string), "* Administrator %s [ID: %d] is now On duty.", name, playerid);
            SendClientMessageToAll(orange,string);
        }
        else
        {
            PlayerInfo[playerid][OnDuty] = 0;
            format(string, sizeof(string), "* Administrator %s [ID: %d] is now Off duty.", name, playerid);
            SendClientMessageToAll(orange,string);
        }
    }
    else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
    return 1;
}