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



stats - NoDi522 - 31.05.2015

Why it won't load in this case: player's sex and country.

I made this code and everything else works but country and player's sex doesn't show:

PHP код:
CMD:stats(playerid,params[])
{
     new 
statut[256],poruka[256],nearporuka[256];
     new 
level GetPlayerScore(playerid);
     new 
ubojstva PlayerInfo[playerid][pUbojstva];
     new 
zlocini PlayerInfo[playerid][pZlocini];
     new 
smrti PlayerInfo[playerid][pSmrti];
    new 
novac GetPlayerMoney(playerid);
     new 
spol PlayerInfo[playerid][pSpol];
     new 
godine PlayerInfo[playerid][pGodine];
     new 
zemlja PlayerInfo[playerid][pZemlja];
     new 
banka PlayerInfo[playerid][pBankNovac];
     
/* Proredak */
    
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Niste ulogirani na server");
    
format(poruka,sizeof(poruka),"{FFFFFF}Osobna iskaznica od igraca"COLOR_WG" %s{FFFFFF}\n",GetName(playerid));
    
strcat(statut,poruka);
    
format(poruka,sizeof(poruka),"    Level: %d\n",level); // score
    
strcat(statut,poruka);
    
format(poruka,sizeof(poruka),"    Ubojstava: %d\n",ubojstva); // kills
    
strcat(statut,poruka);
    
format(poruka,sizeof(poruka),"    Smrti: %d\n",smrti); // deaths
    
strcat(statut,poruka);
    
format(poruka,sizeof(poruka),"    Zlocina: %d\n",zlocini); // crimes
    
strcat(statut,poruka);
    
format(poruka,sizeof(poruka),"    Novac: $%d\n",novac); // money
    
strcat(statut,poruka);
    
format(poruka,sizeof(poruka),"    Banka: $%d\n",banka); // bank money
    
strcat(statut,poruka);
    
format(poruka,sizeof(poruka),"    Spol:"COLOR_SIVA" %s\n{FFFFFF}",spol); // PLAYER'S SEX
    
strcat(statut,poruka);
    
format(poruka,sizeof(poruka),"    Godine: %d\n",godine); // age
    
strcat(statut,poruka);
    
format(poruka,sizeof(poruka),"    Zemlja:"COLOR_SIVA" %s\n",zemlja); // PLAYER'S COUNTRY
    
strcat(statut,poruka);
    
format(nearporuka,256,"* %s vadi svoju osobnu iskaznicu",GetName(playerid));
    
SendNearMessage(playerid,COLOR_ROZA,nearporuka); // message which sends information to near players.
    
    
ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX,""COLOR_ZUTA"Osobna iskaznica",statut,"Uredu",""); // showing dialog.
    
return 1;




Re: stats - Konstantinos - 31.05.2015

Assigning to an integer variable a string is incorrect. You'd have to copy a string to another but what's the point of all those temporary variables?

Just:
pawn Код:
format(poruka,sizeof(poruka),"    Zemlja:"COLOR_SIVA" %s\n",PlayerInfo[playerid][pZemlja]); // PLAYER'S COUNTRY



Re: stats - FrankLucretti - 31.05.2015

Hey! Use this, should work.
Please +1Rep me to make me happy
PHP код:
CMD:stats(playerid,params[]) 

     new 
statut[256],poruka[256],nearporuka[256]; 
     new 
level GetPlayerScore(playerid); 
     new 
ubojstva PlayerInfo[playerid][pUbojstva]; 
     new 
zlocini PlayerInfo[playerid][pZlocini]; 
     new 
smrti PlayerInfo[playerid][pSmrti]; 
    new 
novac GetPlayerMoney(playerid); 
     new 
spol PlayerInfo[playerid][pSpol]; 
     new 
godine PlayerInfo[playerid][pGodine]; 
     new 
zemlja PlayerInfo[playerid][pZemlja]; 
     new 
banka PlayerInfo[playerid][pBankNovac]; 
     
/* Proredak */ 
format(poruka,sizeof(poruka),"    Zemlja:"COLOR_SIVA" %s\n",PlayerInfo[playerid][pZemlja]); // PLAYER'S COUNTRY
    
format(poruka,sizeof(poruka),"{FFFFFF}Osobna iskaznica od igraca"COLOR_WG" %s{FFFFFF}\n",GetName(playerid)); 
    
strcat(statut,poruka); 
    
format(poruka,sizeof(poruka),"    Level: %d\n",level); // score 
    
strcat(statut,poruka); 
    
format(poruka,sizeof(poruka),"    Ubojstava: %d\n",ubojstva); // kills 
    
strcat(statut,poruka); 
    
format(poruka,sizeof(poruka),"    Smrti: %d\n",smrti); // deaths 
    
strcat(statut,poruka); 
    
format(poruka,sizeof(poruka),"    Zlocina: %d\n",zlocini); // crimes 
    
strcat(statut,poruka); 
    
format(poruka,sizeof(poruka),"    Novac: $%d\n",novac); // money 
    
strcat(statut,poruka); 
    
format(poruka,sizeof(poruka),"    Banka: $%d\n",banka); // bank money 
    
strcat(statut,poruka); 
    
format(poruka,sizeof(poruka),"    Spol:"COLOR_SIVA" %s\n{FFFFFF}",spol); // PLAYER'S SEX 
    
strcat(statut,poruka); 
    
format(poruka,sizeof(poruka),"    Godine: %d\n",godine); // age 
    
strcat(statut,poruka); 
    
format(poruka,sizeof(poruka),"    Zemlja:"COLOR_SIVA" %s\n",zemlja); // PLAYER'S COUNTRY 
    
strcat(statut,poruka); 
    
format(nearporuka,256,"* %s vadi svoju osobnu iskaznicu",GetName(playerid)); 
    
SendNearMessage(playerid,COLOR_ROZA,nearporuka); // message which sends information to near players. 
     
    
ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX,""COLOR_ZUTA"Osobna iskaznica",statut,"Uredu",""); // showing dialog. 
    
return 1




Re: stats - NoDi522 - 01.06.2015

Thanks and let me make you happy +rep


Re: stats - FrankLucretti - 01.06.2015

Quote:
Originally Posted by NoDi522
Посмотреть сообщение
Thanks and let me make you happy +rep
Thank you bro, you are awesome