SA-MP Forums Archive
/stats command in dialog - 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: /stats command in dialog (/showthread.php?tid=631508)



/stats command in dialog - TheAdii15 - 30.03.2017

Hi!
I use the zGaming gamemode, and I can't make the /stats command show in dialog, it only show one line, and I don't know why...Please help me guys..
Код:
new coordsstring[256];
	new string2[200];
	format(coordsstring, sizeof(coordsstring), "Szint: [%d] - Nem: [%s] - Kor: [%d] - Kйszpйnz: [%d$] - Bankszбmla egyenleg: [%d$] - Йleterő: [%0.1f] - Golyубllу mellйny[%0.1f]\n", PlayerInfo[playerb][pLevel], gender, PlayerInfo[playerb][pAge], PlayerInfo[playerb][pMoney], PlayerInfo[playerb][pBank], H, A);
    strcat(string2,coordsstring);
	format(coordsstring, sizeof(coordsstring), "Telefonszбm: [%d] - Jбtszott уrбk: [%d] - Kцvetkező szint: [%d/%d] - Kцvetkező szint бra: [%d$] - Tapasztalat pontok [%d]\n", PlayerInfo[playerb][pNumber], PlayerInfo[playerb][pHours], exp, expamount, costlevel, PlayerInfo[playerb][pExp]);
    strcat(string2,coordsstring);
	format(coordsstring, sizeof(coordsstring), "Foglalkozбs: [%s] - Kцrцzйsi szint: [%d] - Elkцvetett bűncselekmйny: [%d] - Letartуztatva: [%dx] - Gyilkossбg: [%d] - Halбl: [%d]\n", RPJN(playerb), PlayerInfo[playerb][pWanted], PlayerInfo[playerb][pCrimes], PlayerInfo[playerb][pArrested], PlayerInfo[playerb][pKill], PlayerInfo[playerb][pDeath]);
    strcat(string2,coordsstring);
	format(coordsstring, sizeof(coordsstring), "Frakciу: [%s] - Frakciу rang: [%s] - Banda: [%s] - Banda rang: [%s]\n", org, rank, org2, rank2);
    strcat(string2,coordsstring);
	format(coordsstring, sizeof(coordsstring), "Ьzlet: [%s] - Hбz: [%s] - Garбzs: [%s]\n", RBT(PlayerInfo[playerb][pBiz]), RPHK(playerb), RPGK(playerb), RVN(GetVehicleModel(PlayerInfo[playerb][pVeh])), PlayerInfo[playerb][pVeh], RVN(GetVehicleModel(PlayerInfo[playerb][pVVeh])), PlayerInfo[playerb][pVVeh], RVN(GetVehicleModel(PlayerInfo[playerb][pVVVeh])), PlayerInfo[playerb][pVVVeh], RVN(GetVehicleModel(PlayerInfo[playerb][pVVVVeh])), PlayerInfo[playerb][pVVVVeh]);
    strcat(string2,coordsstring);
	format(string2, sizeof(string2), "Jбrművek: 1=%s - 2=%s - 3=%s - 4=%s", RVN(PlayerInfo[playerb][vModel]), RVN(PlayerInfo[playerid][vVModel]), RVN(PlayerInfo[playerb][vVVModel]), RVN(PlayerInfo[playerb][vVVVModel]));
	ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX, "Adataid", string2,"Bezбrбs","");
That's all, what is the problem?


Re: /stats command in dialog - Toroi - 30.03.2017

PHP код:
format(string2sizeof(string2), "Jбrművek: 1=%s - 2=%s - 3=%s - 4=%s"RVN(PlayerInfo[playerb][vModel]), RVN(PlayerInfo[playerid][vVModel]), RVN(PlayerInfo[playerb][vVVModel]), RVN(PlayerInfo[playerb][vVVVModel])); 
The problem is that you finished concatenating the strings but you formatted it right away. Formatting deletes the string value as far as I know, hence only the above will display in the dialog.


Re: /stats command in dialog - TheAdii15 - 30.03.2017

So, what I have to do?


Re: /stats command in dialog - Toroi - 30.03.2017

Either remove the last format or change the output string for coordstring and concatenate it to string2


Re: /stats command in dialog - iMaxy - 30.03.2017

PHP код:
    new string[6000];
    
