last help for today - easy rep
#1

Hey, so I wanted to ask something.
if I have a line, and I'd like to add another "Text" to the line by a command. like
/givetrusted

and it will be added to stats as -

" Your stats ( Trusted Player ) "
and for the default it will show only " Your stats ".
Reply
#2

Quote:
Originally Posted by DemME
Посмотреть сообщение
Hey, so I wanted to ask something.
if I have a line, and I'd like to add another "Text" to the line by a command. like
/givetrusted

and it will be added to stats as -

" Your stats ( Trusted Player ) "
and for the default it will show only " Your stats ".
You didn't ask anything.
Reply
#3

Quote:
Originally Posted by iggy1
Посмотреть сообщение
You didn't ask anything.
I did, I asked how do I do that if I've an example of stats with the title "Your Stats"
how do I add to the line itself after the "your stats" it will add (Trusted player) or something like that by a command.

such as /trustplayer [id] and it will add to the Id that I typed a "Trusted player" to his "Your stats" line.
Reply
#4

First of all create something like pIsTrusted in the players enum then make that command to switch between the variable.

Now to the actual question, When showing the stats use strcat to stick two strings together.
Reply
#5

Quote:
Originally Posted by Ahmad45123
Посмотреть сообщение
First of all create something like pIsTrusted in the players enum then make that command to switch between the variable.

Now to the actual question, When showing the stats use strcat to stick two strings together.
Did not understand correctly the SAMP wiki, can you give me an example of yours for using strcat?
Reply
#6

PHP код:
#include <a_samp>
#include <sscanf2>
#include <zcmd>
enum pinfo
{
    
bool:pTrusted
}
new 
PlayerInfo[MAX_PLAYERS][pinfo];
// Loop
#define MaxLoop(%0) \
            
