SA-MP Forums Archive
Badge System - 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: Badge System (/showthread.php?tid=306153)



Badge System - Mini` - 25.12.2011

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...


Re: Badge System - Ballu Miaa - 25.12.2011

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!


Re: Badge System - Gh05t_ - 25.12.2011

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);



Re: Badge System - rinori - 25.12.2011

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


Re: Badge System - Mini` - 25.12.2011

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