Jump to content
  • 0

Problema bizuri


Dynamic

Question

Salutare,

Am un gamemode mysql r39-2 si problema este ca, atunci cand dau /edit la un biz sa ii schimb levelu sau descrierea, etc.. sau daca-l cumpar toate bizurile au in baza de date acelasi id, nume, pozitie(entx, enty, entz, extx, exty, extz). M-am tot chinuit am incercat o gramada de metode.

 

Edited by Dynamic

<a href="http://www.game-state.com/94.177.106.162:7777/"><img src="http://www.game-state.com/94.177.106.162:7777/430x73_FFFFFF_FF9900_000000_000000.png" alt="www.Game-State.com" style="border-style: none;" /></a>

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
public LoadBizz()
{
new idx;
	new Cache: r = mysql_query( mysql_db, "SELECT * FROM `bizz`" );
	if( !cache_get_row_count( mysql_db ) ) return cache_delete( r ), print( "Nu ai niciun biz in baza de date." );
	for( new i = 0; i < cache_get_row_count( mysql_db ); i++ ){
	
			BizzInfo[i][bOwned] = cache_get_field_content_int( i, "Owned", mysql_db );
		cache_get_field_content( i, "Owner", BizzInfo[i][bOwner], mysql_db, MAX_PLAYER_NAME );
		cache_get_field_content( i, "Message", BizzInfo[i][bMessage], mysql_db, MAX_PLAYER_NAME );
		cache_get_field_content( i, "Extortion", BizzInfo[i][bExtortion], mysql_db, MAX_PLAYER_NAME );
		BizzInfo[i][bEntranceX] = cache_get_field_content_float( i, "EntX", mysql_db );
		BizzInfo[i][bEntranceY] = cache_get_field_content_float( i, "EntY", mysql_db );
		BizzInfo[i][bEntranceZ] = cache_get_field_content_float( i, "EntZ", mysql_db );
		BizzInfo[i][bExitX] = cache_get_field_content_float( i, "ExtX", mysql_db );
		BizzInfo[i][bExitY] = cache_get_field_content_float( i, "ExtY", mysql_db );
		BizzInfo[i][bExitZ] = cache_get_field_content_float( i, "ExtZ", mysql_db );
		BizzInfo[i][bLevelNeeded] = cache_get_field_content_int( i, "Level", mysql_db );
		BizzInfo[i][bBuyPrice] = cache_get_field_content_int( i, "Price", mysql_db );
		BizzInfo[i][bEntranceCost] = cache_get_field_content_int( i, "EPrice", mysql_db );
		BizzInfo[i][bTill] = cache_get_field_content_int( i, "Till", mysql_db );
		BizzInfo[i][bLocked] = cache_get_field_content_int( i, "Locked", mysql_db );
		BizzInfo[i][bInterior] = cache_get_field_content_int( i, "Interior", mysql_db );
		BizzInfo[i][bProducts] = cache_get_field_content_int( i, "Products", mysql_db );
		BizzInfo[i][bMaxProducts] = cache_get_field_content_int( i, "MaxProducts", mysql_db );
		BizzInfo[i][bPriceProd] = cache_get_field_content_int( i, "ProductPrice", mysql_db );
			printf("BizzInfo:%d Owner:%s Message:%s Entfee:%d Till:%d Products:%d/%d Interior:%d.\n",
			idx,
			BizzInfo[idx][bOwner],
			BizzInfo[idx][bMessage],
			BizzInfo[idx][bEntranceCost],
			BizzInfo[idx][bTill],
			BizzInfo[idx][bProducts],
			BizzInfo[idx][bMaxProducts],
			BizzInfo[idx][bInterior]);
			idx++;
		}
		cache_delete( r );
	return 1;
}

 

