Dziugasc Posted December 2, 2017 Share Posted December 2, 2017 So i have few problems so first of all i can't find how to fix error : [16:46:04] ERROR: carsell\utils.lua:11: attempt to concatenate a boolean value next problem that i couldn't find how to make car worth according it's health and model for exampe infernus 100% health would give you 22k Shamal 100% would give you 30k rhino 100% 20k etc so what i need is just what to use code: local sellMarker = createMarker( -1545.0999755859, 126.80000305176, 2.5, "cylinder", 22, 255, 0, 0, 120) local myBlip = createBlip( -1545.0999755859, 126.80000305176, 3.5999999046326, 55, 1.5, 255, 0, 255, myPlayer ) function sellVehicle(player) if (getElementType(player) == "player") then if (not getPedOccupiedVehicle(player)) then outputChatBox("You need to be in a Vehicle to sell it.", player, 255, 0, 0) return end end end local vehicle = getPedOccupiedVehicle(player) local reward = math.random(100, 10000) --every -1% from car vehicle worth becomes 100$ smaller example 100%=10k 10%=1k givePlayerMoney(player, reward) outputChatBox("You have sold the "..getVehicleName(vehicle).. " for "..reward.."!", player, 0, 255, 0) addEventHandler("onMarkerHit", sellMarker, sellVehicle) thanks. Link to comment
Moderators IIYAMA Posted December 2, 2017 Moderators Share Posted December 2, 2017 you might want to put the code inside of the function and inside of the CODE BLOCK AT LINE 4. Your function ends at line 7. Link to comment
Dziugasc Posted December 2, 2017 Author Share Posted December 2, 2017 4 minutes ago, IIYAMA said: you might want to put the code inside of the function and inside of the CODE BLOCK AT LINE 4. Your function ends at line 7. oh thanks Link to comment
Dziugasc Posted December 2, 2017 Author Share Posted December 2, 2017 15 minutes ago, IIYAMA said: you might want to put the code inside of the function and inside of the CODE BLOCK AT LINE 4. Your function ends at line 7. now i fixed bugs but now i made that it would destroy car but i want that it wouldn't destroy but kick me out of vehicle and respawn it and other question how to make vehicle worth with table like this? local Planes = {"Beagle","Shamal","Dodo","Nevada","Crop Dustler","Stuntplane"} Link to comment
Moderators IIYAMA Posted December 2, 2017 Moderators Share Posted December 2, 2017 local prices = {["Beagle"] = 300, ["Shamal"] = 30,["Dodo"] = 0, ["Nevada"] = 1000, ["Crop Dustler"] = 2435, ["Stuntplane"] = 3435} iprint(prices["Dodo"]) -- price: 0 (I don't pay for dead stuff) 1 Link to comment
Dziugasc Posted December 2, 2017 Author Share Posted December 2, 2017 Just now, IIYAMA said: local prices = {["Beagle"] = 300, ["Shamal"] = 30,["Dodo"] = 0, ["Nevada"] = 1000, ["Crop Dustler"] = 2435, ["Stuntplane"] = 3435} iprint(prices["Dodo"]) -- price: 0 (I don't pay for dead stuff) thanks! 1 Link to comment
Dziugasc Posted December 2, 2017 Author Share Posted December 2, 2017 (edited) so i made that it would kick player out of vehicle and lock it and re spawn it to spawn point but it re spawns vehicle locked i want it to be unlocked when it respawns code: local sellMarker = createMarker( -1545.0999755859, 126.80000305176, 2.5, "cylinder", 22, 255, 0, 0, 120) local myBlip = createBlip( -1545.0999755859, 126.80000305176, 3.5999999046326, 55, 1.5, 255, 0, 255, player ) function sellVehicle(player) if (getElementType(player) == "player") then if (not getPedOccupiedVehicle(player)) then outputChatBox("You need to be in a Vehicle to sell it.", player, 255, 0, 0) return end local vehicle = getPedOccupiedVehicle(player) local prices = math.random(4000, 10000) givePlayerMoney(player, prices) outputChatBox("You have sold the "..getVehicleName(vehicle).. " for "..prices.."!", player, 0, 255, 0 ) setVehicleLocked ( vehicle, true ) removePlayerFromVehicle ( player ) setTimer(respawnVehicle, 5000, 1, vehicle ) end end end addEventHandler("onMarkerHit",sellMarker, sellVehicle, carRespawn) Edited December 2, 2017 by Dziugasc Link to comment
Mr.Loki Posted December 2, 2017 Share Posted December 2, 2017 local sellMarker = createMarker( -1545.0999755859, 126.80000305176, 2.5, "cylinder", 22, 255, 0, 0, 120) local myBlip = createBlip( -1545.0999755859, 126.80000305176, 3.5999999046326, 55, 1.5, 255, 0, 255, player ) function sellVehicle(player) if (getElementType(player) == "player") then if (not getPedOccupiedVehicle(player)) then outputChatBox("You need to be in a Vehicle to sell it.", player, 255, 0, 0) return end local vehicle = getPedOccupiedVehicle(player) local prices = math.random(4000, 10000) givePlayerMoney(player, prices) outputChatBox("You have sold the "..getVehicleName(vehicle).. " for "..prices.."!", player, 0, 255, 0 ) setVehicleLocked ( vehicle, true ) removePlayerFromVehicle ( player ) setTimer(function(veh) respawnVehicle(veh) setVehicleLocked(veh,false) end,5000,1,vehicle) end end end addEventHandler("onMarkerHit",sellMarker, sellVehicle, carRespawn) 1 Link to comment
Dziugasc Posted December 2, 2017 Author Share Posted December 2, 2017 (edited) 1 hour ago, Mr.Loki said: local sellMarker = createMarker( -1545.0999755859, 126.80000305176, 2.5, "cylinder", 22, 255, 0, 0, 120) local myBlip = createBlip( -1545.0999755859, 126.80000305176, 3.5999999046326, 55, 1.5, 255, 0, 255, player ) function sellVehicle(player) if (getElementType(player) == "player") then if (not getPedOccupiedVehicle(player)) then outputChatBox("You need to be in a Vehicle to sell it.", player, 255, 0, 0) return end local vehicle = getPedOccupiedVehicle(player) local prices = math.random(4000, 10000) givePlayerMoney(player, prices) outputChatBox("You have sold the "..getVehicleName(vehicle).. " for "..prices.."!", player, 0, 255, 0 ) setVehicleLocked ( vehicle, true ) removePlayerFromVehicle ( player ) setTimer(function(veh) respawnVehicle(veh) setVehicleLocked(veh,false) end,5000,1,vehicle) end end end addEventHandler("onMarkerHit",sellMarker, sellVehicle, carRespawn) Thanks okay topic locked (all problems was solved) Edited December 2, 2017 by Dziugasc if someone want to help me with free-roam server pm i have many great ideas and i need help :) Link to comment
Storm-Hanma Posted December 3, 2017 Share Posted December 3, 2017 17 hours ago, Dziugasc said: Thanks okay topic locked (all problems was solved) I want to help u I too have freeroam server so let me help ur server to come pm we discuss Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now