PDA

View Full Version : /stats for this Script


Ihsan_Cingisiz
30/05/2010, 11:18 AM
Hello,
I downloaded a Dialog Register/Login script,
don't know where. But i want to add /stats
to it, but i don't know how, who can add
Of say so me how to do it?
Here is the download :

http://www.megaupload.com/?d=JMTL4K26

Thank you

johnnyc
30/05/2010, 11:23 AM
What /stats do ? what you wanna show for the player explain more please.

Ihsan_Cingisiz
30/05/2010, 11:26 AM
What /stats do ? what you wanna show for the player explain more please.


I want to show by stats, money, kills, deaths, it creates a .ini
and i want to show all the thing that you can see in the .ini
if you do /stats

ini. :

Score=0
Money=0
Deaths=0
Kills=6
ServerTime=473

Wasim_Cortez
30/05/2010, 12:09 PM
Put this under the "Forward"'s you have in your script.

forward ShowStats(playerid,targetid);


Put this under "Onplayercommandtext"

//__________________________________________________ ____________________________
// /Stats
if (strcmp(cmd, "/stats", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (gPlayerLogged[playerid] != 0)
{
ShowStats(playerid,playerid);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "[STATS] You need to Login to use this Command.");
}
}
return 1;
}


Then put this anywhere in your gamemode, I have it near the bottem.

public ShowStats(playerid,targetid)
{
if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
{
new Cash = GetPlayerMoney(targetid);
new Deaths = PlayerInfo[targetid][pDeaths];
new Kills = PlayerInfo[targetid][pKills];
new pName[MAX_PLAYER_NAME];
new ptime = PlayerInfo[targetid][pConnectTime];
GetPlayerName(targetid, pName, sizeof(pName));
new Float:pX,Float:pY,Float:pZ;
GetPlayerPos(targetid, pX,pY,pZ);
new CoordString[256];
SendClientMessage(playerid, COLOR_GREEN,"__________________________________________________ ______________");
// In here add the stats you want to show!!
SendClientMessage(playerid, COLOR_GREEN,"__________________________________________________ ______________");
}
}


There you go, Just remember to add the stats you want where it says it in the script...

Ihsan_Cingisiz
30/05/2010, 12:21 PM
Put this under the "Forward"'s you have in your script.

forward ShowStats(playerid,targetid);


Put this under "Onplayercommandtext"

//__________________________________________________ ____________________________
// /Stats
if (strcmp(cmd, "/stats", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (gPlayerLogged[playerid] != 0)
{
ShowStats(playerid,playerid);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "[STATS] You need to Login to use this Command.");
}
}
return 1;
}


Then put this anywhere in your gamemode, I have it near the bottem.

public ShowStats(playerid,targetid)
{
if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
{
new Cash = GetPlayerMoney(targetid);
new Deaths = PlayerInfo[targetid][pDeaths];
new Kills = PlayerInfo[targetid][pKills];
new pName[MAX_PLAYER_NAME];
new ptime = PlayerInfo[targetid][pConnectTime];
GetPlayerName(targetid, pName, sizeof(pName));
new Float:pX,Float:pY,Float:pZ;
GetPlayerPos(targetid, pX,pY,pZ);
new CoordString[256];
SendClientMessage(playerid, COLOR_GREEN,"__________________________________________________ ______________");
// In here add the stats you want to show!!
SendClientMessage(playerid, COLOR_GREEN,"__________________________________________________ ______________");
}
}


There you go, Just remember to add the stats you want where it says it in the script...


How do i add then.. :-[
// In here add the stats you want to show!! <--- Don't now how to add..
Just SendClientMessage(playerid, COLOR_WHITE, cash);?

Conroy
30/05/2010, 12:52 PM
//Add this in Ihsan_Cingisiz's comment
new message[128];
format(message, sizeof(message), "Score: %i, Money: $%i, Deaths: %i, Kills: %i, Gameplay time: %i", GetPlayerScore(playerid), Cash, Deaths, Kills, ptime);
SendClientMessage(playerid, COLOR_WHITE, message);

Ihsan_Cingisiz
30/05/2010, 03:02 PM
Put this under the "Forward"'s you have in your script.

forward ShowStats(playerid,targetid);


Put this under "Onplayercommandtext"

//__________________________________________________ ____________________________
// /Stats
if (strcmp(cmd, "/stats", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (gPlayerLogged[playerid] != 0)
{
ShowStats(playerid,playerid);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "[STATS] You need to Login to use this Command.");
}
}
return 1;
}


