no error

Started by Cool, May 04, 2016, 07:50 PM

Previous topic - Next topic

Cool

these two cmds not works say its changed but does not change price
else if ( cmd == "setpropprice" )
   {
   try {
        if ( IsAdmin( player, cmd ) ) return 0;     
  else if ( !text ) MessagePlayer("[#32CD32][Syntax][#FFFFFF] /setpropprice <prop ID> <Cost>", player );
        else
        {
                local id = GetTok( text, " ", 1 ), newprice = GetTok( text, " ", 2 );
                if ( !IsNum( id ) ) MessagePlayer("[#32CD32][ERROR][#FFFFFF] Invalid prop ID.", player );
                else
                {
                                       if ( !IsNum( newprice ) ) MessagePlayer("[#32CD32][ERROR][#FFFFFF] - The price should be in number.", player );
                                       else
                                       {
                                                id = id.tointeger();
                                                newprice = newprice.tointeger();
                                                local setnewprice = format( "UPDATE Properties SET Price=%i WHERE ID=" + id, newprice );
                                                MessagePlayer("[#32CD32][INFO][#FFFFFF]Done -You have changed the price of prop Id ( " + id + " ) New price: $" + newprice + "", player );
                                                QuerySQL( sqliteDB, setnewprice );
                                        }
                }
    }
    }
    catch(e) print( "Setpropprice " + e );
    }


else if ( cmd == "setcarprice" )
   {
   try {
        if ( IsAdmin( player, cmd ) ) return 0;     
  else if ( !text ) MessagePlayer("[#32CD32][Syntax][#FFFFFF] /setcarprice <Vehicle ID> <Cost>", player );
        else
        {
                local id = GetTok( text, " ", 1 ), newprice = GetTok( text, " ", 2 );
                if ( !IsNum( id ) ) MessagePlayer("[#32CD32][ERROR][#FFFFFF] Invalid vehicle ID.", player );
                else
                {
                                       if ( !IsNum( newprice ) ) MessagePlayer("[#32CD32][ERROR][#FFFFFF] - The price should be in number.", player );
                                       else
                                       {
                                                id = id.tointeger();
                                                newprice = newprice.tointeger();
                                                local setnewprice = format( "UPDATE Cars SET Price=%i WHERE ID=" + id, newprice );
                                                MessagePlayer("[#32CD32][INFO][#FFFFFF]Done -You have changed the price of vehicle Id ( " + id + " ) New price: $" + newprice + "", player );
                                                QuerySQL( sqliteDB, setnewprice );
                                        }
                }
    }
    }
    catch(e) print( "Setcarprice " + e );
    }

Thijn

What have you tried yourself to debug this problem?
What does the query return? Does it return false. If so, did you try printing the query and executing it yourself to see if it has any syntax errors?
Did you even try to debug it yourself?

.

Quote from: Thijn on May 04, 2016, 08:16 PMDid you even try to debug it yourself?

Best joke I've heard today. ;D
.

Thijn

Quote from: . on May 04, 2016, 08:18 PM
Quote from: Thijn on May 04, 2016, 08:16 PMDid you even try to debug it yourself?

Best joke I've heard today. ;D
I could've probably removed that question mark since we all know the answer...

Mötley

You should attempt to add in the values into a class. Create a command to view the class stats, and see if the data is there? is it? is it not? if it is try to update on player part, If that works. Update when the player does whatever to there cash,

I really do not suggest updating every time a player sells a car. This sounds like a way to have a lagging server.
My suggestion is after you create that class "IF POSSIBLE, I do not know how that script works" update the cars on the server say every 6 hours. and maybe create an admin command to manually save the prices etc,. But like I said I do not know how that script works what so ever so I am more than likely wrong,..


Cool