strcat(string"Szint: [%d] - Nem: [%s] - Kor: [%d] - Kйszpйnz: [%d$] - Bankszбmla egyenleg: [%d$] - Йletero: [%0.1f] - Golyубllу mellйny[%0.1f]\n");
    
format(string,sizeof(string), stringPlayerInfo[playerb][pLevel], genderPlayerInfo[playerb][pAge], PlayerInfo[playerb][pMoney], PlayerInfo[playerb][pBank], HA);
    
strcat(string"Telefonszбm: [%d] - Jбtszott уrбk: [%d] - Kцvetkezo szint: [%d/%d] - Kцvetkezo szint бra: [%d$] - Tapasztalat pontok [%d]\n");
    
format(stringsizeof(string), stringPlayerInfo[playerb][pNumber], PlayerInfo[playerb][pHours], expexpamountcostlevelPlayerInfo[playerb][pExp]);
    
strcat(string,"Foglalkozбs: [%s] - Kцrцzйsi szint: [%d] - Elkцvetett buncselekmйny: [%d] - Letartуztatva: [%dx] - Gyilkossбg: [%d] - Halбl: [%d]\n");
    
format(string,sizeof(string), stringRPJN(playerb), PlayerInfo[playerb][pWanted], PlayerInfo[playerb][pCrimes], PlayerInfo[playerb][pArrested], PlayerInfo[playerb][pKill], PlayerInfo[playerb][pDeath]);
    
strcat(string"Frakciу: [%s] - Frakciу rang: [%s] - Banda: [%s] - Banda rang: [%s]\n");
    
format(string,sizeof(string), stringorgrankorg2rank2);
    
strcat(string"Ьzlet: [%s] - Hбz: [%s] - Garбzs: [%s]\n");
    
format(string,sizeof(string), stringRBT(PlayerInfo[playerb][pBiz]), RPHK(playerb), RPGK(playerb), RVN(GetVehicleModel(PlayerInfo[playerb][pVeh])), PlayerInfo[playerb][pVeh], RVN(GetVehicleModel(PlayerInfo[playerb][pVVeh])), PlayerInfo[playerb][pVVeh], RVN(GetVehicleModel(PlayerInfo[playerb][pVVVeh])), PlayerInfo[playerb][pVVVeh], RVN(GetVehicleModel(PlayerInfo[playerb][pVVVVeh])), PlayerInfo[playerb][pVVVVeh]);
    
strcat(string"Jбrmuvek: 1=%s - 2=%s - 3=%s - 4=%s");
    
fromat(stringsizeof(string), stringRVN(PlayerInfo[playerb][vModel]), RVN(PlayerInfo[playerid][vVModel]), RVN(PlayerInfo[playerb][vVVModel]), RVN(PlayerInfo[playerb][vVVVModel]));
    
ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX"Adataid"string,"Bezбrбs",""); 



Re: /stats command in dialog - Toroi - 30.03.2017

Quote:
Originally Posted by iMaxy
Посмотреть сообщение
PHP код:
new string[6000]; 
1 No need for such an exaggerated string size.
2 That code will face the same problem OP's code is facing.


Re: /stats command in dialog - TheAdii15 - 30.03.2017

Quote:
Originally Posted by iMaxy
Посмотреть сообщение
PHP код:
    new string[6000];
    
strcat(string"Szint: [%d] - Nem: [%s] - Kor: [%d] - Kйszpйnz: [%d$] - Bankszбmla egyenleg: [%d$] - Йletero: [%0.1f] - Golyубllу mellйny[%0.1f]\n");
    
format(string,sizeof(string), stringPlayerInfo[playerb][pLevel], genderPlayerInfo[playerb][pAge], PlayerInfo[playerb][pMoney], PlayerInfo[playerb][pBank], HA);
    
strcat(string"Telefonszбm: [%d] - Jбtszott уrбk: [%d] - Kцvetkezo szint: [%d/%d] - Kцvetkezo szint бra: [%d$] - Tapasztalat pontok [%d]\n");
    
format(stringsizeof(string), stringPlayerInfo[playerb][pNumber], PlayerInfo[playerb][pHours], expexpamountcostlevelPlayerInfo[playerb][pExp]);
    
strcat(string,"Foglalkozбs: [%s] - Kцrцzйsi szint: [%d] - Elkцvetett buncselekmйny: [%d] - Letartуztatva: [%dx] - Gyilkossбg: [%d] - Halбl: [%d]\n");
    
