toupper
#1

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?
Reply
#2

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

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]).
Reply
#4

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

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)