SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 11/08/2011, 08:48 AM   #1
IvancheBG
Huge Clucker
 
Join Date: Jan 2011
Location: Bulgaria,Sofia
Posts: 343
Reputation: 10
Default Stats Command

Hi I want to make a Stats Command to see deaths ,cash ,kills ,How wong he plays in the server ,Is He In Vehicles or on foot , Whats his armour and health, What Admin Level Is He , Whats His KillingSpree and thats all...!!! How to to That.!!!
IvancheBG is offline  
Old 11/08/2011, 09:03 AM   #2
Grim_
High-roller
 
Grim_'s Avatar
 
Join Date: Sep 2008
Location: United States
Posts: 2,862
Reputation: 118
Default Re: Stats Command

Most of the things you are wanting depends on how, and if, your server already updates those pieces of information. However, for the cash, whether or not they're on foot, armor and health, look at the following functions:

http://wiki.sa-mp.com/wiki/GetPlayerMoney
http://wiki.sa-mp.com/wiki/GetPlayerState
http://wiki.sa-mp.com/wiki/GetPlayerArmour
http://wiki.sa-mp.com/wiki/GetPlayerHealth

You will need to gather your desired information and format it into a string, which you then send to the player. For that, you'll need the format and SendClientMessage functions

http://wiki.sa-mp.com/wiki/format
http://wiki.sa-mp.com/wiki/SendClientMessage

Note that this is not the place to be requesting scripts, but to gain guidance on how to achieve, and or, help with one. If you have no scripting experience and want someone to create the command for you, refer to the Script Request Thread, which is stickied, on this board.
Grim_ is offline  
Old 11/08/2011, 09:07 AM   #3
Darnell
Gangsta
 
Darnell's Avatar
 
Join Date: Jul 2010
Posts: 824
Reputation: 35
Default Re: Stats Command

Start of with making the CMD it self...
pawn Code:
CMD:stats(playerid, params[])
{
               new name[MAX_PLAYER_NAME];
        GetPlayerName(targetid, name, sizeof(name));
        GiveNameSpace(name);
        new coordsstring[256];
        format(coordsstring, sizeof(coordsstring),"____________________| %s |____________________",name);
        SendClientMessage(playerid, COLOR_YELLOW5,coordsstring);
        format(coordsstring, sizeof(coordsstring), "[Account]: Level:[%d] DonateRank:[%s] Respect:[%d/%d] Age:[%d] Cash:[$%d] Bank:[$%d]", level,drank,exp,expamount,age,cash, account);
        SendClientMessage(playerid, COLOR_LIGHTYELLOW5,coordsstring);
        format(coordsstring, sizeof(coordsstring), "[General]: PlayingHours:[%d] AdminLevel:[%d] Job:[%s] WalkieFreq:[%d]",ptime,adminlevel,jtext,freq);
        SendClientMessage(playerid, COLOR_LIGHTYELLOW5,coordsstring);
        if(PlayerInfo[targetid][pArrested] > 0)
        {
            format(coordsstring, sizeof(coordsstring), "[Criminal Record]: CrimesCommited:[%d] TimesArrested:[%d]", crimes,arrests);
            SendClientMessage(playerid, COLOR_LIGHTYELLOW5,coordsstring);
        }
        if(PlayerInfo[playerid][pCellphone] == 0)
        {
            format(coordsstring, sizeof(coordsstring), "[Other]: Drugs:[%d] Materials:[%d] Sex:[%s] MarriedTo:[%s]",drugs,mats,atext,married);
            SendClientMessage(playerid, COLOR_LIGHTYELLOW5,coordsstring);
        }
        else if(PlayerInfo[playerid][pCellphone] == 1)
        {
            format(coordsstring, sizeof(coordsstring), "[Other]: Drugs:[%d] Materials:[%d] Sex:[%s] MarriedTo:[%s] Ph:[%d] Phtime:[%d]",drugs,mats,atext,married,pnumber,numtime);
            SendClientMessage(playerid, COLOR_LIGHTYELLOW5,coordsstring);
        }
        if(PlayerInfo[targetid][pMember] <= 6)
        {
            format(coordsstring, sizeof(coordsstring), "[Faction]: Faction:[%s] Rank:[%s][%d]",ftext,rtext,rank);
            SendClientMessage(playerid, COLOR_LIGHTYELLOW5,coordsstring);
        }
        else if(PlayerInfo[targetid][pMember] >= 7)
        {
            if(PlayerInfo[targetid][pRank] == 0)
            {
                format(coordsstring, sizeof(coordsstring), "[Faction]: Faction:[%s] Rank:[Outsider][0]",FamilyInfo[fam][FamilyName]);
                SendClientMessage(playerid, COLOR_LIGHTYELLOW5,coordsstring);
            }
            else if(PlayerInfo[targetid][pRank] == 1)
            {
                format(coordsstring, sizeof(coordsstring), "[Faction]: Faction:[%s] Rank:[%s][1]",FamilyInfo[fam][FamilyName],FamilyInfo[fam][FamilyRank1]);
                SendClientMessage(playerid, COLOR_LIGHTYELLOW5,coordsstring);
            }
            else if(PlayerInfo[targetid][pRank] == 2)
            {
                format(coordsstring, sizeof(coordsstring), "[Faction]: Faction:[%s] Rank:[%s][2]",FamilyInfo[fam][FamilyName],FamilyInfo[fam][FamilyRank2]);
                SendClientMessage(playerid, COLOR_LIGHTYELLOW5,coordsstring);
            }
            else if(PlayerInfo[targetid][pRank] == 3)
            {
                format(coordsstring, sizeof(coordsstring), "[Faction]: Faction:[%s] Rank:[%s][3]",FamilyInfo[fam][FamilyName],FamilyInfo[fam][FamilyRank3]);
                SendClientMessage(playerid, COLOR_LIGHTYELLOW5,coordsstring);
            }
            else if(PlayerInfo[targetid][pRank] == 4)
            {
                format(coordsstring, sizeof(coordsstring), "[Faction]: Faction:[%s] Rank:[%s][4]",FamilyInfo[fam][FamilyName],FamilyInfo[fam][FamilyRank4]);
                SendClientMessage(playerid, COLOR_LIGHTYELLOW5,coordsstring);
            }
            else if(PlayerInfo[targetid][pRank] == 5)
            {
                format(coordsstring, sizeof(coordsstring), "[Faction]: Faction:[%s] Rank:[%s][5]",FamilyInfo[fam][FamilyName],FamilyInfo[fam][FamilyRank5]);
                SendClientMessage(playerid, COLOR_LIGHTYELLOW5,coordsstring);
            }
            else if(PlayerInfo[targetid][pRank] == 6)
            {
                format(coordsstring, sizeof(coordsstring), "[Faction]: Faction:[%s] Rank:[%s][6]",FamilyInfo[fam][FamilyName],FamilyInfo[fam][FamilyRank6]);
                SendClientMessage(playerid, COLOR_LIGHTYELLOW5,coordsstring);
            }
        }
        GetPlayerName(targetid, name, sizeof(name));
        if(housekey != 255 && strcmp(name, HouseInfo[housekey][hOwner], true) == 0)
        {
            format(coordsstring, sizeof(coordsstring), "[Property]: Description:[%s] Value:[%d] Locked:[%d] Rentable:[%d] Rent:[$%d] Objects:[%d]",HouseInfo[housekey][hDiscription],HouseInfo[housekey][hValue],HouseInfo[housekey][hLock],HouseInfo[housekey][hRentabil],HouseInfo[housekey][hRent],HouseInfo[housekey][hOTaken]);
            SendClientMessage(playerid, COLOR_LIGHTYELLOW5,coordsstring);
        }
        if (PlayerInfo[targetid][pCarkey] != SCRIPT_CARS)
        {
            format(coordsstring, sizeof(coordsstring), "[Vehicle]: 1| VehModel:[%s] VehValue:[%d] VehColor1:[%d] VehColor2:[%d] VehLocked:[%d] Impounded:[%d] ImpoundPrice:[%d]", CarInfo[carkey][cDescription], CarInfo[carkey][cValue], CarInfo[carkey][cColorOne], CarInfo[carkey][cColorTwo], CarInfo[carkey][cLock],CarInfo[carkey][cImpounded],CarInfo[carkey][cImpoundedPrice]);
            SendClientMessage(playerid, COLOR_LIGHTYELLOW5,coordsstring);
        }
        if (PlayerInfo[targetid][pCarkey2] != SCRIPT_CARS)
        {
            format(coordsstring, sizeof(coordsstring), "[Vehicle]: 2| VehModel:[%s] VehValue:[%d] VehColor1:[%d] VehColor2:[%d] VehLocked:[%d] Impounded:[%d] ImpoundPrice:[%d]", CarInfo[carkey2][cDescription], CarInfo[carkey2][cValue], CarInfo[carkey2][cColorOne], CarInfo[carkey2][cColorTwo], CarInfo[carkey2][cLock],CarInfo[carkey2][cImpounded],CarInfo[carkey2][cImpoundedPrice]);
            SendClientMessage(playerid, COLOR_LIGHTYELLOW5,coordsstring);
        }
        if (PlayerInfo[targetid][pCarkey3] != SCRIPT_CARS)
        {
            format(coordsstring, sizeof(coordsstring), "[Vehicle]: 3| VehModel:[%s] VehValue:[%d] VehColor1:[%d] VehColor2:[%d] VehLocked:[%d] Impounded:[%d] ImpoundPrice:[%d]", CarInfo[carkey3][cDescription], CarInfo[carkey3][cValue], CarInfo[carkey3][cColorOne], CarInfo[carkey3][cColorTwo], CarInfo[carkey3][cLock],CarInfo[carkey3][cImpounded],CarInfo[carkey3][cImpoundedPrice]);
            SendClientMessage(playerid, COLOR_LIGHTYELLOW5,coordsstring);
        }
        if (PlayerInfo[playerid][pAdmin] >= 1)
        {
            format(coordsstring, sizeof(coordsstring), "[Admin]: House key [%d] Business key [%d] Veh1[%d](ID:%d) Veh2[%d](ID:%d) Veh3[%d](ID:%d) HireKey [%d] int:[%d] virworld:[%d] local[%d]", housekey,bizkey,carkey,ForwardOwnCarID(1,targetid),carkey2,ForwardOwnCarID(2,targetid),carkey3,ForwardOwnCarID(3,targetid),HireCar[targetid],intir,virworld,local);
            SendClientMessage(playerid, COLOR_LIGHTYELLOW5,coordsstring);
        }
        SendClientMessage(playerid, COLOR_YELLOW5,"___________________________________________________________");
    }
}

forward SendAdApprovalMessage(member, color, string[]);
public SendAdApprovalMessage(member, color, string[])
{
    foreach (Player,i)
    {
        if(gPlayerLogged[i] == 1)
        {
            if(PlayerInfo[i][pAdmin] > 0 || PlayerInfo[i][pHelper] == 1)
            {
                SendClientMessage(i, color, string);
            }
        }
    }
}
Edit it to your server prefences.
Darnell is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/stats command vent Help Archive 11 11/08/2011 09:16 AM
Stats Command warnings aqu Help Archive 1 14/03/2011 05:37 PM
Ideas for /stats command? DarrenReeder Help Archive 8 30/12/2010 09:00 PM
/stats command Jonni8 Help Archive 7 06/06/2010 09:21 PM
[HELP] /stats command crashes me [HELP] gtalover12 Help Archive 1 20/02/2009 02:57 PM


All times are GMT. The time now is 01:38 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.