Stats in Dialog
#1

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

Reply
#2

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!");
}
Reply
#3

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"
Reply
#4

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);
Reply
#5

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

Reply
#6

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);
Reply
#7

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
Reply
#8

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!");
}

Reply
#9

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!");
}

Reply
#10

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!");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)