format(string,sizeof(string), stringRPJN(playerb), PlayerInfo[playerb][pWanted], PlayerInfo[playerb][pCrimes], PlayerInfo[playerb][pArrested], PlayerInfo[playerb][pKill], PlayerInfo[playerb][pDeath]);
    
strcat(string"Frakciу: [%s] - Frakciу rang: [%s] - Banda: [%s] - Banda rang: [%s]\n");
    
format(string,sizeof(string), stringorgrankorg2rank2);
    
strcat(string"Ьzlet: [%s] - Hбz: [%s] - Garбzs: [%s]\n");
    
format(string,sizeof(string), stringRBT(PlayerInfo[playerb][pBiz]), RPHK(playerb), RPGK(playerb), RVN(GetVehicleModel(PlayerInfo[playerb][pVeh])), PlayerInfo[playerb][pVeh], RVN(GetVehicleModel(PlayerInfo[playerb][pVVeh])), PlayerInfo[playerb][pVVeh], RVN(GetVehicleModel(PlayerInfo[playerb][pVVVeh])), PlayerInfo[playerb][pVVVeh], RVN(GetVehicleModel(PlayerInfo[playerb][pVVVVeh])), PlayerInfo[playerb][pVVVVeh]);
    
strcat(string"Jбrmuvek: 1=%s - 2=%s - 3=%s - 4=%s");
    
fromat(stringsizeof(string), stringRVN(PlayerInfo[playerb][vModel]), RVN(PlayerInfo[playerid][vVModel]), RVN(PlayerInfo[playerb][vVVModel]), RVN(PlayerInfo[playerb][vVVVModel]));
    
ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX"Adataid"string,"Bezбrбs",""); 
It's still not working.


Re: /stats command in dialog - TheAdii15 - 30.03.2017

Quote:
Originally Posted by Troydere
Посмотреть сообщение
Either remove the last format or change the output string for coordstring and concatenate it to string2
I did something what you said, but I don't know what did you mean exactly..
PHP код:
new coordsstring[1024];
    new 
string2[1024];
    
format(coordsstringsizeof(coordsstring), "Szint: [%d] - Nem: [%s] - Kor: [%d] - Kйszpйnz: [%d$] - Bankszбmla egyenleg: [%d$] - Йleterő: [%0.1f] - Golyубllу mellйny[%0.1f]\n"PlayerInfo[playerb][pLevel], genderPlayerInfo[playerb][pAge], PlayerInfo[playerb][pMoney], PlayerInfo[playerb][pBank], HA);
    
strcat(string2,coordsstring);
    
format(coordsstringsizeof(coordsstring), "\nTelefonszбm: [%d] - Jбtszott уrбk: [%d] - Kцvetkező szint: [%d/%d] - Kцvetkező szint бra: [%d$] - Tapasztalat pontok [%d]\n"PlayerInfo[playerb][pNumber], PlayerInfo[playerb][pHours], expexpamountcostlevelPlayerInfo[playerb][pExp]);
    
strcat(string2,coordsstring);
    
format(coordsstringsizeof(coordsstring), "\nFoglalkozбs: [%s] - Kцrцzйsi szint: [%d] - Elkцvetett bűncselekmйny: [%d] - Letartуztatva: [%dx] - Gyilkossбg: [%d] - Halбl: [%d]\n"RPJN(playerb), PlayerInfo[playerb][pWanted], PlayerInfo[playerb][pCrimes], PlayerInfo[playerb][pArrested], PlayerInfo[playerb][pKill], PlayerInfo[playerb][pDeath]);
    
strcat(string2,coordsstring);
    
format(coordsstringsizeof(coordsstring), "\nFrakciу: [%s] - Frakciу rang: [%s] - Banda: [%s] - Banda rang: [%s]\n"orgrankorg2rank2);
    
strcat(string2,coordsstring);
    
format(coordsstringsizeof(coordsstring), "\nЬzlet: [%s] - Hбz: [%s] - Garбzs: [%s]\n"RBT(PlayerInfo[playerb][pBiz]), RPHK(playerb), RPGK(playerb), RVN(GetVehicleModel(PlayerInfo[playerb][pVeh])), PlayerInfo[playerb][pVeh], RVN(GetVehicleModel(PlayerInfo[playerb][pVVeh])), PlayerInfo[playerb][pVVeh], RVN(GetVehicleModel(PlayerInfo[playerb][pVVVeh])), PlayerInfo[playerb][pVVVeh], RVN(GetVehicleModel(PlayerInfo[playerb][pVVVVeh])), PlayerInfo[playerb][pVVVVeh]);
    
