Don't save clan tag MySqL
#1

Hello everyone, i'm trying to save in faction_logs table this text %s was uninvited by Admin %s from faction %s (rank %d) after %d days, without FP. Reason: %s. but if the player is in a clan and has set ClanTag to 1 or 2 (clantag = 1: [TAG]Name clantag = 2: Name[TAG], is there a way, to save only player name without tag?

PlayerInfo[id][pClanTag] = 0; No Tag
PlayerInfo[id][pClanTag] = 1; [TAG]Name
PlayerInfo[id][pClanTag] = 2; Name[TAG]

PHP код:
CMD:fpk(playeridparams[])
{
    if(
gPlayerLogged[playerid] == 0) return SendClientMessage(playeridCOLOR_LIGHTRED"You need to login first.");
    if (
PlayerInfo[playerid][pAdmin] >= 6)
    {
        new 
id,string[256],giveplayer[30],sendername[MAX_PLAYER_NAME],reason[64],fpunish;
        if(
sscanf(params"uds[64]"idfpunishreason)) return SCM(playerid,COLOR_WHITE,"{FF9900}Syntax: {FFFFFF}/fpk <Name/Playerid> <FPunish> <Reason>");
         
GetPlayerName(idgiveplayersizeof(giveplayer));
        
GetPlayerName(playeridsendernamesizeof(sendername));
        if(
IsPlayerConnected(id))
        {
            if(
id != INVALID_PLAYER_ID)
            {
                new 
string2[500],query[500];
                if(
fpunish 0)
                {
                    
format(stringsizeof(string), "Ai fost demis de Admin %s din factiunea din care faceai parte %s (rank %d) dupa %d zile, cu %d FP. Motiv: %s.",sendername,NumeFactiune(PlayerInfo[id][pMember]),PlayerInfo[id][pRank],PlayerInfo[id][pFactionTime],fpunish,reason);
                    
mysql_format(SQLquerysizeof(query), "INSERT INTO `emails` (`playerid`,`Message`) VALUES('%d','%s')",PlayerInfo[id][pSQLID],string);
                    
mysql_tquery(SQL,query,"","");
                    
format(stringsizeof(string), "%s A fost demis de Admin %s din factiunea din care faceai parte %s (rank %d) dupa %d days, cu %d FP. Motiv: %s.",giveplayer,sendername,NumeFactiune(PlayerInfo[id][pMember]),PlayerInfo[id][pRank],PlayerInfo[id][pFactionTime],fpunish,reason);
                    
ABroadCast(COLOR_LIGHTRED,string,1);
                    
format(string2sizeof(string2), "%s was uninvited by Admin %s from faction %s (rank %d) after %d days, without FP. Reason: %s."giveplayer,sendername,DynamicFactions[PlayerInfo[id][pMember]][fName],PlayerInfo[id][pRank],PlayerInfo[id][pFactionTime],reason);
                    
mysql_format(SQLquerysizeof(query), "INSERT INTO faction_logs (`text`,`player`,`leader`) VALUES ('%s','%d','%d')"string2PlayerInfo[id][pSQLID], PlayerInfo[playerid][pSQLID]);
                    
mysql_tquery(SQL,query,"","");
                    
PlayerInfo[id][pFpunish] = fpunish;
                }
                else if(
fpunish 1)
                {
                    
format(stringsizeof(string), "Ai fost demis de Admin %s din factiunea din care faceai parte %s (rank %d) dupa %d zile, fara FP. Motiv: %s.",sendername,NumeFactiune(PlayerInfo[id][pMember]),PlayerInfo[id][pRank],PlayerInfo[id][pFactionTime],reason);
                    
mysql_format(SQLquerysizeof(query), "INSERT INTO `emails` (`playerid`,`Message`) VALUES('%d','%s')",PlayerInfo[id][pSQLID],string);
                    
mysql_tquery(SQL,query,"","");
                    
format(stringsizeof(string), "%s A fost demis de Admin %s din factiunea din care facea parte %s (rank %d) dupa %d days, fara FP. Motiv: %s.",giveplayer,sendername,NumeFactiune(PlayerInfo[id][pMember]),PlayerInfo[id][pRank],PlayerInfo[id][pFactionTime],reason);
                    
ABroadCast(COLOR_LIGHTRED,string,1);
                    
format(string2sizeof(string2), "%s was uninvited by Admin %s from faction %s (rank %d) after %d days, without FP. Reason: %s."giveplayer,sendername,DynamicFactions[PlayerInfo[id][pMember]][fName],PlayerInfo[id][pRank],PlayerInfo[id][pFactionTime],reason);
                    
mysql_format(SQLquerysizeof(query), "INSERT INTO faction_logs (`text`,`player`,`leader`) VALUES ('%s','%d','%d')"string2PlayerInfo[id][pSQLID], PlayerInfo[playerid][pSQLID]);
                    
mysql_tquery(SQL,query,"","");
                    
PlayerInfo[id][pFpunish] = 0;
                }
                
PlayerInfo[id][pMember] = 0;
                
PlayerInfo[id][pLeader] = 0;
                
PlayerInfo[id][pRank] = 0;
                
PlayerInfo[id][pFACWarns] = 0;
                
PlayerInfo[id][pFactionTime] = 0;
                
PlayerInfo[id][pModel] = 250;
                
PlayerInfo[id][pRunners] = 0;
                
PlayerInfo[id][pArrestss] = 0;
                
PlayerInfo[id][pTickets] = 0;
                
PlayerInfo[id][pWKills] = 0;
                
PlayerInfo[id][pWDeaths] = 0;
                
PlayerInfo[id][pMoneyD] = 0;
                
PlayerInfo[id][pMDeposit] = 0;
                
PlayerInfo[id][pDDeposit] = 0;
                
PlayerInfo[id][pOrders] = 0;
                
PlayerInfo[id][pPHeals] = 0;
                
PlayerInfo[id][pLGiven] = 0;
                
PlayerInfo[id][pMUsed] = 0;
                
PlayerInfo[id][pNews] = 0;
                
PlayerInfo[id][pLives] = 0;
                
PlayerInfo[id][pDConfiscate] = 0;
                
PlayerInfo[id][pLConfiscate] = 0;
                
PlayerInfo[id][pContracts] = 0;
                
PlayerInfo[id][pCommands] = 0;
                
Update(playerid,pCommandsx);
                new 
str[256];
                
mysql_format(SQL,str,sizeof(str),"UPDATE users SET `Commands`='0' WHERE `name`='%s'",PlayerInfo[playerid][pNormalName]);
                
mysql_tquery(SQL,str,"","");
                
gTeam[id] = 3;
                
PlayerInfo[id][pTeam] = 3;
                
OnDuty[id] = 0;
                
tazer[id] = 0;
                
SetPlayerArmourEx(id0);
                
SetPlayerSkin(id,PlayerInfo[id][pModel]);
                
SpawnPlayer(id);
                
mysql_format(SQL,str,sizeof(str),"UPDATE users SET `Member`='0',`Leader`='0',`Rank`='0',`Model`='250',`FWarn`='0',`FPunish`='%d',`Team`='3', `FactionTime`='0',`ALeader`='0' WHERE `name`='%s'",PlayerInfo[id][pFpunish],PlayerInfo[id][pNormalName]);
                
mysql_tquery(SQL,str,"","");
                return 
1;
            }
        }
        else
         {
             
SendClientMessage(playeridCOLOR_WHITE"{FFFFCC}Error: Player not connected.");
        }
    }
    else
    {
        
SendClientMessage(playeridCOLOR_ERRORAdminOnly);
    }
    return 
1;

Reply
#2

up please..
Reply
#3

Integers don't require ' '

('%d' --> %d)
Reply
#4

Use a variable to store player's real name in and another for tag
On player connect use setplayername in the name parameter as concatenation of both tag and name but don't update the variable holding real name.
Use this variable to access db.
Reply
#5

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
Use a variable to store player's real name in and another for tag
On player connect use setplayername in the name parameter as concatenation of both tag and name but don't update the variable holding real name.
Use this variable to access db.
i just don't mind how because i didn't made this gamemode,

this is when player is in a clan
PlayerInfo[id][pClanTag] = 0; No Tag
PlayerInfo[id][pClanTag] = 1; [TAG]Name
PlayerInfo[id][pClanTag] = 2; Name[TAG]

this is pNormalName that saves in all mysql queryes for don't save playername with tag i think
PlayerInfo[playerid][pNormalName]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)