EddyHoff Posted April 21, 2011 Share Posted April 21, 2011 Hi guys, im new in this forum, greetings evryone! Well this is my case... Im starting on lua a couple weeks ago, i know some scripts types like javascript and these internet scripts, I've done some lua systems yet, but i have a problem here. I try to make a button that spawns the player's vehicle if the vehicle still alive, if not, create his vehicle aside him. (the vehicle appears aside his owner) I cant reSpawn the vehicle, how to use the function spawnVehicle to find some specific vechicle?? i can use a variable that contains the createVehicle() but everytime a player press the button and create his vehicle, the variable got the new values from the new vehicle (the variable that contains the createVehicle() and the spawn system is on the server) and spawns the new car of the last player that create his car aside him...... if i denominate a variable that contains the createVehicle() and this variable is on server-side, everytime a player push the button in their menu, the variable get the new info, and if someone else push the button, gonna spawn the last vehicle in the variable.... I dont need a script, i need u to tell me a way to do this spawn vehicle by owner system i tried to attach the player's name to the car, and i got it succesfully checking this data from the cars alive on server, but even if the vehicle have the name of the user stored on the data, i dont know how to reSpawn the car that contains the name of the user who trigger this function.... spawnVehicle(how to know the correct vehicle in server to spawn, x+5, y+5, z+5) the info of the buyed cars in on sql databases, they can create their vehicles a lot of times, the vehicle that they buyed... but... i dont want them to spawn it infinite times..... if the vehicle is true, they cant createIt until is destroyed, until that they spawn the createdVehicle (get the original first vehicle they created form the sql) obviously the createdVehicle is stored in a variable, but if is stored on the variable..... i explained all yet... they get the new vechicleCreated on the variable, from a new user... I really dont know how to do this... i got succesfull scripts in my other systems... but... damn i cant do this... store the variable on client side?? but the variable contains a createVehicle() that dont works on client side... i need it in server... please if i wrote my question clearly, give me a suggestion of how to store a player's vehicle and spawn it by this data... thanx for reading, i know im a begginer... but a good begginer Link to comment
Wojak Posted April 21, 2011 Share Posted April 21, 2011 create a empty table serverside, when the resource starts vehicles = {} when the player press the button, send the player element to the server via event and cteate the vehicle like this: vehicles[player who press the button] = createVehicle(...) you can check if the vehicle exists by: if isElement(vehicles[player who press the button]) then ... end 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