Badge System
#1

How would one go about making a badge system?
It would be easier to add it on to their name(that displays above their head) than to attach a 3dtextlabel to them, right?

I can't get it to change my name... I know it's a stupid problem, probably made by a mistake, as I just put this together out of the blue, and didn't use any references... And yes... I'm a newb

pawn Код:
CMD:badge(playerid, params[]) {
    new
        string[128],
        string2[64];
       

    GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
    if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 1) {
        format(string, sizeof(string), "* Officer %s takes out his badge and places it on his shirt.", szPlayerName);
        SendClientMessage(playerid, COLOR_PURPLE, string);
        format(string2, sizeof(string2), "Officer %s", szPlayerName);
        SetPlayerName(playerid, string2);
    }
    if(playerVariables[playerid][pAdminLevel] >= 1) {
        format(string, sizeof(string), "* Admin %s takes out his badge and places it on his shirt.", szPlayerName);
        SendClientMessage(playerid, COLOR_PURPLE, string);
        format(string2, sizeof(string2), "Admin %s", szPlayerName);
        SetPlayerName(playerid, string2);
    }

    return 1;
}
It doesn't throw any errors, just simply doesn't change the persons name...
Reply
#2

pawn Код:
CMD:badge(playerid, params[])
{
    new string[128];
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 1) {
        format(string, sizeof(string), "* Officer %s takes out his badge and places it on his shirt.", sendername);
        SendClientMessage(playerid, COLOR_PURPLE, string);
        format(string2, sizeof(string2), "[Officer]%s", sendername);
        SetPlayerName(playerid, string2);
    }
    else if(playerVariables[playerid][pAdminLevel] >= 1) {
        format(string, sizeof(string), "* Admin %s takes out his badge and places it on his shirt.", sendername);
        SendClientMessage(playerid, COLOR_PURPLE, string);
        format(string2, sizeof(string2), "[Admin]%s", sendername);
        SetPlayerName(playerid, string2);
    }
    else { SendClientMessage(playerid,COLOR_RED,"You can't use this command!"); }
    return 1;
}
NOTE: UNTESTED
Try to use this command now! Replace it with your current one!
Reply
#3

Quote:
Originally Posted by Mini`
Посмотреть сообщение
How would one go about making a badge system?
It would be easier to add it on to their name(that displays above their head) than to attach a 3dtextlabel to them, right?

I can't get it to change my name... I know it's a stupid problem, probably made by a mistake, as I just put this together out of the blue, and didn't use any references... And yes... I'm a newb

pawn Код:
CMD:badge(playerid, params[]) {
    new
        string[128],
        string2[64];
       

    GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
    if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 1) {
        format(string, sizeof(string), "* Officer %s takes out his badge and places it on his shirt.", szPlayerName);
        SendClientMessage(playerid, COLOR_PURPLE, string);
        format(string2, sizeof(string2), "Officer %s", szPlayerName);
        SetPlayerName(playerid, string2);
    }
    if(playerVariables[playerid][pAdminLevel] >= 1) {
        format(string, sizeof(string), "* Admin %s takes out his badge and places it on his shirt.", szPlayerName);
        SendClientMessage(playerid, COLOR_PURPLE, string);
        format(string2, sizeof(string2), "Admin %s", szPlayerName);
        SetPlayerName(playerid, string2);
    }

    return 1;
}
It doesn't throw any errors, just simply doesn't change the persons name...
You can't have a space in your name.

pawn Код:
format(string2, sizeof(string2), "Officer_%s", szPlayerName);
Reply
#4

Yep, you can only use '_', thats why in every roleplay server, the names have the underscore.
Firstname_Lastname.
Reply
#5

Oh wow. I knew that too :/
I just didn't even think about it... Thanks guys!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)