String always displays faction ID 1
#1

Hi. I have a command that changes teh faction positions and is scripted to send the client a message with the ID and the position of the faction. It changes the faction position and changes the ID properly but displays the faction as always being as ID 1
(under the faction name it looks like this:
PHP код:
{SERVER}: {FFFFFF}You have just edited faction ID: %d's info position. (X, Y, Z) (CSPD) 
)
This affects my textdraw script and displays faction ID 1's name when the faction has recently changed position

/changefacpos :
PHP код:
CMD:changefacpos(playerid,params[])
{
//    if(playerInfo[playerid][playerAdmin] >= 5)
    
{
        new 
string[128], id, Float:factionX, Float:factionY, Float:factionZ, DB_Query[1000], query[1000];
          if(
sscanf(params, "d", id)) return SendClientMessage(playerid, COLOR_GRAYTEXT, "SERVER:{FFFFFF} /changefacpos [factionID]");
        {
            
factionInfo[fID][fID] = id;
            
mysql_format(Database, DB_Query, sizeof(DB_Query), "SELECT * FROM `factions` WHERE `fID` = '%d'", id);
            
mysql_tquery(Database, DB_Query);
            
//cache_get_row_count(rows);
            //if(factionInfo[fID][fID] == true)
            
{
                
GetPlayerPos(playerid, factionX, factionY, factionZ);
                {
                 
DestroyDynamicPickup(factionInfo[fID][fID]);
                    {
                        
factionInfo[fID][facX] = factionX;
                        
factionInfo[fID][facY] = factionY;
                        
factionInfo[fID][facZ] = factionZ;
                        
format(string, sizeof(string), "{SERVER}: {FFFFFF}You have just edited faction ID: %d's info position. (%f, %f, %f) (%s)", id, factionX, factionY, factionZ,factionInfo[fID][facName]);
                        
SendClientMessage(playerid, COLOR_GRAYTEXT, string);
                        
format(query, sizeof(query), "UPDATE `factions` SET `facX` = '%f', `facY` = '%f', `facZ` = '%f' WHERE `fID` = '%d'", factionInfo[fID][facX],factionInfo[fID][facY],factionInfo[fID][facZ],factionInfo[fID][fID]);
                           
mysql_tquery(Database, query);
                           {
                            
factionInfo[fID][fID] = CreateDynamicPickup(1239, 1, factionX, factionY, factionZ, 0, 0);
                           }
                       }
                }
            }
            
/*else
            {
                SendClientMessage(playerid, -1, "Faction doesnt exist");
            }*/
        
}
    }
    return 
1;
} 
Reply
#2

try
Код:
format(string, sizeof(string), "{SERVER}: {FFFFFF}You have just edited faction ID: %d's info position. (%f, %f, %f) (%s)", factionInfo[fID][fID], factionX, factionY, factionZ,factionInfo[fID][facName]);
Reply
#3

Quote:
Originally Posted by reddoxx
Посмотреть сообщение
try
Код:
format(string, sizeof(string), "{SERVER}: {FFFFFF}You have just edited faction ID: %d's info position. (%f, %f, %f) (%s)", factionInfo[fID][fID], factionX, factionY, factionZ,factionInfo[fID][facName]);
Tried that, this is displayed in game:

PHP код:
[19:22:10] {SERVER}: {FFFFFF}You have just edited faction ID: 1's info position. (140.718002, -72.125198, 1.429687) (CSPD)
[19:22:13] {SERVER}: {FFFFFF}You have just edited faction ID: 2'
s info position. (134.421081, -71.920806, 1.429687) (CSPD) 
Yes, it selects the correct faction ID and updates it successfully. Have tested with print(DB_Query);
Reply


Forum Jump:


Users browsing this thread: