Admin Duty (Name)
#1

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]);
Reply
#2

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.
Reply
#3

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

You could use format

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

I'll pm you the login bit
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)