strcat(string2,coordsstring);
    
format(coordsstringsizeof(coordsstring), "\nJбrművek: 1=%s - 2=%s - 3=%s - 4=%s"RVN(PlayerInfo[playerb][vModel]), RVN(PlayerInfo[playerid][vVModel]), RVN(PlayerInfo[playerb][vVVModel]), RVN(PlayerInfo[playerb][vVVVModel]));
    
ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX"Adataid"coordsstring,"Bezбrбs",""); 



Re: /stats command in dialog - Toroi - 30.03.2017

Yeah, you're halfway there, now concatenate the just formatted coordsstring with your string2 string by using the strcat function, just like the line over the format function you just fixed.


Re: /stats command in dialog - TheAdii15 - 30.03.2017

Quote:
Originally Posted by Troydere
Посмотреть сообщение
Yeah, you're halfway there, now concatenate the just formatted coordsstring with your string2 string by using the strcat function, just like the line over the format function you just fixed.
Still not working perfect :/
PHP код:
new coordsstring[1024];
    new 
string2[1024];
    
format(coordsstringsizeof(coordsstring), "Szint: [%d] - Nem: [%s] - Kor: [%d] - Kйszpйnz: [%d$] - Bankszбmla egyenleg: [%d$] - Йleterő: [%0.1f] - Golyубllу mellйny[%0.1f]\n"PlayerInfo[playerb][pLevel], genderPlayerInfo[playerb][pAge], PlayerInfo[playerb][pMoney], PlayerInfo[playerb][pBank], HA);
    
strcat(coordsstring,coordsstring);
    
format(coordsstringsizeof(coordsstring), "\nTelefonszбm: [%d] - Jбtszott уrбk: [%d] - Kцvetkező szint: [%d/%d] - Kцvetkező szint бra: [%d$] - Tapasztalat pontok [%d]\n"PlayerInfo[playerb][pNumber], PlayerInfo[playerb][pHours], expexpamountcostlevelPlayerInfo[playerb][pExp]);
    
strcat(coordsstring,coordsstring);
    
format(coordsstringsizeof(coordsstring), "\nFoglalkozбs: [%s] - Kцrцzйsi szint: [%d] - Elkцvetett bűncselekmйny: [%d] - Letartуztatva: [%dx] - Gyilkossбg: [%d] - Halбl: [%d]\n"RPJN(playerb), PlayerInfo[playerb][pWanted], PlayerInfo[playerb][pCrimes], PlayerInfo[playerb][pArrested], PlayerInfo[playerb][pKill], PlayerInfo[playerb][pDeath]);
    
strcat(coordsstring,coordsstring);
    
format(coordsstringsizeof(coordsstring), "\nFrakciу: [%s] - Frakciу rang: [%s] - Banda: [%s] - Banda rang: [%s]\n"orgrankorg2rank2);
    
strcat(coordsstring,coordsstring);
    
format(coordsstringsizeof(coordsstring), "\nЬzlet: [%s] - Hбz: [%s] - Garбzs: [%s]\n"RBT(PlayerInfo[playerb][pBiz]), RPHK(playerb), RPGK(playerb), RVN(GetVehicleModel(PlayerInfo[playerb][pVeh])), PlayerInfo[playerb][pVeh], RVN(GetVehicleModel(PlayerInfo[playerb][pVVeh])), PlayerInfo[playerb][pVVeh], RVN(GetVehicleModel(PlayerInfo[playerb][pVVVeh])), PlayerInfo[playerb][pVVVeh], RVN(GetVehicleModel(PlayerInfo[playerb][pVVVVeh])), PlayerInfo[playerb][pVVVVeh]);
    
strcat(coordsstring,coordsstring);
    
format(coordsstringsizeof(coordsstring), "\nJбrművek: 1=%s - 2=%s - 3=%s - 4=%s"RVN(PlayerInfo[playerb][vModel]), RVN(PlayerInfo[playerid][vVModel]), RVN(PlayerInfo[playerb][vVVModel]), RVN(PlayerInfo[playerb][vVVVModel]));
    
ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX"Adataid"coordsstring,"Bezбrбs","");