Jump to content

[HELP] Adding Vehicle To Gridlist


Snow-Man

Recommended Posts

  • Moderators
Posted

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 ??

The rEvolution is coming ...

Posted
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

USC Informations

Head Staff & Owner Of USC.

Youtube Channel : My Channel

350x20_FFFFFF_FFFFFF_A89999_080404.png

 

  • Moderators
Posted
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 ?

The rEvolution is coming ...

Posted

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.

Posted
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)

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

Posted
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)

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

Posted
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.

Posted
  
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

USC Informations

Head Staff & Owner Of USC.

Youtube Channel : My Channel

350x20_FFFFFF_FFFFFF_A89999_080404.png

 

Posted

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.

Posted
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 ?

USC Informations

Head Staff & Owner Of USC.

Youtube Channel : My Channel

350x20_FFFFFF_FFFFFF_A89999_080404.png

 

Posted

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 

Posted
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 

Omerta Roleplay

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...