SA-MP Forums Archive
Admin Duty (Name) - 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: Admin Duty (Name) (/showthread.php?tid=427393)



Admin Duty (Name) - zT KiNgKoNg - 01.04.2013

I would like my server staff's name the change when the do /sduty but it inst working

pawn Код:
CMD:sduty(playerid, params[])
{
    new str[100];
    if(pStats[playerid][pStaff] >= 1)
    {
        if(pStats[playerid][pStaffDuty] == 0)
        {
            pStats[playerid][pStaffDuty] = 1;
            format(str, sizeof(str),"[ADMIN] - %s",pStats[playerid][pStaffName]);
            SetPlayerName(playerid,str);
            SendClientMessage(playerid, COLOR_LIME, "You're now on duty as a staff member");
        }else if(pStats[playerid][pStaffDuty] == 1){
            pStats[playerid][pStaffDuty] = 0;
            format(str, sizeof(str),"%s",pStats[playerid][pPlayerName]);
            SetPlayerName(playerid,str);
            SendClientMessage(playerid, COLOR_LIME, "You're now off duty as a staff member");
        }
    }else{
        SendClientMessage(playerid, COLOR_RED, stafflevelerror);
    }
    return 1;
}
pawn Код:
enum pInfo
{
    pPlayerName[MAX_PLAYER_NAME],
    pMoney,
    Pos_X,
    Pos_Y,
    Pos_Z,
    Rotation,
    pLevel,
    pStaff,
    pStaffName[MAX_PLAYER_NAME],
    pStaffDuty
}
new pStats[MAX_PLAYERS][pInfo];
pawn Код:
pStats[playerid][pPlayerName] = strval(result[7]);
pStats[playerid][pStaffName] = strval(result[8]);



Re: Admin Duty (Name) - SuperViper - 01.04.2013

strval will convert it to an integer, which will in the end turn it into an ASCII character, and names have to be at least 3 characters. Load the variables without strval.


Re: Admin Duty (Name) - zT KiNgKoNg - 01.04.2013

How would i do that
I tried this pStats[playerid][pStaffName] = result[8];


Re: Admin Duty (Name) - SuperViper - 01.04.2013

You could use format

pawn Код:
format(pStats[playerid][pStaffName], MAX_PLAYER_NAME, result[8]);



Re: Admin Duty (Name) - zT KiNgKoNg - 01.04.2013

I'll pm you the login bit