SA-MP Forums Archive
Stats 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 in Dialog (/showthread.php?tid=353085)



Stats in Dialog - kbalor - 22.06.2012

Anyone know how to change this to DIALOG_STYLE_MSGBOX?? im using LuxAdmin filterscript.



Quote:

#if USE_STATS == true
dcmd_stats(playerid,params[])
{
new string[128];
new pDeaths;
new player1, h, m, s;

if(!strlen(params)) player1 = playerid;
else player1 = strval(params);

if(IsPlayerConnected(player1))
{
TotalGameTime(player1, h, m, s);
if(AccInfo[player1][Deaths] == 0) pDeaths = 1;
else pDeaths = AccInfo[player1][Deaths];
format(string, sizeof(string), "|- %s's Statistics -|",PlayerName2(player1));
SendClientMessage(playerid, green, string);
format(string, sizeof(string), "Kills: [%d] | Deaths: [%d] | Ratio: [%0.2f] | Money: [$%d] | Time: [%d] hrs [%d] mins [%d] secs |", AccInfo[player1][Kills], AccInfo[player1][Deaths], Float:AccInfo[player1][Kills]/FloatDeaths,GetPlayerMoney(player1), h, m, s);
return SendClientMessage(playerid, green, string);
} else
return SendClientMessage(playerid, red, "ERROR: Player Not Connected!");
}
#endif




Re: Stats in Dialog - [MM]RoXoR[FS] - 22.06.2012

pawn Code:
dcmd_stats(playerid,params[])
{
new string[128];
new pDeaths;
new player1, h, m, s;

if(!strlen(params)) player1 = playerid;
else player1 = strval(params);

if(IsPlayerConnected(player1))
{
TotalGameTime(player1, h, m, s);
if(AccInfo[player1][Deaths] == 0) pDeaths = 1;
else pDeaths = AccInfo[player1][Deaths];
format(string, sizeof(string), "|- %s's Statistics -|",PlayerName2(player1));
new statstring[200];
format(statstring, sizeof(statstring), "Kills: [%d] \nDeaths: [%d] \nRatio: [%0.2f] \nMoney: [$%d] \nTime: [%d] hrs [%d] mins [%d] secs ", AccInfo[player1][Kills], AccInfo[player1][Deaths], Float:AccInfo[player1][Kills]/FloatDeaths,GetPlayerMoney(player1), h, m, s);
ShowPlayerDialog(playerid,9999,0,string,statstring,"OK","");
return 0;
} else
return SendClientMessage(playerid, red, "ERROR: Player Not Connected!");
}



Re: Stats in Dialog - kbalor - 22.06.2012

Quote:
Originally Posted by [MM]RoXoR[FS]
View Post
pawn Code:
dcmd_stats(playerid,params[])
{
new string[128];
new pDeaths;
new player1, h, m, s;

if(!strlen(params)) player1 = playerid;
else player1 = strval(params);

if(IsPlayerConnected(player1))
{
TotalGameTime(player1, h, m, s);
if(AccInfo[player1][Deaths] == 0) pDeaths = 1;
else pDeaths = AccInfo[player1][Deaths];
format(string, sizeof(string), "|- %s's Statistics -|",PlayerName2(player1));
new statstring[200];
format(statstring, sizeof(statstring), "Kills: [%d] \nDeaths: [%d] \nRatio: [%0.2f] \nMoney: [$%d] \nTime: [%d] hrs [%d] mins [%d] secs ", AccInfo[player1][Kills], AccInfo[player1][Deaths], Float:AccInfo[player1][Kills]/FloatDeaths,GetPlayerMoney(player1), h, m, s);
ShowPlayerDialog(playerid,9999,0,string,statstring,"OK","");
return 0;
} else
return SendClientMessage(playerid, red, "ERROR: Player Not Connected!");
}
thanks but it says

LuxAdmin.pwn(1506) : error 017: undefined symbol "FloatDeaths"
LuxAdmin.pwn(1503) : warning 204: symbol is assigned a value that is never used: "pDeaths"


Re: Stats in Dialog - [MM]RoXoR[FS] - 22.06.2012

I just copied your /stats code and inseted a dialog instead of SendClientMessage.
Was your code working fine earlier?

Here is fix, it was smiley BB Code causing error.

Edit this statement in your code.
pawn Code:
format(statstring, sizeof(statstring), "Kills: [%d] \nDeaths: [%d] \nRatio: [%0.2f] \nMoney: [$%d] \nTime: [%d] hrs [%d] mins [%d] secs ", AccInfo[player1][Kills], AccInfo[player1][Deaths], Float:AccInfo[player1][Kills]/Float : pDeaths,GetPlayerMoney(player1), h, m, s);



Re: Stats in Dialog - kbalor - 22.06.2012

Quote:
Originally Posted by [MM]RoXoR[FS]
View Post
I just copied your /stats code and inseted a dialog instead of SendClientMessage.
Was your code working fine earlier?

Here is fix, it was smiley BB Code causing error.

Edit this statement in your code.
pawn Code:
format(statstring, sizeof(statstring), "Kills: [%d] \nDeaths: [%d] \nRatio: [%0.2f] \nMoney: [$%d] \nTime: [%d] hrs [%d] mins [%d] secs ", AccInfo[player1][Kills], AccInfo[player1][Deaths], Float:AccInfo[player1][Kills]/Float : pDeaths,GetPlayerMoney(player1), h, m, s);
Yep its working fine no error after compiling.

anyway your code above gives me an error.

Quote:

