MR.GRAND Posted April 21, 2016 Share Posted April 21, 2016 (edited) Hello guys look at this player[source] = getPlayerSerial(source) this player source for get player serial i put it in event # addEventHandler( 'onVehicleStartEnter', resourceRoot, function(thePlayer) if (getPlayerSerial(thePlayer) ~= player[thePlayer]) then cancelEvent() outputChatBox(tostring(player[thePlayer]).."2222") else outputChatBox(tostring(player[thePlayer])) end end) here i check if the player == player[source] in that event or not if not he can't enter in that car to now the code ok but if another one create car ___ i can enter to his car and he can enter to my car so all that is bug anyone can help me ? i want only this one player[source] = getPlayerSerial(source) can enter to his car as a driver and another one can not enter as a driver Heeelpppp Edited April 21, 2016 by Guest Link to comment
Simple0x47 Posted April 21, 2016 Share Posted April 21, 2016 Did you make player a table? Because I think it's a pre-defined variable. So make a table p = {}. Link to comment
MR.GRAND Posted April 21, 2016 Author Share Posted April 21, 2016 Did you make player a table? Because I think it's a pre-defined variable. So make a table p = {}. Vehicle_ = {} player = {} addEvent('createUSERcar', true) addEventHandler( 'createUSERcar', root, function(getCarID, Serial) local x, y, z = getElementPosition(source) if (not isElement(Vehicle_[source])) then Vehicle_[source] = createVehicle( getCarID, x + 2, y + 2, z + 1) else destroyElement(Vehicle_[source]) Vehicle_[source] = createVehicle( getCarID, x + 2, y + 2, z + 1) end end ) help ? Link to comment
MR.GRAND Posted April 21, 2016 Author Share Posted April 21, 2016 No one can help ? ((((( Link to comment
MR.GRAND Posted April 22, 2016 Author Share Posted April 22, 2016 No one can replay ? Link to comment
Moderators IIYAMA Posted April 22, 2016 Moderators Share Posted April 22, 2016 use the serial as key: local serialToPlayer = {} serialToPlayer[getPlayerSerial(source)] = source if serialToPlayer[getPlayerSerial(thePlayer)] then 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