Posts: 38
Threads: 7
Joined: Sep 2013
Hi.
Here, I would like the difference between %s - %f and %d, and most importantly, know when to use which.
Bye
Posts: 1,226
Threads: 217
Joined: Jan 2012
Reputation:
0
%s = printing out the name
%d = printing out the numbers
%f = float... printing out float..
%s you can use like in example to print out players name
%d you can use for example to print out phone number
%f you can use for example to print our what is player coordinates !
Posts: 38
Threads: 7
Joined: Sep 2013
I use %d for save the the age of the players, no error in the mysql_log, but in the database it puts the age 0.
But, if I use %s in the database that will be the right age, but in the mysql_log it will say `Age`= no to the number ... help?
Posts: 1,226
Threads: 217
Joined: Jan 2012
Reputation:
0
So show me your saving enum.. and show the dialog where do you put in it.
Posts: 38
Threads: 7
Joined: Sep 2013
It's in a update account:
pawn Код:
new Requete[1024];
format(Requete, sizeof(Requete), "UPDATE lsrp_comptes SET `Age`=%d, `Sex`=%x, `Aspi`=%d, `Skin`=%d, `Cash`=%d WHERE ID=%d",
Player_infos[playerid][p_Age],
Player_infos[playerid][p_Sex],
Player_infos[playerid][p_Aspi],
Player_infos[playerid][p_Skin],
Player_infos[playerid][p_Cash],
Player_infos[playerid][p_Sql_Id]);
mysql_query(Requete);
mysql_debug_save(Requete);
And the dialog:
pawn Код:
else if(Player_inscription_etape[playerid] == 3)
{
if(strlen(inputtext) == 0)
{
ShowPlayerDialog(playerid, PLAYER_DIALOG_INSCRIPTION, DIALOG_STYLE_INPUT, "Choix de l'вge du personnage.", "Entrez l'вge de votre personnage:", "Continuer", "");
return 1;
}
if(strval(inputtext) < 13)
{
ShowPlayerDialog(playerid, PLAYER_DIALOG_INSCRIPTION, DIALOG_STYLE_INPUT, "Choix de l'вge du personnage.", "L'вge de votre personnage doit кtre de 13 ans minimum:", "Continuer", "");
return 1;
}
if(strval(inputtext) > 80)
{
ShowPlayerDialog(playerid, PLAYER_DIALOG_INSCRIPTION, DIALOG_STYLE_INPUT, "Choix de l'вge du personnage.", "L'вge de votre personnage doit кtre de 80 ans au maximum:", "Continuer", "");
return 1;
}
Player_inscription_age[playerid] = strval(inputtext);
ShowPlayerDialog(playerid, PLAYER_DIALOG_INSCRIPTION, DIALOG_STYLE_LIST, "Choix du sexe du personnage.", "Homme.\nFemme.", "Continuer", "");
Player_inscription_etape[playerid] = 5;
}
Posts: 1,226
Threads: 217
Joined: Jan 2012
Reputation:
0
This looks good..How did you set a mysql data base?
Posts: 38
Threads: 7
Joined: Sep 2013
I'm not english, reformulate please?
Posts: 1,223
Threads: 5
Joined: Sep 2011
Reputation:
0
%s = string
%f = float (0.000 for example)
%d & %i = integer (or whole numbers)
Posts: 38
Threads: 7
Joined: Sep 2013
pawn Код:
new Requete[1024];
format(Requete, sizeof(Requete), "UPDATE lsrp_comptes SET `Age`=%d, `Sex`=%d, `Aspi`=%d, `Skin`=%d, `Cash`=%d WHERE ID=%d",
Player_infos[playerid][p_Age] = strval(inputtext),
Player_infos[playerid][p_Sex] = strval(inputtext),
Player_infos[playerid][p_Aspi] = strval(inputtext),
Player_infos[playerid][p_Skin] = strval(inputtext),
Player_infos[playerid][p_Cash] = strval(inputtext),
Player_infos[playerid][p_Sql_Id]) = strval(inputtext);
mysql_query(Requete);
mysql_debug_save(Requete);
like that?