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



toupper - austin070 - 09.09.2014

pawn Код:
new targetid, license[6], str[128];
        if(sscanf(params, "us[6]", targetid, license)) return SendClientMessage(playerid, COLOR_SACBLUE, "Usage: /issuelic [playerid] [license type]");
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "(ERROR) Invalid playerid.");

        format(str, sizeof(str), "(DMV) You have issued %s Driver's License Class %s.", GetPName(targetid), toupper(license[0]));
Let's say I enter "c" for the license type, this string is returning "(DMV) You have issued John_Doe Driver's License Class CJohn_Doe. Am I using toupper incorrectly?


Re: toupper - [XST]O_x - 09.09.2014

Try this:
pawn Код:
format(str, sizeof(str), "(DMV) You have issued %s Driver's License Class %s.", GetPName(targetid), license[0] - 32);



Re: toupper - austin070 - 09.09.2014

Quote:
Originally Posted by [XST]O_x
Посмотреть сообщение
Try this:
pawn Код:
format(str, sizeof(str), "(DMV) You have issued %s Driver's License Class %s.", GetPName(targetid), license[0] - 32);
pawn Код:
new capital = license[0]-32;

        format(str, sizeof(str), "(DMV) You have issued %s Driver's License Class %s.", GetPName(targetid), capital);
        SendClientMessage(playerid, COLOR_PURPLE, str);
        format(str, sizeof(str), "(DMV) You have been issued Driver's License Class %s.", capital);
        SendClientMessage(targetid, COLOR_PURPLE, str);
This makes it call the second string twice in the same line (as does new capital = toupper(license[0]).


Re: toupper - Sledgehammer - 09.09.2014

pawn Код:
format(str, sizeof(str), "(DMV) You have been issued Driver's License Class %s.", capital);
SendClientMessage(targetid, COLOR_PURPLE, str);
Remove this, or the other string.


Re: toupper - austin070 - 09.09.2014

Quote:
Originally Posted by Death1300
Посмотреть сообщение
pawn Код:
format(str, sizeof(str), "(DMV) You have been issued Driver's License Class %s.", capital);
SendClientMessage(targetid, COLOR_PURPLE, str);
Remove this, or the other string.
I shouldn't need to.


Re: toupper - HazardouS - 09.09.2014

pawn Код:
new targetid, license[6], str[128];
if(sscanf(params, "us[6]", targetid, license)) return SendClientMessage(playerid, COLOR_SACBLUE, "Usage: /issuelic [playerid] [license type]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "(ERROR) Invalid playerid.");
license[0] = toupper(license[0]);
format(str, sizeof(str), "(DMV) You have issued %s Driver's License Class %s.", GetPName(targetid), license);
Try this one, i think it works fine.


Re: toupper - Sledgehammer - 09.09.2014

Oh. I miss-read. My bad. Not sure why its being called twice though.


Re: toupper - austin070 - 09.09.2014

Quote:
Originally Posted by HazardouS
Посмотреть сообщение
pawn Код:
new targetid, license[6], str[128];
if(sscanf(params, "us[6]", targetid, license)) return SendClientMessage(playerid, COLOR_SACBLUE, "Usage: /issuelic [playerid] [license type]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "(ERROR) Invalid playerid.");
license[0] = toupper(license[0]);
format(str, sizeof(str), "(DMV) You have issued %s Driver's License Class %s.", GetPName(targetid), license);
Try this one, i think it works fine.
Ah thank you. That makes a lot more sense.