Gordon_G Posted August 23, 2016 Share Posted August 23, 2016 Hello ! So maybe you will think I'm stupide but I have a basic question ... I try to make something like this : server -> client -> server. Show that : -- first : Server function perceporte2(source) pos1,pos2,pos3 = getElementPosition(source) perceporteobject = createObject(3031,pos1,pos2,pos3) triggerClientEvent("perceporteson2",source, pos1,pos2,pos3) end addCommandHandler("perceporte2", perceporte2) -- second : Client addEvent("perceporteson2", true) function perceporteson2(a,b,c) local perceporteson = playSound3D("perce-porte.wav",a,b,c,true) setTimer( function(a) stopSound(perceporteson) triggerServerEvent("portelocked2",localPlayer) end, 1000,1,perceporteson) end addEventHandler("perceporteson2", getRootElement(),perceporteson2) -- third : Server function portelocked2() destroyElement(perceporteobject) end addEventHandler("portelocked2", getRootElement(), portelocked2) It's not exactly what I want to make but it's the idea so, don't say me : "Just make the commandHandler in client script." Ok, the script work but ... When there is two players ... So someone could explain me ? Please Link to comment
roaddog Posted August 23, 2016 Share Posted August 23, 2016 (edited) Make a table for the object each player. like perceporteobject = {} -- place this on top of the script --Then instead of perceporteobject on line 5, it should be perceporteobject[source] = createObject(...) -- store createObject for said player to the table --and then to destroy it if isElement(perceporteobject[source]) then destroyElement(perceporteobject[source]) end Edited August 23, 2016 by Guest Link to comment
Gordon_G Posted August 23, 2016 Author Share Posted August 23, 2016 Ok, I will try that when my friend will be here, thanks ! 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