Jump to content

onVehicleStartEnter problem


Guest

Recommended Posts

Guys i have made this code to make non vips players can't enter hydra

vipVehicles = { [520]=true }
local cuenta = getAccountName( getPlayerAccount(thePlayer) )
if isObjectInACLGroup("user."..cuenta, aclGetGroup("VIP")) then --Group VIP
	spaces(thePlayer)
function onVehicleStartEnter ( enteringPlayer, seat, jacked, door )
	outputChatBox ( "● You must be vip to enter this vehicle", thePlayer, 0, 255, 0 ) -- and tell the player why
end
end
addEventHandler ( "onVehicleStartEnter", getRootElement(), onVehicleStartEnter )

What is wrong with it ?

Link to comment
vipVehicles = { [520]=true }

function onVehicleStartEnter ( enteringPlayer, seat, jacked, door )
local cuenta = getAccountName( getPlayerAccount(thePlayer) )
if isObjectInACLGroup("user."..cuenta, aclGetGroup("VIP")) then --Group VIP
	spaces(thePlayer)
else
	outputChatBox ( "● You must be vip to enter this vehicle", thePlayer, 0, 255, 0 ) -- and tell the player why
end
end
addEventHandler ( "onVehicleStartEnter", getRootElement(), onVehicleStartEnter )

I Don't understand the spaces part though, could you explain what is its purpose?

Link to comment

Thanks you but you forgot to change

local cuenta = getAccountName( getPlayerAccount(thePlayer) ) to enteringPlayer

Btw  wan't to ask you 

meta was like this  " client " , did not work

<meta>
	<script src="client.lua" type="client" />
</meta>

So when i changed it to server.lua and type="client" worked

how can i know that file is client or server and when i must create 2 files ( client + server ) 

Edited by Guest
Link to comment

Just change thePlayer to source in your getPlayerAccount variable

A client script is what is executed on the player's computer directly, not on the server. A client script doesn't use variables like thePlayer and such because everything is source related in general.

Edited by Galactix
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...