public OnPropUpdate()
{
	new Cache: r = mysql_query( mysql_db, "SELECT * FROM `bizz`" );
	if( cache_get_row_count( mysql_db ) ){
		idx = 0;
		for( new i = 0; i < cache_get_row_count( mysql_db ); i++ ){
			idx = cache_get_field_content_int( i, "ID", mysql_db ) - 1;
			format( string, sizeof(string), "UPDATE `bizz` SET `Owned` = %d, `Owner` = '%s', `Message` = '%s', `Extortion` = '%s', EntX = %f, EntY = %f, EntZ = %f, ExtX = %f, ExtY = %f, ExtZ = %f, Level = %d, Price = %d, EPrice = %d, Till = %d, Locked = %d, Interior = %d, Products = %d, MaxProducts = %d, ProductPrice = %d  WHERE ID = %d",
		BizzInfo[idx][bOwned],
		BizzInfo[idx][bOwner],
		BizzInfo[idx][bMessage],
		BizzInfo[idx][bExtortion],
		BizzInfo[idx][bEntranceX],
		BizzInfo[idx][bEntranceY],
		BizzInfo[idx][bEntranceZ],
		BizzInfo[idx][bExitX],
		BizzInfo[idx][bExitY],
		BizzInfo[idx][bExitZ],
		BizzInfo[idx][bLevelNeeded],
		BizzInfo[idx][bBuyPrice],
		BizzInfo[idx][bEntranceCost],
		BizzInfo[idx][bTill],
		BizzInfo[idx][bLocked],
		BizzInfo[idx][bInterior],
		BizzInfo[idx][bProducts],
		BizzInfo[idx][bMaxProducts],
		BizzInfo[idx][bPriceProd]);
		
  mysql_tquery( mysql_db, string );
		
		if(BizzInfo[idx][bOwned] == 0)
			{
				format(string, sizeof(string), "{2EAD15}%s\n {2EAD15} For Sale\n {2EAD15}Level: {FFFFFF}%d\n {2EAD15}Valoare: {FFFFFF}%d\n{2EAD15} /buybiz",BizzInfo[idx][bMessage],BizzInfo[idx][bLevelNeeded],BizzInfo[idx][bBuyPrice]);
			}
			else
			{
				format(string, sizeof(string), "{F5E618}%s\n {F5E618}Owner: {FFFFFF}%s\n {F5E618}Exto: {FFFFFF}%s\n {F5E618}Level: {FFFFFF}%d\n {F5E618}Fee: {FFFFFF}%d\n {F5E618}Valoare: {FFFFFF}%d\n{F5E618} Press Enter or F",BizzInfo[idx][bMessage],BizzInfo[idx][bOwner],BizzInfo[idx][bExtortion],BizzInfo[idx][bLevelNeeded],BizzInfo[idx][bEntranceCost],BizzInfo[idx][bBuyPrice]);
			}
			Update3DTextLabelText(BizLabel[idx] ,0x008080FF, string);
		}
	}
	cache_delete( r );

 

<a href="http://www.game-state.com/94.177.106.162:7777/"><img src="http://www.game-state.com/94.177.106.162:7777/430x73_FFFFFF_FF9900_000000_000000.png" alt="www.Game-State.com" style="border-style: none;" /></a>

Link to comment
Share on other sites

  • 0
public OnPropUpdate()
{
    new Cache: r = mysql_query( mysql_db, "SELECT `ID` FROM `bizz`" );
    new rows = cache_get_row_count( mysql_db ), SQLID;
    if( rows >=  1 )
    {
        idx = 0;
        for( new i = 0; i < rows; i++ )
        {
            idx = cache_get_field_content_int( i, "ID", mysql_db ) - 1;
            SQLID = cache_get_field_content_int( i, "ID", mysql_db );
            mysql_format( mysql_db, string, sizeof(string), "UPDATE `bizz` SET `Owned` = %d, `Owner` = '%e', `Message` = '%e', `Extortion` = '%e', EntX = %f, EntY = %f, EntZ = %f, ExtX = %f, ExtY = %f, ExtZ = %f, Level = %d, Price = %d, EPrice = %d, Till = %d, Locked = %d, Interior = %d, Products = %d, MaxProducts = %d, ProductPrice = %d  WHERE ID = %d",
            BizzInfo[idx][bOwned],
            BizzInfo[idx][bOwner],
            BizzInfo[idx][bMessage],
            BizzInfo[idx][bExtortion],
            BizzInfo[idx][bEntranceX],
            BizzInfo[idx][bEntranceY],
            BizzInfo[idx][bEntranceZ],
            BizzInfo[idx][bExitX],
            BizzInfo[idx][bExitY],
            BizzInfo[idx][bExitZ],
            BizzInfo[idx][bLevelNeeded],
            BizzInfo[idx][bBuyPrice],
            BizzInfo[idx][bEntranceCost],
            BizzInfo[idx][bTill],
            BizzInfo[idx][bLocked],
            BizzInfo[idx][bInterior],
            BizzInfo[idx][bProducts],
            BizzInfo[idx][bMaxProducts],
            BizzInfo[idx][bPriceProd])
            SQLID;
        
            mysql_tquery( mysql_db, string );
        
            if(BizzInfo[idx][bOwned] == 0)
            {
                format(string, sizeof(string), "{2EAD15}%s\n {2EAD15} For Sale\n {2EAD15}Level: {FFFFFF}%d\n {2EAD15}Valoare: {FFFFFF}%d\n{2EAD15} /buybiz",BizzInfo[idx][bMessage],BizzInfo[idx][bLevelNeeded],BizzInfo[idx][bBuyPrice]);
            }
            else
            {
                format(string, sizeof(string), "{F5E618}%s\n {F5E618}Owner: {FFFFFF}%s\n {F5E618}Exto: {FFFFFF}%s\n {F5E618}Level: {FFFFFF}%d\n {F5E618}Fee: {FFFFFF}%d\n {F5E618}Valoare: {FFFFFF}%d\n{F5E618} Press Enter or F",BizzInfo[idx][bMessage],BizzInfo[idx][bOwner],BizzInfo[idx][bExtortion],BizzInfo[idx][bLevelNeeded],BizzInfo[idx][bEntranceCost],BizzInfo[idx][bBuyPrice]);
            }
            Update3DTextLabelText(BizLabel[idx] ,0x008080FF, string);
        }
    }
    cache_delete( r );
}

Iti lipsea id-ul bizului din clauza WHERE , adica nu stia la ce id sa updateze asa ca o facea la toate.

 

public LoadBizz()
{
    new idx;
    new Cache: r = mysql_query( mysql_db, "SELECT * FROM `bizz`" ) , rows = cache_get_row_count( mysql_db );
    if( !cache_get_row_count( mysql_db ) ) return cache_delete( r ), print( "Nu ai niciun biz in baza de date." );
    for( new i = 0; i < rows; i++ )
    {
    
        BizzInfo[i][bOwned] = cache_get_field_content_int( i, "Owned", mysql_db );
        cache_get_field_content( i, "Owner", BizzInfo[i][bOwner], mysql_db, MAX_PLAYER_NAME );
        cache_get_field_content( i, "Message", BizzInfo[i][bMessage], mysql_db, MAX_PLAYER_NAME );
        cache_get_field_content( i, "Extortion", BizzInfo[i][bExtortion], mysql_db, MAX_PLAYER_NAME );
        BizzInfo[i][bEntranceX] = cache_get_field_content_float( i, "EntX", mysql_db );
        BizzInfo[i][bEntranceY] = cache_get_field_content_float( i, "EntY", mysql_db );
        BizzInfo[i][bEntranceZ] = cache_get_field_content_float( i, "EntZ", mysql_db );
        BizzInfo[i][bExitX] = cache_get_field_content_float( i, "ExtX", mysql_db );
        BizzInfo[i][bExitY] = cache_get_field_content_float( i, "ExtY", mysql_db );
        BizzInfo[i][bExitZ] = cache_get_field_content_float( i, "ExtZ", mysql_db );
        BizzInfo[i][bLevelNeeded] = cache_get_field_content_int( i, "Level", mysql_db );
        BizzInfo[i][bBuyPrice] = cache_get_field_content_int( i, "Price", mysql_db );
        BizzInfo[i][bEntranceCost] = cache_get_field_content_int( i, "EPrice", mysql_db );
        BizzInfo[i][bTill] = cache_get_field_content_int( i, "Till", mysql_db );
        BizzInfo[i][bLocked] = cache_get_field_content_int( i, "Locked", mysql_db );
        BizzInfo[i][bInterior] = cache_get_field_content_int( i, "Interior", mysql_db );
        BizzInfo[i][bProducts] = cache_get_field_content_int( i, "Products", mysql_db );
        BizzInfo[i][bMaxProducts] = cache_get_field_content_int( i, "MaxProducts", mysql_db );
        BizzInfo[i][bPriceProd] = cache_get_field_content_int( i, "ProductPrice", mysql_db );
        printf("BizzInfo:%d Owner:%s Message:%s Entfee:%d Till:%d Products:%d/%d Interior:%d.\n",
        idx,
        BizzInfo[idx][bOwner],
        BizzInfo[idx][bMessage],
        BizzInfo[idx][bEntranceCost],
        BizzInfo[idx][bTill],
        BizzInfo[idx][bProducts],
        BizzInfo[idx][bMaxProducts],
        BizzInfo[idx][bInterior]);
        idx++;
    }
    cache_delete( r );
    return 1;
}

 

Link to comment
Share on other sites

  • 0

a dat un warning 215: expression has no efect la linia

BizzInfo[idx][bPriceProd])
            SQLID;

Am modificat eu, am pus , dupa [bPriceProd] si am inchis paranteza dupa SQLID.

Sa-mi ziceti daca e bine

BizzInfo[idx][bPriceProd],

SQLID);

A compilat perfect dar cand dau /sellbiz, /buybiz, /edit, /asellbiz nu se modifica in baza de date levelul,bani,owner etc..

Pe server merge sa modifici, dar in baza de date nu se schimba, cred ca tot la OnPropUpdate e problema.

Edited by Dynamic

<a href="http://www.game-state.com/94.177.106.162:7777/"><img src="http://www.game-state.com/94.177.106.162:7777/430x73_FFFFFF_FF9900_000000_000000.png" alt="www.Game-State.com" style="border-style: none;" /></a>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.