Jump to content

Prooobleeeeeeeeem :(


MR.GRAND

Recommended Posts

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 by Guest
Link to comment
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

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