Then put this anywhere in your gamemode, I have it near the bottem.

public ShowStats(playerid,targetid)
{
if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
{
new Cash = GetPlayerMoney(targetid);
new Deaths = PlayerInfo[targetid][pDeaths];
new Kills = PlayerInfo[targetid][pKills];
new pName[MAX_PLAYER_NAME];
new ptime = PlayerInfo[targetid][pConnectTime];
GetPlayerName(targetid, pName, sizeof(pName));
new Float:pX,Float:pY,Float:pZ;
GetPlayerPos(targetid, pX,pY,pZ);
new CoordString[256];
SendClientMessage(playerid, COLOR_GREEN,"__________________________________________________ ______________");
// In here add the stats you want to show!!
SendClientMessage(playerid, COLOR_GREEN,"__________________________________________________ ______________");
}
}


There you go, Just remember to add the stats you want where it says it in the script...


I get

C:\Users\Ihsan\Desktop\SA-MP Server\gamemodes\[GM]Navi-RP.pwn(175) : error 017: undefined symbol "gPlayerLogged"
C:\Users\Ihsan\Desktop\SA-MP Server\gamemodes\[GM]Navi-RP.pwn(175) : warning 215: expression has no effect
C:\Users\Ihsan\Desktop\SA-MP Server\gamemodes\[GM]Navi-RP.pwn(175) : error 001: expected token: ";", but found "]"
C:\Users\Ihsan\Desktop\SA-MP Server\gamemodes\[GM]Navi-RP.pwn(175) : error 029: invalid expression, assumed zero
C:\Users\Ihsan\Desktop\SA-MP Server\gamemodes\[GM]Navi-RP.pwn(175) : fatal error 107: too many error messages on one line

Conroy
30/05/2010, 03:03 PM
Change his variables to yours.. use common sense.

Ihsan_Cingisiz
30/05/2010, 03:08 PM
Change his variables to yours.. use common sense.

But what is gLogged?

Conroy
30/05/2010, 03:11 PM
If the player has used /login it sets a variable to 1 to prevent users from using commands while not logged in. It can also be used to force players to login before spawn.

Ihsan_Cingisiz
30/05/2010, 03:40 PM
If the player has used /login it sets a variable to 1 to prevent users from using commands while not logged in. It can also be used to force players to login before spawn.


Do i need a include or define, stil lgetting errors

Conroy
30/05/2010, 04:48 PM
As I said, rename your variables. The reason you're getting errors about ']' is because you have not declared that variable.. do you have any sort of saving system?

Kostas'
25/09/2011, 01:39 PM
I got these

C:\Documents and Settings\orion\Τα έγγραφά μου\Τα έγγραφά μου\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(3743) : error 017: undefined symbol "cmd"
C:\Documents and Settings\orion\Τα έγγραφά μου\Τα έγγραφά μου\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(3747) : error 017: undefined symbol "gPlayerLogged"
C:\Documents and Settings\orion\Τα έγγραφά μου\Τα έγγραφά μου\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(3747) : warning 215: expression has no effect
C:\Documents and Settings\orion\Τα έγγραφά μου\Τα έγγραφά μου\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(3747) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\orion\Τα έγγραφά μου\Τα έγγραφά μου\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(3747) : error 029: invalid expression, assumed zero
C:\Documents and Settings\orion\Τα έγγραφά μου\Τα έγγραφά μου\XtreameGaming Gamemode\gamemodes\Xtreamgaming.pwn(3747) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.
I am begginer how change the variables?

rumen98
07/03/2012, 06:46 AM
Thank this help me :)