for(new %0_%GetPlayerPoolSize(); %<= _%0IsPlayerConnected(%0); %0++)
// Get Player name
stock pName(playerid)
{
    new 
PlayerName[MAX_PLAYERS][MAX_PLAYER_NAME];
    
GetPlayerName(playerid,PlayerName[playerid],MAX_PLAYER_NAME);
    new 
string[64];
    
format(string64"%s (%d)"PlayerName[playerid], playerid);
    return 
string;
}
CMD:trust(playeridparams[]) // Trust your desired id
{
    new 
id,str[250];
    if (
sscanf(params"u"id)) return SendClientMessage(playerid0xFF0000FF"- Error - USAGE: /Trust [ID]");
    if(!
IsPlayerConnected(id))return SendClientMessage(playerid0xFF0000FF"- Error - Player is not connected!");
    
PlayerInfo[id][pTrusted] = true;
    if(
id != playerid)
    
format(str,sizeof(str),"- Admin Action - Congrats you have been added in trusted list by Admin %s",pName(playerid));
    
SendClientMessage(id0x00FF00FFstr);
       
format(strsizeof(str), "- Admin Action - You have promoted %s to trusted member."pName(id));
       
SendClientMessage(playerid0x00FF00FFstr);
    return 
1;
}
CMD:trusted(playerid,params[]) // Check the trusted faggots
{
    new 
str[250];
    new 
itrust=0;
    
MaxLoop(x)
    {
        if(
IsPlayerConnected(x) &&     PlayerInfo[x][pTrusted] == true)
        {
               
SendClientMessage(playerid,0x8C8C8CFF,"Trusted Players List");
            
format(str,sizeof(str),"%s\n",pName(x));
            
SendClientMessage(playerid,0x8C8C8CFF,str);
            
itrust++;
        }
    }
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    
PlayerInfo[playerid][pTrusted] = false// put this line before mysql_tquery and mysql_format
    
return 1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    
PlayerInfo[playerid][pTrusted] = false// clear the boolean
    
return 1;
}
public 
OnPlayerText(playeridtext[])
{
    if(
text[0] == '!' && (strlen(text) > 1))
    {
           
strdel(text01);
           new 
str[144];
        
format(str,sizeof(str),"Trusted Chat: %s: %s",pName(playerid),text); // trusted maggots chat
        
MaxLoop(x)
        {
            if(
PlayerInfo[x][pTrusted] == true)
              {
                
SendClientMessage(x,0x1AFF00FF,str);
              }
           }
    }
    return 
0;

and if you want stats edited with trusted then send me the stats command
Reply
#7

Quote:
Originally Posted by gurmani11
Посмотреть сообщение
PHP код:
#include <a_samp>
#include <sscanf2>
#include <zcmd>
enum pinfo
{
    
bool:pTrusted
}
new 
PlayerInfo[MAX_PLAYERS][pinfo];
// Loop
#define MaxLoop(%0) \
            
for(new %0_%GetPlayerPoolSize(); %<= _%0IsPlayerConnected(%0); %0++)
// Get Player name
stock pName(playerid)
{
    new 
PlayerName[MAX_PLAYERS][MAX_PLAYER_NAME];
    
GetPlayerName(playerid,PlayerName[playerid],MAX_PLAYER_NAME);
    new 
string[64];
    
format(string64"%s (%d)"PlayerName[playerid], playerid);
    return 
string;
}
CMD:trust(playeridparams[]) // Trust your desired id
{
    new 
id,str[250];
    if (
sscanf(params"u"id)) return SendClientMessage(playerid0xFF0000FF"- Error - USAGE: /Trust [ID]");
    if(!
IsPlayerConnected(id))return SendClientMessage(playerid0xFF0000FF"- Error - Player is not connected!");
    
PlayerInfo[id][pTrusted] = true;
    if(
id != playerid)
    
format(str,sizeof(str),"- Admin Action - Congrats you have been added in trusted list by Admin %s",pName(playerid));
    
SendClientMessage(id0x00FF00FFstr);
       
format(strsizeof(str), "- Admin Action - You have promoted %s to trusted member."pName(id));
       
SendClientMessage(playerid0x00FF00FFstr);
    return 
1;
}
CMD:trusted(playerid,params[]) // Check the trusted faggots
{
    new 
str[250];
    new 
itrust=0;
    
MaxLoop(x)
    {
        if(
IsPlayerConnected(x) &&     PlayerInfo[x][pTrusted] == true)
        {
               
SendClientMessage(playerid,0x8C8C8CFF,"Trusted Players List");
            
format(str,sizeof(str),"%s\n",pName(x));
            
SendClientMessage(playerid,0x8C8C8CFF,str);
            
itrust++;
        }
    }
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    
PlayerInfo[playerid][pTrusted] = false// put this line before mysql_tquery and mysql_format
    
return 1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    
PlayerInfo[playerid][pTrusted] = false// clear the boolean
    
return 1;
}
public 
OnPlayerText(playeridtext[])
{
    if(
text[0] == '!' && (strlen(text) > 1))
    {
           
strdel(text01);
           new 
str[144];
        
format(str,sizeof(str),"Trusted Chat: %s: %s",pName(playerid),text); // trusted maggots chat
        
MaxLoop(x)
        {
            if(
PlayerInfo[x][pTrusted] == true)
              {
                
SendClientMessage(x,0x1AFF00FF,str);
              }
           }
    }
    return 
0;

and if you want stats edited with trusted then send me the stats command
These the the stats stock from South Central ( I just learn from this gamemode )

PHP код:
ShowStatsForPlayer(playeridtargetid)
{
    new
        
account[24],
        
origin[32],
        
string[128],
        
count;
    for (new 
0MAX_INVENTORY++) if (InventoryData[playerid][i][invExists]) {
        
count++;
    }
    if (
PlayerData[targetid][pAdmin] > 0account "Admin";
     else if (
PlayerData[targetid][pTester] > 0account "Tester";
    else 
account "Player";
    
format(origin32"%.16s"PlayerData[targetid][pOrigin]);
    if (
strlen(PlayerData[targetid][pOrigin]) > 16)
        
strcat(origin"...");
    
/*---------------------------------------------------------------------------------- pTrusted */
    
SendClientMessage(playeridCOLOR_NICEYELLOW"  Your Stats (XXXXXX)");
    
format(stringsizeof(string), "| Sex: %s | Birthdate: %s | Origin: %s | PayCheck: %d", (PlayerData[targetid][pGender] == 2) ? ("Female") : ("Male"), PlayerData[targetid][pBirthdate], origin,PlayerData[playerid][pMinutes]);
    
SendClientMessage(playeridCOLOR_NICEBLUEstring);
    
format(stringsizeof(string), "| Hours: %d | Job: %s | Inventory: %d/%d | Ping: %d | Hunger: %d% | Thirst: %d%"PlayerData[targetid][pPlayingHours], Job_GetName(PlayerData[targetid][pJob]), countMAX_INVENTORYGetPlayerPing(targetid),PlayerData[playerid][pHunger], PlayerData[playerid][pThirst]);
    
SendClientMessage(playeridCOLOR_NICEBLUEstring);
    
format(stringsizeof(string), "| Money: %s | Bank: %s | Savings: %s | Packet Loss: %.1f%%"FormatNumber(PlayerData[targetid][pMoney]), FormatNumber(PlayerData[targetid][pBankMoney]), FormatNumber(PlayerData[targetid][pSavings]), NetStats_PacketLossPercent(targetid));
    
SendClientMessage(playeridCOLOR_NICEBLUEstring);
    
format(stringsizeof(string), "| Account: %s | Tester: %s | Admin: %s"account, (PlayerData[targetid][pTester]) ? ("Yes") : ("No"), (PlayerData[targetid][pAdmin]) ? ("Yes") : ("No"));
    
SendClientMessage(playeridCOLOR_NICEBLUEstring);
    
/*if (!PlayerData[playerid][pDisplayStats])
    {
        if (targetid != playerid)
        {
            for (new i = 40; i < 50; i ++) if (i != 47 && i != 48) {
                PlayerTextDrawShow(playerid, PlayerData[playerid][pTextdraws][i]);
            }
        }
        else for (new i = 40; i < 50; i ++) {
            PlayerTextDrawShow(playerid, PlayerData[playerid][pTextdraws][i]);
        }
        SelectTextDraw(playerid, -1);
        PlayerData[playerid][pDisplayStats] = true;
    }
    else
    {
        if (PlayerData[playerid][pDisplayStats] == 2) {
            for (new i = 50; i < 58; i ++) PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][i]);
        }
        else for (new i = 40; i < 50; i ++) {
            PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][i]);
        }
        CancelSelectTextDraw(playerid);
        PlayerData[playerid][pDisplayStats] = false;*/
//    }
    
return 1;

Reply
#8

PHP код:
ShowStatsForPlayer(playeridtargetid)
{
    new
        
account[24],
        
origin[32],
        
string[128],
        
count;

    for (new 
0MAX_INVENTORY++) if (InventoryData[playerid][i][invExists]) {
        
count++;
    }
    if (
PlayerData[targetid][pAdmin] > 0account "Admin";
     else if (
PlayerData[targetid][pTester] > 0account "Tester";
     else if (
PlayerData[targetid][pTrusted] == trueaccount "Trusted Player"// i added this
    
else account "Player";

    
format(origin32"%.16s"PlayerData[targetid][pOrigin]);

    if (
strlen(PlayerData[targetid][pOrigin]) > 16)
        
strcat(origin"...");
    
/*---------------------------------------------------------------------------------- pTrusted */
    
SendClientMessage(playeridCOLOR_NICEYELLOW"  Your Stats (XXXXXX)");
    
format(stringsizeof(string), "| Sex: %s | Birthdate: %s | Origin: %s | PayCheck: %d", (PlayerData[targetid][pGender] == 2) ? ("Female") : ("Male"), PlayerData[targetid][pBirthdate], origin,PlayerData[playerid][pMinutes]);
    
SendClientMessage(playeridCOLOR_NICEBLUEstring);
    
format(stringsizeof(string), "| Hours: %d | Job: %s | Inventory: %d/%d | Ping: %d | Hunger: %d% | Thirst: %d%"PlayerData[targetid][pPlayingHours], Job_GetName(PlayerData[targetid][pJob]), countMAX_INVENTORYGetPlayerPing(targetid),PlayerData[playerid][pHunger], PlayerData[playerid][pThirst]);
    
SendClientMessage(playeridCOLOR_NICEBLUEstring);

    
format(stringsizeof(string), "| Money: %s | Bank: %s | Savings: %s | Packet Loss: %.1f%%"FormatNumber(PlayerData[targetid][pMoney]), FormatNumber(PlayerData[targetid][pBankMoney]), FormatNumber(PlayerData[targetid][pSavings]), NetStats_PacketLossPercent(targetid));
    
SendClientMessage(playeridCOLOR_NICEBLUEstring);

    
format(stringsizeof(string), "| Account: %s | Tester: %s | Admin: %s"account, (PlayerData[targetid][pTester]) ? ("Yes") : ("No"), (PlayerData[targetid][pAdmin]) ? ("Yes") : ("No"));
    
SendClientMessage(playeridCOLOR_NICEBLUEstring);

    
/*if (!PlayerData[playerid][pDisplayStats])
    {
        if (targetid != playerid)
        {
            for (new i = 40; i < 50; i ++) if (i != 47 && i != 48) {
                PlayerTextDrawShow(playerid, PlayerData[playerid][pTextdraws][i]);
            }
        }
        else for (new i = 40; i < 50; i ++) {
            PlayerTextDrawShow(playerid, PlayerData[playerid][pTextdraws][i]);
        }
        SelectTextDraw(playerid, -1);
        PlayerData[playerid][pDisplayStats] = true;
    }
    else
    {
        if (PlayerData[playerid][pDisplayStats] == 2) {
            for (new i = 50; i < 58; i ++) PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][i]);
        }
        else for (new i = 40; i < 50; i ++) {
            PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][i]);
        }
        CancelSelectTextDraw(playerid);
        PlayerData[playerid][pDisplayStats] = false;*/
//    }
    
return 1;

Reply
#9

Quote:
Originally Posted by gurmani11
Посмотреть сообщение
PHP код:
ShowStatsForPlayer(playeridtargetid)
{
    new
        
account[24],
        
origin[32],
        
string[128],
        
count;
    for (new 
0MAX_INVENTORY++) if (InventoryData[playerid][i][invExists]) {
        
count++;
    }
    if (
PlayerData[targetid][pAdmin] > 0account "Admin";
     else if (
PlayerData[targetid][pTester] > 0account "Tester";
     else if (
PlayerData[targetid][pTrusted] == trueaccount "Trusted Player"// i added this
    
else account "Player";
    
format(origin32"%.16s"PlayerData[targetid][pOrigin]);
    if (
strlen(PlayerData[targetid][pOrigin]) > 16)
        
strcat(origin"...");
    
/*---------------------------------------------------------------------------------- pTrusted */
    
SendClientMessage(playeridCOLOR_NICEYELLOW"  Your Stats (XXXXXX)");
    
format(stringsizeof(string), "| Sex: %s | Birthdate: %s | Origin: %s | PayCheck: %d", (PlayerData[targetid][pGender] == 2) ? ("Female") : ("Male"), PlayerData[targetid][pBirthdate], origin,PlayerData[playerid][pMinutes]);
    
SendClientMessage(playeridCOLOR_NICEBLUEstring);
    
format(stringsizeof(string), "| Hours: %d | Job: %s | Inventory: %d/%d | Ping: %d | Hunger: %d% | Thirst: %d%"PlayerData[targetid][pPlayingHours], Job_GetName(PlayerData[targetid][pJob]), countMAX_INVENTORYGetPlayerPing(targetid),PlayerData[playerid][pHunger], PlayerData[playerid][pThirst]);
    
SendClientMessage(playeridCOLOR_NICEBLUEstring);
    
format(stringsizeof(string), "| Money: %s | Bank: %s | Savings: %s | Packet Loss: %.1f%%"FormatNumber(PlayerData[targetid][pMoney]), FormatNumber(PlayerData[targetid][pBankMoney]), FormatNumber(PlayerData[targetid][pSavings]), NetStats_PacketLossPercent(targetid));
    
SendClientMessage(playeridCOLOR_NICEBLUEstring);
    
format(stringsizeof(string), "| Account: %s | Tester: %s | Admin: %s"account, (PlayerData[targetid][pTester]) ? ("Yes") : ("No"), (PlayerData[targetid][pAdmin]) ? ("Yes") : ("No"));
    
SendClientMessage(playeridCOLOR_NICEBLUEstring);
    
/*if (!PlayerData[playerid][pDisplayStats])
    {
        if (targetid != playerid)
        {
            for (new i = 40; i < 50; i ++) if (i != 47 && i != 48) {
                PlayerTextDrawShow(playerid, PlayerData[playerid][pTextdraws][i]);
            }
        }
        else for (new i = 40; i < 50; i ++) {
            PlayerTextDrawShow(playerid, PlayerData[playerid][pTextdraws][i]);
        }
        SelectTextDraw(playerid, -1);
        PlayerData[playerid][pDisplayStats] = true;
    }
    else
    {
        if (PlayerData[playerid][pDisplayStats] == 2) {
            for (new i = 50; i < 58; i ++) PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][i]);
        }
        else for (new i = 40; i < 50; i ++) {
            PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][i]);
        }
        CancelSelectTextDraw(playerid);
        PlayerData[playerid][pDisplayStats] = false;*/
//    }
    
return 1;

And how do I show if the player is "Player" in (XXXXXX) or "Trusted".
I tried to do like this
PHP код:
    format(stringsizeof(string), "   Your Stats (Status: %s)"PlayerData[targetid][pTrusted]);
    
SendClientMessage(playeridCOLOR_NICEYELLOWstring); 
But in the game, it shows me nothing instead of blank space and when I do /trust [id] it changed to "N"
Reply
#10

There:

PHP код:
//REST OF CODE

new string[25] = "Player Stats"//Or you can use format or strcpy.

if(PlayerInfo[targetid][pTrusted])
    
strcat(string" [TRUSTED]");
    
//CONTINUE /stats CODE HERE. 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)