Snow-Man Posted February 25, 2014 Posted February 25, 2014 How can i make, when i buy car from vehicle Shop, the Car will be Added to grid list of Panel hiding and picking Cars Other question what's should i use function to pick, hide, Mark, Sell Vehicle I hope you Help Me Now
Moderators Citizen Posted February 25, 2014 Moderators Posted February 25, 2014 Show us the code of the vehicle shop (when you buy a vehicle) or if it's a resource you downloaded, the link to that resource. Also show us the code of the gridlist you want to add cars into. And please, can you explain better what you want your script to do (step by step if needed). What do you mean by hide and mark a car ??
Snow-Man Posted February 25, 2014 Author Posted February 25, 2014 Show us the code of the vehicle shop (when you buy a vehicle) or if it's a resource you downloaded, the link to that resource.Also show us the code of the gridlist you want to add cars into. And please, can you explain better what you want your script to do (step by step if needed). What do you mean by hide and mark a car ?? I ment By Hiding Car to Destroy it from MTA world Marking Car using createBlipAttachedTo
Moderators Citizen Posted February 25, 2014 Moderators Posted February 25, 2014 Ok and what about the code/resource link ?!
Snow-Man Posted February 25, 2014 Author Posted February 25, 2014 Ok and what about the code/resource link ?! Please Read My first Post Again
Moderators Citizen Posted February 25, 2014 Moderators Posted February 25, 2014 Ok and what about the code/resource link ?! Please Read My first Post Again I don't see any code or link to a resource. Do you ?
WhoAmI Posted February 25, 2014 Posted February 25, 2014 He wants do to resource by his own i guess. You can do it by XML or table. Table is easier way. vehicles = { {"Vehicle name", "price"}, {"Bullet", "300000"} } function showAvailibleCars (player) for k,v in ipairs(vehicles) do outputChatBox("Name: "..v[1]..", Price: "..v[2].."$", player) end end addCommandHandler("show_vehicles", showAvailibleCars) By using /show_vehicles you can see all vehicle which you put in table. Now you can do similar think using UI.
.:HyPeX:. Posted February 26, 2014 Posted February 26, 2014 He wants do to resource by his own i guess. You can do it by XML or table. Table is easier way. vehicles = { {"Vehicle name", "price"}, {"Bullet", "300000"} } function showAvailibleCars (player) for k,v in ipairs(vehicles) do outputChatBox("Name: "..v[1]..", Price: "..v[2].."$", player) end end addCommandHandler("show_vehicles", showAvailibleCars) By using /show_vehicles you can see all vehicle which you put in table. Now you can do similar think using UI. But Tables are lost on script unload (It will be on every join to the server if client, or on every script restart if server)
.:HyPeX:. Posted February 26, 2014 Posted February 26, 2014 He wants do to resource by his own i guess. You can do it by XML or table. Table is easier way. vehicles = { {"Vehicle name", "price"}, {"Bullet", "300000"} } function showAvailibleCars (player) for k,v in ipairs(vehicles) do outputChatBox("Name: "..v[1]..", Price: "..v[2].."$", player) end end addCommandHandler("show_vehicles", showAvailibleCars) By using /show_vehicles you can see all vehicle which you put in table. Now you can do similar think using UI. But Tables are lost on script unload (It will be on every join to the server if client, or on every script restart if server)
xXMADEXx Posted February 26, 2014 Posted February 26, 2014 He wants do to resource by his own i guess. You can do it by XML or table. Table is easier way. vehicles = { {"Vehicle name", "price"}, {"Bullet", "300000"} } function showAvailibleCars (player) for k,v in ipairs(vehicles) do outputChatBox("Name: "..v[1]..", Price: "..v[2].."$", player) end end addCommandHandler("show_vehicles", showAvailibleCars) By using /show_vehicles you can see all vehicle which you put in table. Now you can do similar think using UI. But Tables are lost on script unload (It will be on every join to the server if client, or on every script restart if server) I think he was meaning just for the vehicles table...To save the vehicles you should use SQLite or MySQL.
Snow-Man Posted February 26, 2014 Author Posted February 26, 2014 theWindow = guiCreateWindow(x,y,width,height,"Car Features",false) guiWindowSetSizable(theWindow,false) guiSetVisible (theWindow, false) spawnBut = guiCreateButton(0.0604,0.120,0.4,0.2,"Spawn",true,theWindow) engenieBut = guiCreateButton(0.0604,0.420,0.4,0.2,"Engenie",true,theWindow) lockBut = guiCreateButton(0.490,0.420,0.4,0.2,"Lock",true,theWindow) lightsBut = guiCreateButton(0.0604,0.720,0.4,0.2,"Lights",true,theWindow) destroyBut = guiCreateButton(0.490,0.120,0.4,0.2,"Destroy",true,theWindow) I ment like this i ment when i Buy car from Vehicle shop, the Car i boughg it will be in that Panel and i asked about how i can i : Spawn / Destroy cars
Karuzo Posted February 26, 2014 Posted February 26, 2014 You have to save the vehicles which the players bought first. Example : in MySql, xml, or acc-datas. Then you just get the car and let it spawn. And to destroy: Just check if the car is spawned or smth like that and then destroy it.
Snow-Man Posted February 26, 2014 Author Posted February 26, 2014 You have to save the vehicles which the players bought first.Example : in MySql, xml, or acc-datas. Then you just get the car and let it spawn. And to destroy: Just check if the car is spawned or smth like that and then destroy it. How can i make when i bought car, it'll be shown in grislidt with XML ?
WhoAmI Posted February 27, 2014 Posted February 27, 2014 Use xml functions, especially xmlCreateChild, xmlNodeSetAttribute. Save also account name with car and when you will spawn car, set data (setElementData) with account name. For example.: >model="1" x="1" y="1" z="1" account="acccount_name">>> function addVehicle (model, x, y, z, account_name) local file = xmlLoadFile("file.xml") --can be .map too local vehs = xmlCreateChild(file, "vehicle") -- adding a child to file if (texts) then xmlNodeSetAttribute(vehs, "model", model) --setting atribute to created child xmlNodeSetAttribute(vehs, "x", x) xmlNodeSetAttribute(vehs, "y", y) xmlNodeSetAttribute(vehs, "z", z) xmlNodeSetAttribute(vehs, "account_name", account_name) end xmlSaveFile(file) --saving and unloading file xmlUnloadFile(file) end
WASSIm. Posted February 27, 2014 Posted February 27, 2014 function addVehicle (model, x, y, z, account_name) local file = xmlLoadFile("file.xml") --can be .map too if not (file) then file = xmlCreateFile("file.xml","file") --create file if not exists end local vehs = xmlCreateChild(file, "vehicle") -- adding a child to file if (vehs) then xmlNodeSetAttribute(vehs, "model", model) --setting atribute to created child xmlNodeSetAttribute(vehs, "x", x) xmlNodeSetAttribute(vehs, "y", y) xmlNodeSetAttribute(vehs, "z", z) xmlNodeSetAttribute(vehs, "account_name", account_name) end xmlSaveFile(file) --saving file xmlUnloadFile(file) --unloading file end
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