Jump to content

please need help with my carspawn script


Recommended Posts

Need help:(

when i bought 2 car in shop 1 on buycar 1 and 1 on buycar2 he give on carspawn 1and2 the buycar2

and there is a warning in me Menu for getElementdata for car 1 and 2 pls help me :-)

he gives a WARNING the get elementdata i fault the problem 2 for vehicle2: if (getElementData (source, "hisCar1")) and (getElementType(getElementData (source, "vehicle1")) == "auto1") then

shop

function onClientGUIClick (button, state, absoluteX, absoluteYe)
if (source == auto1) then guiSetVisible (carshopWindow, false) showCursor (false)
if (guiGridListGetSelectedItem (carGridList)) then
local carName1 = guiGridListGetItemText (carGridList, guiGridListGetSelectedItem (carGridList), 1)
local carID1 = getVehicleModelFromName (carName1)
local carCost1 = guiGridListGetItemText (carGridList, guiGridListGetSelectedItem (carGridList), 2)
triggerServerEvent ("carShopCarBuy", getLocalPlayer(), carID1, carCost1, carName1)
end
elseif (source == closeButton) then guiSetVisible (carshopWindow, false) showCursor (false)
end
end
addEventHandler ("onClientGUIClick", getRootElement(), onClientGUIClick)
 
function onClientGUIClick (button, state, absoluteX, absoluteYe)
if (source == auto2) then guiSetVisible (carshopWindow, false) showCursor (false)
if (guiGridListGetSelectedItem (carGridList)) then
local carName2 = guiGridListGetItemText (carGridList, guiGridListGetSelectedItem (carGridList), 1)
local carID2 = getVehicleModelFromName (carName2)
local carCost2 = guiGridListGetItemText (carGridList, guiGridListGetSelectedItem (carGridList), 2)
triggerServerEvent ("carShopCarBuy1", getLocalPlayer(), carID2, carCost2, carName2)
end
elseif (source == closeButton) then guiSetVisible (carshopWindow, false) showCursor (false)
end
end
addEventHandler ("onClientGUIClick", getRootElement(), onClientGUIClick)
 
 
carShopMarker4 = createMarker (-1953.58, 298.74, 34.46875, "cylinder", 1.5, 255, 0, 0, 127)  
 
addEvent ("viewGUI4", true)
function markerHit (hitPlayer, matchingDimension)
if (source == carShopMarker4) then
triggerClientEvent ("viewGUI4", hitPlayer)
outputChatBox ("Welcome to the vehicleshop!", hitPlayer, 255, 0, 0)
end
end
addEventHandler ("onMarkerHit", getRootElement(), markerHit)
 
addEvent ("carShopCarBuy", true)
addEventHandler ("carShopCarBuy", getRootElement(),
function(id1, cost1, name1)
if (getPlayerMoney (source) >= tonumber(cost1)) then
outputChatBox ("Bought a " .. name1, source, 255, 255,255, false)
outputChatBox ("ID1: " .. id1, source, 255, 0, 0, false)
outputChatBox ("Cost1: " .. cost1, source, 255,255,255, false)
takePlayerMoney (source, tonumber (cost1))
setAccountData (getPlayerAccount (source), "funmodev2-car", tonumber(id1))
setAccountData (getPlayerAccount (source), "funmodev2-paintjob", 3)
setAccountData (getPlayerAccount (source), "funmodev2-carupg", 0)
else
outputChatBox ("You are too poor!", source, 255, 0, 0, false)
end
end)
 
addEvent ("carShopCarBuy1", true)
addEventHandler ("carShopCarBuy1", getRootElement(),
function(id2, cost2, name2)
if (getPlayerMoney (source) >= tonumber(cost2)) then
outputChatBox ("Bought a " .. name2, source, 255, 255,255, false)
outputChatBox ("ID2: " .. id2, source, 255, 0, 0, false)
outputChatBox ("Cost2: " .. cost2, source, 255,255,255, false)
takePlayerMoney (source, tonumber (cost2))
setAccountData (getPlayerAccount (source), "funmodev2-car", tonumber(id2))
setAccountData (getPlayerAccount (source), "funmodev2-paintjob", 3)
setAccountData (getPlayerAccount (source), "funmodev2-carupg", 0)
else
outputChatBox ("You are too poor!", source, 255, 0, 0, false)
end
end)

PLS HELP ME thx.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...