price

Started by :P, Oct 09, 2015, 08:22 AM

Previous topic - Next topic

:P

Is it Possible to set Vehicle price from cmds If yes then how
SLC is a good scripter but he always use bad words for abusing players :P

KAKAN

Yes, make a cmd and update the Price using a Query or an array.
Ex:-
QuerySQL(db,"UPDATE Vehicles SET Price='" + text + "' WHERE Vehicle ='" + player.Vehicle + "'" )
oh no

:P

this is but not works cost does not exists i try with price but dont work   else if ( cmd == "setcarprice" )
    {
if ( IsNoob( player, cmd ) ) return 0;
          else if ( !text ) MessagePlayer("Error, [Syntax] setcarprice <car id> <newprice>", player ); 
        {
                local id = GetTok( text, " ", 1 ), newcost = GetTok ( text, " ", 2);
                if ( !IsNum( id ) ) MessagePlayer("Error, [Syntax] invalid car id", player );
                else
                {
                                       if ( !IsNum( newcost ) ) MessagePlayer("Error, [Syntax] the number must be in numbers", player );
                                       else
                                       {
                                                id = id.tointeger();
                                                newcost = newcost.tointeger();
                                                local setnewcost = format( "UPDATE cars SET Price=%i WHERE carID=" + id, newcost );
                                                if ( carcost( id ) == 0 )
                                                {
                                                        ::QuerySQL( DB, "REPLACE INTO cars (carID) VALUES (" + id + ")" );
                                                } 
                                                EMessage( "** Price Changed - car ID: " + id + " - Name: " + Findcar( id ) + " - New cost: $" + Bytes( newcost ) );
                                                QuerySQL( DB, setnewcost );
                                        }
                }     
        }
    }
SLC is a good scripter but he always use bad words for abusing players :P

KAKAN

See the table in your database file.
oh no

:P

in the table is cost
SLC is a good scripter but he always use bad words for abusing players :P

KAKAN

WTH is this?
if ( carcost( id ) == 0 )
oh no

MacTavish

Post an screenshot of your cars table where is your car cost

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

:P

SLC is a good scripter but he always use bad words for abusing players :P

:P

AND PLEASE FIX MY CMDS SOON
SLC is a good scripter but he always use bad words for abusing players :P

MacTavish

#9
Here it is

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

ENJOY

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

:P

which cmds i post how is its good my first time try to make
And thanx For cmds
SLC is a good scripter but he always use bad words for abusing players :P