Jump to content

Prooobleeeeeeeeem :(


MR.GRAND

Recommended Posts

Posted (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 by Guest

 My new GCSS Script : Go 
حصريا : مود الدردشة بين السيرفرات : الذهاب

LUA progress = -100%

Join us :

 Multi Theft Auto Arab 

I'm not the best but, i'm different

Skype : kamel1234128

Someone in this world needs to remember my love .

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

 My new GCSS Script : Go 
حصريا : مود الدردشة بين السيرفرات : الذهاب

LUA progress = -100%

Join us :

 Multi Theft Auto Arab 

I'm not the best but, i'm different

Skype : kamel1234128

Someone in this world needs to remember my love .

  • Moderators
Posted

use the serial as key:

local serialToPlayer = {} 

serialToPlayer[getPlayerSerial(source)] = source 

if serialToPlayer[getPlayerSerial(thePlayer)] then 

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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