SA-MP Forums Archive
What am I doing wrong here? - 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: What am I doing wrong here? (/showthread.php?tid=664246)



What am I doing wrong here? - LewisC - 23.02.2019

pawn Код:
Player[playerid][GlobalName] = strval(inputtext);
             
             format(Query, sizeof(Query), "UPDATE db_players SET Username = '%q' WHERE Username = '%q'", inputtext, Player[playerid][GlobalName]);
             db_query(PlayersDB, Query);
             
             
             format(string, sizeof(string), "Your new name is: %s", inputtext);
             ShowPlayerDialog(playerid, D_INFO, DIALOG_STYLE_MSGBOX, "Name changed!", string, "Confirm", "Cancel");
             
             SetPlayerName(playerid, inputtext);
Код:
[02:04:59] [db_log_queries]: UPDATE db_players SET Username = 'fazr' WHERE Username = ''



Re: What am I doing wrong here? - Jefff - 23.02.2019

https://sampwiki.blast.hk/wiki/Strval


Re: What am I doing wrong here? - LewisC - 23.02.2019

Quote:
Originally Posted by Jefff
Посмотреть сообщение
silly me

but you see what I'm trying to do right? If not,

I'm trying to update the globalname variable with the inputtext before updating the db
but I've forgotten how to do it.


Re: What am I doing wrong here? - Jefff - 23.02.2019

You need update globalname after format not before

pawn Код:
strcat((Player[playerid][GlobalName][0]='\0',Player[playerid][GlobalName]),inputtext,MAX_PLAYER_NAME);



Re: What am I doing wrong here? - LewisC - 23.02.2019

Quote:
Originally Posted by Jefff
Посмотреть сообщение
You need update globalname after format not before

pawn Код:
strcat((Player[playerid][GlobalName][0]='\0',Player[playerid][GlobalName]),inputtext,MAX_PLAYER_NAME);
Thank you.