TradeCar

Started by PsyChO_KiLLeR, Mar 07, 2015, 09:30 AM

Previous topic - Next topic

PsyChO_KiLLeR

Well i create a trade car system but its not working always getting error on 33 line


this is commands

             

 else if ( cmd == "taccept" )
{
local cost = status[ player.ID ].cost
local IDS = status[ player.ID ].id
if ( status[ player.ID ].waiting == false ) ePrivMessage("Error: You dont have pending request.",player)
 Always error here else if ( player.Cash < cost ) ePrivMessage("Error: You need $ [ " + cost + " ] to buy this vehicle.",player)
else
{
local plr = FindPlayer( status[ plr.ID ].tname )
QuerySQL( db, "UPDATE Cars SET Owner='" + player.Name + "' WHERE ID='" + IDS + "'" );
ePrivMessage( "You have purchased the vehicle ID [ " + IDS + " ]", player );
DecCash( player , status[ player.ID ].cost )
ePrivMessage("You have selling vehicle ID [ " + IDS + " ]",plr)
IncCash( plr , status[ player.ID ].cost )
status[ player.ID ].cost = null
status[ player.ID ].waiting = false
status[ player.ID ].id = null
status[ player.ID ].name = null
status[ plr.ID ].t = false
ttimeouts.Stop()
}
}




else if ( cmd =="tradecar" )
{
if ( !text ) ePrivMessage("Syntax: /c tradecar <player/id> <cost>",player)
else
{
local veh = player.Vehicle;
local id = player.ID
local plr = FindPlayer( GetTok( text, " ", 1 ) ), cost = GetTok( text, " ", 2 );
if ( !veh ) ePrivMessage( "Error: You must be in a vehicle.", player );
else
{
local q = QuerySQL( db, "SELECT * FROM Cars WHERE rowid LIKE '" + veh.ID + "'" );
if ( plr == null ) ePrivMessage("Invalid Player",player)
else if ( GetSQLColumnData( q, 2 ) != player.Name ) ePrivMessage( "Error: You do not own this vehicle.", player );
else if ( !plr ) ePrivMessage("Error: Invalid player.",player)
else if ( cost == null ) ePrivMessage("Who will set cost ah?",player)
else if ( !IsNum( cost ) ) ePrivMessage( "Error: The cost should be in number.", player );
else
{
status[ player.ID ].t = true
status[ plr.ID ].cost = cost
status[ plr.ID ].waiting = true
status[ plr.ID ].id = veh.ID
status[ plr.ID ].name = player.Name
ePrivMessage("Request send, wait for him reply.",player)
ePrivMessage("Player [ " + player.Name + " ] want sell ID [ " + veh.ID + " ][ " + GetVehicleNameFromModel( veh.Model ) + " ] for $[ " + cost + " ]",plr)
ePrivMessage("Type /c taccept to accept or /c tdeny to reject request",plr)
ttimeouts <- NewTimer("ttimeout",30000,player.ID,1)
}
}
}
}





this is on playerstats

t = false;
    cost = 0;
      waiting = false;
     id = 0;
    name = false;

.

So what's the error message? Do you expect me to guess? Do you think that by giving me that portion of code, I'm just able to test that on my machine?

Man, what the f*k is wrong with you people? Why do I have to waste a couple of posts with you just to get a simple f*ing message of the thrown error.

Well, if you're too lazy to post a simple f*ing error message then I'll also be lazy enough to ignore your stupid question.

Sorry for the outrage bit it's getting ridiculous. Have some god damn respect people. How many times do I have to waste time telling you to be specific.
.

MacTavish

Too confusing code :-\ and you are trying to sell and person ??? status[plr.ID].cost afaik it should be status[veh.ID].cost

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

Retired VC:MP Player/Scripter :P

KingOfVC


Kratos_


local plr = FindPlayer( status[ plr.ID ].tname )
tname isn't the member variable of your class . If its a string then it will throw error as FindPlayer expects an integer .
In the middle of chaos , lies opportunity.

PsyChO_KiLLeR

i set it kratos but error is comparsion between 12000 the money i carry and 1 that the cost of tradecar

.

#6
Quote from: PsyChO_KiLLeR on Mar 07, 2015, 12:10 PMi set it kratos but error is comparsion between 12000 the money i carry and 1 that the cost of tradecar

Do you even understand your self? I'm just curious, that's all.
.

PsyChO_KiLLeR


.

.

PsyChO_KiLLeR

i know what u feel but i want help on this topic

DizzasTeR

Quote from: PsyChO_KiLLeR on Mar 07, 2015, 12:27 PMi know what u feel but i want help on this topic

You don't have a brain which understands the term 'help', SLC and other guys here are trying to help a guy without a brain from a long time now....

rObInX

#11
else if ( player.Cash.tointeger() < cost.tointeger() ) ePrivMessage("Error: You need $ [ " + cost + " ] to buy this vehicle.",player)
Give complete information next time.
You sure you created it? Only a guy with working brain can script.

PsyChO_KiLLeR

thanks but now error getting on

else if ( cmd == "taccept" )
{
local cost = status[ player.ID ].cost
local IDS = status[ player.ID ].id
if ( status[ player.ID ].waiting == false ) ePrivMessage("Error: You dont have pending request.",player)
 else if ( player.Cash.tointeger() < cost.tointeger() ) ePrivMessage("Error: You need $ [ " + cost + " ] to buy this vehicle.",player)
else
{
Here local plr = FindPlayer( status[ plr.ID ].name )
QuerySQL( db, "UPDATE Cars SET Owner='" + player.Name + "' WHERE ID='" + IDS + "'" );
ePrivMessage( "You have purchased the vehicle ID [ " + IDS + " ]", player );
DecCash( player , status[ player.ID ].cost )
ePrivMessage("You have selling vehicle ID [ " + IDS + " ]",plr)
IncCash( plr , status[ player.ID ].cost )
status[ player.ID ].cost = null
status[ player.ID ].waiting = false
status[ player.ID ].id = null
status[ player.ID ].name = null
status[ plr.ID ].t = false
ttimeouts.Stop()
}

Kratos_

#13
Quote from: PsyChO_KiLLeR on Mar 07, 2015, 01:34 PMHere local plr = FindPlayer( status[ plr.ID ].name )

Quote from: Kratos_ on Mar 07, 2015, 11:41 AMFindPlayer expects an integer .

plr isn't defined & you're using him in array index .
In the middle of chaos , lies opportunity.

PsyChO_KiLLeR

cant understand