[HELP] string - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] string (
/showthread.php?tid=106269)
[HELP] string -
igorponce - 02.11.2009
Hi, I was doing a command to display the status of the player, but have information that is not being shown, ie when I type / status everything appears normal at the Frag that does not appear.
script:
Код:
if (strcmp("/status", cmdtext, true) == 0)
{
new nick[MAX_PLAYER_NAME];
new string1[256];
GetPlayerName(playerid,nick,sizeof(nick));
format(string1,sizeof(string1),"[Name: %s] [Kills: %d] [Deaths:%d] [Frag: %d]",nick,KILLS[playerid],DEATHS[playerid],KILLS[playerid]/DEATHS[playerid]);
SendClientMessage(playerid,COLOR_GRAY,string1);
return 1;
}
Thank's
Re: [HELP] string -
radhakr - 02.11.2009
Kills divided by deaths will not be an integer unless they happen to divide exactly, so using '%d' probably won't work. That is my guess anyway.
https://sampwiki.blast.hk/wiki/Format
Also you should check this out
http://forum.sa-mp.com/index.php?topic=78026.0
Re: [HELP] string -
igorponce - 02.11.2009
I found the solution !!!
Код:
if (strcmp("/status", cmdtext, true) == 0)
{
new nick[MAX_PLAYER_NAME];
new string1[256];
GetPlayerName(playerid,nick,sizeof(nick));
format(string1,sizeof(string1),"[Nome: %s] [Matou Total: %d] [Morreu Total:%d] [Fragante Total: %.2f]",nick,MATOU[playerid],MORREU[playerid],float(MATOU[playerid])/float(MORREU[playerid]));
SendClientMessage(playerid,COLOR_GRAY,string1);
return 1;
}
Re: [HELP] string -
radhakr - 02.11.2009
Good, also:
http://forum.sa-mp.com/index.php?topic=78026.0