D:\New Folder\Torreto Racing(1)\filterscripts\LuxAdmin.pwn(1506) : error 017: undefined symbol "Float"
D:\New Folder\LuxAdmin.pwn(1506) : error 029: invalid expression, assumed zero
D:\New Folder\LuxAdmin.pwn(1506) : warning 215: expression has no effect
D:\New Folder\LuxAdmin.pwn(1506) : warning 215: expression has no effect
D:\New Folder\LuxAdmin.pwn(1506) : warning 215: expression has no effect
D:\New Folder\LuxAdmin.pwn(1506) : warning 215: expression has no effect
D:\New Folder\LuxAdmin.pwn(1506) : error 001: expected token: ";", but found ")"
D:\New Folder\LuxAdmin.pwn(1506) : fatal error 107: too many error messages on one line




Re: Stats in Dialog - nilanjay - 22.06.2012

Try this
pawn Code:
format(statstring, sizeof(statstring), "Kills: [%d] \nDeaths: [%d] \nRatio: [%0.2f] \nMoney: [$%d] \nTime: [%d] hrs [%d] mins [%d] secs ", AccInfo[player1][Kills], AccInfo[player1][Deaths], Float:AccInfo[player1][Kills], Float:pDeaths,GetPlayerMoney(player1), h, m, s);



Re: Stats in Dialog - kbalor - 22.06.2012

Quote:
Originally Posted by nilanjay
View Post
Try this
pawn Code:
format(statstring, sizeof(statstring), "Kills: [%d] \nDeaths: [%d] \nRatio: [%0.2f] \nMoney: [$%d] \nTime: [%d] hrs [%d] mins [%d] secs ", AccInfo[player1][Kills], AccInfo[player1][Deaths], Float:AccInfo[player1][Kills], Float:pDeaths,GetPlayerMoney(player1), h, m, s);
thanks bro. its now working! +rep


Re: Stats in Dialog - kbalor - 22.06.2012

it teleports me to san fierro for no reason. whenever i spawn. i think there is the problem with this code

Quote:

dcmd_stats(playerid,params[])
{
new string[128];
new pDeaths;
new player1, h, m, s;

if(!strlen(params)) player1 = playerid;
else player1 = strval(params);

if(IsPlayerConnected(player1))
{
TotalGameTime(player1, h, m, s);
if(AccInfo[player1][Deaths] == 0) pDeaths = 1;
else pDeaths = AccInfo[player1][Deaths];
format(string, sizeof(string), "|- %s's Statistics -|",PlayerName2(player1));
new statstring[200];
format(statstring, sizeof(statstring), "Kills: [%d] \nDeaths: [%d] \nRatio: [%0.2f] \nMoney: [$%d] \nTime: [%d] hrs [%d] mins [%d] secs ", AccInfo[player1][Kills], AccInfo[player1][Deaths], Float:AccInfo[player1][Kills]/FloatDeaths,GetPlayerMoney(player1), h, m, s);
ShowPlayerDialog(playerid,9999,0,string,statstring ,"Close","");
return 0;
} else
return SendClientMessage(playerid, red, "ERROR: Player Not Connected!");
}




Re: Stats in Dialog - kbalor - 22.06.2012

Its not updating the time and money properly.


Quote:

dcmd_stats(playerid,params[])
{
new string[128];
new pDeaths;
new player1, h, m, s;

if(!strlen(params)) player1 = playerid;
else player1 = strval(params);

if(IsPlayerConnected(player1))
{
TotalGameTime(player1, h, m, s);
if(AccInfo[player1][Deaths] == 0) pDeaths = 1;
else pDeaths = AccInfo[player1][Deaths];
format(string, sizeof(string), "|- %s's Statistics -|",PlayerName2(player1));
new statstring[200];
format(statstring, sizeof(statstring), "Kills: [%d] \nDeaths: [%d] \nRatio: [%0.2f] \nMoney: [$%d] \nTime: [%d] hrs [%d] mins [%d] secs ", AccInfo[player1][Kills], AccInfo[player1][Deaths], Float:AccInfo[player1][Kills]/FloatDeaths,GetPlayerMoney(player1), h, m, s);
ShowPlayerDialog(playerid,9999,0,string,statstring ,"Close","");
return 0;
} else
return SendClientMessage(playerid, red, "ERROR: Player Not Connected!");
}




Re: Stats in Dialog - Emmet_ - 22.06.2012

Mixed dialog IDs. Try this:

pawn Code:
dcmd_stats(playerid,params[])
{
new string[128];
new pDeaths;
new player1, h, m, s;

if(!strlen(params)) player1 = playerid;
else player1 = strval(params);

if(IsPlayerConnected(player1))
{
TotalGameTime(player1, h, m, s);
if(AccInfo[player1][Deaths] == 0) pDeaths = 1;
else pDeaths = AccInfo[player1][Deaths];
format(string, sizeof(string), "|- %s's Statistics -|",PlayerName2(player1));
new statstring[200];
format(statstring, sizeof(statstring), "Kills: [%d] \nDeaths: [%d] \nRatio: [%0.2f] \nMoney: [$%d] \nTime: [%d] hrs [%d] mins [%d] secs ", AccInfo[player1][Kills], AccInfo[player1][Deaths], Float:AccInfo[player1][Kills]/FloatDeaths,GetPlayerMoney(player1), h, m, s);
ShowPlayerDialog(playerid,12767,string,statstring ,"Close","");
return 0;
} else
return SendClientMessage(playerid, red, "ERROR: Player Not Connected!");
}