Vice City: Multiplayer

VC:MP Discussion => Support => Topic started by: Nihongo^ on Sep 21, 2018, 02:05 PM

Title: : Property system bug
Post by: Nihongo^ on Sep 21, 2018, 02:05 PM
Hi thanks for your help i am facing an other problem now cmd not placing Name on DB kindly check the image and function

function CreateProperty( name, price, x, y, z, world )
{
    local see_dbProperties = QuerySQL ( dbProperties, "SELECT * FROM sqlite_master WHERE type='table' AND name='Properties'" );
    if( !see_dbProperties ) return print( "[dbProps] There are no properties." );
    else FreeSQLQuery( see_dbProperties );
   
        local p = CreatePickup( PROP_MODEL_FORSALE, world, 0, x, y, z, 255, true );
        if( p )
        {
            prop[ p.ID ] = null;
            prop[ p.ID ] = Property(); // important
            prop[ p.ID ].ID = _srv_Properties;
            prop[ p.ID ].Name = name;
            prop[ p.ID ].Price = price;
            prop[ p.ID ].Owner = NO_OWNER_MSG;
            prop[ p.ID ].Sharing = NO_SHARING_MSG;
            prop[ p.ID ].Description = NO_DESCRIPTION_MSG;
            prop[ p.ID ].x = x;
            prop[ p.ID ].y = y;
            prop[ p.ID ].z = z;
            prop[ p.ID ].World = world;
           
            local   query = format( "INSERT INTO Properties ( ID, Name, Price, Owner, Sharing, Description, x, y, z, World ) VALUES ( %i, '%s', %i, '%s', '%s', '%s', %f, %f, %f, %i )",
                        _srv_Properties, name, price, NO_OWNER_MSG, NO_SHARING_MSG, NO_DESCRIPTION_MSG, x, y, z, world );
                       
            QuerySQL( dbProperties, query );
           
            _srv_Properties += 1;
        }
}

else if( cmd == "addprop" )
        {
            if( !text ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
            else if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
            else if( NumTok( text, " " ) < 2 ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
            else if( typeof( GetTok( text, " ", 1 ).tointeger() ) != "integer" ) return pMSG( "Error - Usually 'price' means numbers...", player );
            else if( GetTok( text, " ", 2, NumTok( text, " " ) ).tolower() == "default" ) return pMSG( "Error - The name 'default' cannot be used.", player );
            else
            {
                local   price = GetTok( text, " ", 1 ).tointeger(),
                        name = GetTok( text, " ", 2, NumTok( text, " " ) );
                 
                CreateProperty( name, price, player.Pos.x, player.Pos.y, player.Pos.z, player.World )                 
                pMSG( "[dbProperties]: Property " + name + " was created.", player);
            }
        }
Title: Re: : Property system bug
Post by: DraGone on Sep 22, 2018, 04:32 PM
Check/print the value of variable 'name' and 'query' to find the cause..
Title: Re: : Property system bug
Post by: Mursaleen5544 on Feb 06, 2019, 06:22 AM
Im Getting a Error in Buyprop command expect this whole system is working fine..