/stats for this Script
#1

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

What /stats do ? what you wanna show for the player explain more please.
Reply
#3

Quote:
Originally Posted by *Enrique
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


Reply
#4

Put this under the "Forward"'s you have in your script.
pawn Код:
forward ShowStats(playerid,targetid);
Put this under "Onplayercommandtext"
pawn Код:
//______________________________________________________________________________
//                /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.
pawn Код:
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...
Reply
#5

Quote:
Originally Posted by Wasim_Cortez
Put this under the "Forward"'s you have in your script.
pawn Код:
forward ShowStats(playerid,targetid);
Put this under "Onplayercommandtext"
pawn Код:
//______________________________________________________________________________
//                /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.
pawn Код:
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);?
Reply
#6

pawn Код:
//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);
Reply
#7

Quote:
Originally Posted by Wasim_Cortez
Put this under the "Forward"'s you have in your script.
pawn Код:
forward ShowStats(playerid,targetid);
Put this under "Onplayercommandtext"
pawn Код:
//______________________________________________________________________________
//                /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.
pawn Код:
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
Quote:

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

Reply
#8

Change his variables to yours.. use common sense.
Reply
#9

Quote:
Originally Posted by Conroy
Change his variables to yours.. use common sense.
But what is gLogged?
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)