My Sql Saving (URGENT) Thank you!
#1

I know, it's wrong cuz it doesn't save. But when i compile it's fine. Anyone help me. I need to make it in double way

PHP код:
forward OnPlayerSave(playerid);
public 
OnPlayerSave(playerid)
{
    new 
query[500];
    
pInfo[playerid][pSkinID] = GetPlayerSkin(playerid);
    if(
IsLoggedIn[playerid] == && playerid != INVALID_PLAYER_ID && !IsPlayerNPC(playerid))
    {
        
mysql_format(MySQLConquerysizeof(query), "UPDATE `players` SET `Admin`=%d, `Vip`=%d, `Money`=%d, `BankMoney`=%d, `Score`=%d, `Deaths`=%d, `Kills`=%d, `SkinID`=%d, `WantedLevel`=%d, `Bounty`=%d, `BountyHour`=%d, `BountyMinute`=%d, `BountyPlacedOn`=%d, `BountyPlacedBy`=%d WHERE `ID`=%d AND `user`='%e'",
        
pInfo[playerid][pAdmin],
        
pInfo[playerid][pVip],
        
GetPlayerMoney(playerid),
        
pInfo[playerid][pBankMoney],
        
GetPlayerScore(playerid),
        
pInfo[playerid][pDeaths],
        
pInfo[playerid][pKills],
        
GetPlayerSkin(playerid),
        
pInfo[playerid][pWantedLevel],
        
pInfo[playerid][pBounty],
        
pInfo[playerid][pBountyHour],
        
pInfo[playerid][pBountyMinute],
        
pInfo[playerid][pBountyPlacedOn],
        
pInfo[playerid][pBountyPlacedBy],
        
pInfo[playerid][pID],
        
PlayerName(playerid));
        
mysql_format(MySQLConquerysizeof(query), "UPDATE `players` `Robbed`=%d, `RobbedMoney`=%d, `GotRobbed`=%d, `GotRobbedMoney`=%d, `StoreRobbed`=%d, `StoreRobbedMoney`=%d, `FoodPurchased`=%d, `FoodPurchasedMoney`=%d, `WeaponsPurchased`=%d, `WeaponsPurchasedMoney`=%d WHERE `ID`=%d AND `user`='%e'",
        
pInfo[playerid][pRobbed],
        
pInfo[playerid][pRobbedMoney],
        
pInfo[playerid][pGotRobbed],
        
pInfo[playerid][pGotRobbedMoney],
        
pInfo[playerid][pStoreRobbed],
        
pInfo[playerid][pStoreRobbedMoney],
        
pInfo[playerid][pFoodPurchased],
        
pInfo[playerid][pFoodPurchasedMoney],
        
pInfo[playerid][pWeaponsPurchased],
        
pInfo[playerid][pWeaponsPurchasedMoney],
        
pInfo[playerid][pID],
        
PlayerName(playerid));
        
mysql_tquery(MySQLConquery"""");
        print(
query); 
Reply
#2

this?

Код:
forward OnPlayerSave(playerid);
public OnPlayerSave(playerid)
{
    new query[500];
    pInfo[playerid][pSkinID] = GetPlayerSkin(playerid);
    if(IsLoggedIn[playerid] == 1 && playerid != INVALID_PLAYER_ID && !IsPlayerNPC(playerid))
    {
        mysql_format(MySQLCon, query, sizeof(query), "UPDATE `players` SET `Admin`=%d, `Vip`=%d, `Money`=%d, `BankMoney`=%d, `Score`=%d, `Deaths`=%d, `Kills`=%d, `SkinID`=%d, `WantedLevel`=%d, `Bounty`=%d, `BountyHour`=%d, `BountyMinute`=%d, `BountyPlacedOn`=%d, `BountyPlacedBy`=%d WHERE `ID`=%d AND `user`='%e'",
        pInfo[playerid][pAdmin],
        pInfo[playerid][pVip],
        GetPlayerMoney(playerid),
        pInfo[playerid][pBankMoney],
        GetPlayerScore(playerid),
        pInfo[playerid][pDeaths],
        pInfo[playerid][pKills],
        GetPlayerSkin(playerid),
        pInfo[playerid][pWantedLevel],
        pInfo[playerid][pBounty],
        pInfo[playerid][pBountyHour],
        pInfo[playerid][pBountyMinute],
        pInfo[playerid][pBountyPlacedOn],
        pInfo[playerid][pBountyPlacedBy],
        pInfo[playerid][pID],
        PlayerName(playerid));
        mysql_tquery(MySQLCon, query, "", "");
        mysql_format(MySQLCon, query, sizeof(query), "UPDATE `players` SET `Robbed`=%d, `RobbedMoney`=%d, `GotRobbed`=%d, `GotRobbedMoney`=%d, `StoreRobbed`=%d, `StoreRobbedMoney`=%d, `FoodPurchased`=%d, `FoodPurchasedMoney`=%d, `WeaponsPurchased`=%d, `WeaponsPurchasedMoney`=%d WHERE `ID`=%d AND `user`='%e'",
        pInfo[playerid][pRobbed],
        pInfo[playerid][pRobbedMoney],
        pInfo[playerid][pGotRobbed],
        pInfo[playerid][pGotRobbedMoney],
        pInfo[playerid][pStoreRobbed],
        pInfo[playerid][pStoreRobbedMoney],
        pInfo[playerid][pFoodPurchased],
        pInfo[playerid][pFoodPurchasedMoney],
        pInfo[playerid][pWeaponsPurchased],
        pInfo[playerid][pWeaponsPurchasedMoney],
        pInfo[playerid][pID],
        PlayerName(playerid));
        mysql_tquery(MySQLCon, query, "", "");
        print(query);
	}
}
Reply
#3

im getting an error about the line is too big. what if i change new query[500]; size? would be fine? i want make it in 1 line.

i mean, i want make this in 1 line.

mysql_format(MySQLCon, query, sizeof(query), "UPDATe
Reply
#4

you can use '/' for new line.
this?

Код:
forward OnPlayerSave(playerid);
public OnPlayerSave(playerid)
{
    new query[500];
    pInfo[playerid][pSkinID] = GetPlayerSkin(playerid);
    if(IsLoggedIn[playerid] == 1 && playerid != INVALID_PLAYER_ID && !IsPlayerNPC(playerid))
    {
        mysql_format(MySQLCon, query, sizeof(query), "UPDATE `players` SET `Admin`=%d, `Vip`=%d, `Money`=%d, `BankMoney`=%d, `Score`=%d, `Deaths`=%d, `Kills`=%d, `SkinID`=%d, `WantedLevel`=%d, `Bounty`=%d, `BountyHour`=%d, `BountyMinute`=%d, `BountyPlacedOn`=%d, `BountyPlacedBy`=%d WHERE `ID`=%d AND `user`='%e'", \
        pInfo[playerid][pAdmin], \
        pInfo[playerid][pVip], \
        GetPlayerMoney(playerid), \
        pInfo[playerid][pBankMoney], \
        GetPlayerScore(playerid), \
        pInfo[playerid][pDeaths], \
        pInfo[playerid][pKills], \
        GetPlayerSkin(playerid), \
        pInfo[playerid][pWantedLevel], \
        pInfo[playerid][pBounty], \
        pInfo[playerid][pBountyHour], \
        pInfo[playerid][pBountyMinute], \
        pInfo[playerid][pBountyPlacedOn], \
        pInfo[playerid][pBountyPlacedBy], \
        pInfo[playerid][pID], \
        PlayerName(playerid));
        mysql_tquery(MySQLCon, query, "", "");
        mysql_format(MySQLCon, query, sizeof(query), "UPDATE `players` SET `Robbed`=%d, `RobbedMoney`=%d, `GotRobbed`=%d, `GotRobbedMoney`=%d, `StoreRobbed`=%d, `StoreRobbedMoney`=%d, `FoodPurchased`=%d, `FoodPurchasedMoney`=%d, `WeaponsPurchased`=%d, `WeaponsPurchasedMoney`=%d WHERE `ID`=%d AND `user`='%e'", \
        pInfo[playerid][pRobbed], \
        pInfo[playerid][pRobbedMoney], \
        pInfo[playerid][pGotRobbed], \
        pInfo[playerid][pGotRobbedMoney], \
        pInfo[playerid][pStoreRobbed], \
        pInfo[playerid][pStoreRobbedMoney], \
        pInfo[playerid][pFoodPurchased], \
        pInfo[playerid][pFoodPurchasedMoney], \
        pInfo[playerid][pWeaponsPurchased], \
        pInfo[playerid][pWeaponsPurchasedMoney], \
        pInfo[playerid][pID], \
        PlayerName(playerid));
        mysql_tquery(MySQLCon, query, "", "");
        print(query);
	}
}
Reply
#5

You have to use strcat.
Reply
#6

I don't want to use new line. Actually, I mean, it should be like this.

PHP код:
forward OnPlayerSave(playerid);
public 
OnPlayerSave(playerid)
{
    new 
query[500];
    
pInfo[playerid][pSkinID] = GetPlayerSkin(playerid);
    if(
IsLoggedIn[playerid] == && playerid != INVALID_PLAYER_ID && !IsPlayerNPC(playerid))
    {
        
mysql_format(MySQLConquerysizeof(query), "UPDATE `players` SET `Admin`=%d, `Vip`=%d, `Money`=%d, `BankMoney`=%d, `Score`=%d, `Deaths`=%d, `Kills`=%d, `SkinID`=%d, `WantedLevel`=%d, `Bounty`=%d, `BountyHour`=%d, `BountyMinute`=%d, `BountyPlacedOn`=%d, `BountyPlacedBy`=%d WHERE `ID`=%d AND `user`='%e'"
        
mysql_format(MySQLConquerysizeof(query), "UPDATE `players` SET `Robbed`=%d, `RobbedMoney`=%d, `GotRobbed`=%d, `GotRobbedMoney`=%d, `StoreRobbed`=%d, `StoreRobbedMoney`=%d, `FoodPurchased`=%d, `FoodPurchasedMoney`=%d, `WeaponsPurchased`=%d, `WeaponsPurchasedMoney`=%d WHERE `ID`=%d AND `user`='%e'"
        
pInfo[playerid][pAdmin], 
        
pInfo[playerid][pVip], 
        
GetPlayerMoney(playerid), 
        
pInfo[playerid][pBankMoney], 
        
GetPlayerScore(playerid), 
        
pInfo[playerid][pDeaths], 
        
pInfo[playerid][pKills], 
        
GetPlayerSkin(playerid), 
        
pInfo[playerid][pWantedLevel], 
        
pInfo[playerid][pBounty], 
        
pInfo[playerid][pBountyHour], 
        
pInfo[playerid][pBountyMinute], 
        
pInfo[playerid][pBountyPlacedOn], 
        
pInfo[playerid][pBountyPlacedBy], 
        
pInfo[playerid][pRobbed], 
        
pInfo[playerid][pRobbedMoney], 
        
pInfo[playerid][pGotRobbed], 
        
pInfo[playerid][pGotRobbedMoney], 
        
pInfo[playerid][pStoreRobbed], 
        
pInfo[playerid][pStoreRobbedMoney], 
        
pInfo[playerid][pFoodPurchased], 
        
pInfo[playerid][pFoodPurchasedMoney], 
        
pInfo[playerid][pWeaponsPurchased], 
        
pInfo[playerid][pWeaponsPurchasedMoney], 
        
pInfo[playerid][pID], 
        
PlayerName(playerid));
        
mysql_tquery(MySQLConquery"""");
        print(
query);
    }

But i know this is wrong format. I want to know how to make double line together like this.

PHP код:
 mysql_format(MySQLConquerysizeof(query), "UPDATE `players` SET `Admin`=%d, `Vip`=%d, `Money`=%d, `BankMoney`=%d, `Score`=%d, `Deaths`=%d, `Kills`=%d, `SkinID`=%d, `WantedLevel`=%d, `Bounty`=%d, `BountyHour`=%d, `BountyMinute`=%d, `BountyPlacedOn`=%d, `BountyPlacedBy`=%d WHERE `ID`=%d AND `user`='%e'"
mysql_format(MySQLConquerysizeof(query), "UPDATE `players` SET `Robbed`=%d, `RobbedMoney`=%d, `GotRobbed`=%d, `GotRobbedMoney`=%d, `StoreRobbed`=%d, `StoreRobbedMoney`=%d, `FoodPurchased`=%d, `FoodPurchasedMoney`=%d, `WeaponsPurchased`=%d, `WeaponsPurchasedMoney`=%d WHERE `ID`=%d AND `user`='%e'"
If i change

PHP код:
new query[500]; 
500 to 1500. So can i add these 2 line mysql_format in one line.?
Reply
#7

this?

Код:
forward OnPlayerSave(playerid);
public OnPlayerSave(playerid)
{
    new query[1000];
    pInfo[playerid][pSkinID] = GetPlayerSkin(playerid);
    if(IsLoggedIn[playerid] == 1 && playerid != INVALID_PLAYER_ID && !IsPlayerNPC(playerid))
    {
        mysql_format(MySQLCon, query, sizeof(query), "UPDATE `players` SET `Admin`=%d, `Vip`=%d, `Money`=%d, `BankMoney`=%d, `Score`=%d, `Deaths`=%d, `Kills`=%d, `SkinID`=%d, `WantedLevel`=%d, `Bounty`=%d, `BountyHour`=%d, `BountyMinute`=%d, `BountyPlacedOn`=%d, `BountyPlacedBy`=%d, \
        `Robbed`=%d, `RobbedMoney`=%d, `GotRobbed`=%d, `GotRobbedMoney`=%d, `StoreRobbed`=%d, `StoreRobbedMoney`=%d, `FoodPurchased`=%d, `FoodPurchasedMoney`=%d, `WeaponsPurchased`=%d, `WeaponsPurchasedMoney`=%d \
		 WHERE `ID`=%d AND `user`='%e'", \
        pInfo[playerid][pAdmin], \
        pInfo[playerid][pVip], \
        GetPlayerMoney(playerid), \
        pInfo[playerid][pBankMoney], \
        GetPlayerScore(playerid), \
        pInfo[playerid][pDeaths], \
        pInfo[playerid][pKills], \
        GetPlayerSkin(playerid), \
        pInfo[playerid][pWantedLevel], \
        pInfo[playerid][pBounty], \
        pInfo[playerid][pBountyHour], \
        pInfo[playerid][pBountyMinute], \
        pInfo[playerid][pBountyPlacedOn], \
        pInfo[playerid][pBountyPlacedBy], \
        pInfo[playerid][pRobbed], \
        pInfo[playerid][pRobbedMoney], \
        pInfo[playerid][pGotRobbed], \
        pInfo[playerid][pGotRobbedMoney], \
        pInfo[playerid][pStoreRobbed], \
        pInfo[playerid][pStoreRobbedMoney], \
        pInfo[playerid][pFoodPurchased], \
        pInfo[playerid][pFoodPurchasedMoney], \
        pInfo[playerid][pWeaponsPurchased], \
        pInfo[playerid][pWeaponsPurchasedMoney], \
        pInfo[playerid][pID], \
        PlayerName(playerid));
        mysql_tquery(MySQLCon, query, "", "");
        print(query);
    }
}
'So can i add these 2 line mysql_format in one line.?'

no the only result that will churn is enforceable only

Код:
mysql_format(MySQLCon, query, sizeof(query), "UPDATE `players` SET `Robbed`=%d, `RobbedMoney`=%d, `GotRobbed`=%d, `GotRobbedMoney`=%d, `StoreRobbed`=%d, `StoreRobbedMoney`=%d, `FoodPurchased`=%d, `FoodPurchasedMoney`=%d, `WeaponsPurchased`=%d, `WeaponsPurchasedMoney`=%d WHERE `ID`=%d AND `user`='%e'",
To run two formats must send one after the other.

end if you have string counter set new query[to your count]; For best performance.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)