Stats Command
#1

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

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:

https://sampwiki.blast.hk/wiki/GetPlayerMoney
https://sampwiki.blast.hk/wiki/GetPlayerState
https://sampwiki.blast.hk/wiki/GetPlayerArmour
https://sampwiki.blast.hk/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

https://sampwiki.blast.hk/wiki/format
https://sampwiki.blast.hk/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.
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)