Amine#TN Posted March 13, 2017 Share Posted March 13, 2017 vehicle = createVehicle( 503, 1513.61328125, -1479.384765625, 9.7, 0, 0, 272 ) setVehicleColor( vehicle, 0, 0, 0 ) ID = 3 myBlip = createBlipAttachedTo ( vehicle, ID ) function lockPrivate( theplayer, seat, jacked ) if ( source == vehicle ) then local account = getPlayerAccount( theplayer ) local accountName = ( account and getAccountName ( account ) or "" ) if not( accountName == "Quiel1290" or accountName == "noOne" ) then cancelEvent() outputChatBox("#9E0000This vehicle is locked for following users:#0D9905 |GB|{Q}uiel #9E0000Shared With #0D9905NoOne ", theplayer, 255, 255, 255, true) else outputChatBox("#0D9905Welcome to your vehicle, Sir!", theplayer, 255, 255, 255, true) end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), lockPrivate ) setVehicleDamageProof(vehicle, true) ------------ i need some one who can make only the driver seat private and other players can ride other seats 1 Link to comment
LoPollo Posted March 13, 2017 Share Posted March 13, 2017 (edited) There's one more parameter you could be interested in: onVehicleStartEnter player enteringPlayer, int seat, player jacked, int door Edited March 13, 2017 by LoPollo Link to comment
_DrXenon Posted March 13, 2017 Share Posted March 13, 2017 this means you should replace this with the first if statement in your script if source == vehicle and seat == 0 then Link to comment
Amine#TN Posted March 14, 2017 Author Share Posted March 14, 2017 Not working any other idea and thanx 1 Link to comment
Moderators Citizen Posted March 14, 2017 Moderators Share Posted March 14, 2017 Test again. What SuperCroz said is right, this should work as attended. If you can not enter the vehicle, then it's probably because you are not logged in, or if you are, maybe with the wrong account. Try printing the accountName value to check that. Also, tell us what you get in the chatbox if it's not working. Link to comment
Amine#TN Posted March 14, 2017 Author Share Posted March 14, 2017 that is the problem i need only the driver seat is private other account names are allowed to use others seats 1 Link to comment
Moderators Citizen Posted March 14, 2017 Moderators Share Posted March 14, 2017 Yeah then: 8 hours ago, Citizen said: Test again. What SuperCroz said is right, this should work as attended. If you can not enter the vehicle, then it's probably because you are not logged in, or if you are, maybe with the wrong account. Try printing the accountName value to check that. Also, tell us what you get in the chatbox if it's not working. Link to comment
Amine#TN Posted March 14, 2017 Author Share Posted March 14, 2017 OK But now i need help 1 Link to comment
_DrXenon Posted March 14, 2017 Share Posted March 14, 2017 this is enough to get the account name of a player local accountName = getAccountName(account) No need for the function you were using and I have no idea whether it even works this way. Link to comment
Amine#TN Posted March 14, 2017 Author Share Posted March 14, 2017 bro the script working good but i need to make only seat 0 is private other seats are allowed for all 1 Link to comment
_DrXenon Posted March 14, 2017 Share Posted March 14, 2017 will you mind deleting everything in your file and pasting that code below instead and then test? vehicle = createVehicle( 503, 1513.61328125, -1479.384765625, 9.7, 0, 0, 272 ) setVehicleColor( vehicle, 0, 0, 0 ) ID = 3 myBlip = createBlipAttachedTo ( vehicle, ID ) function lockPrivate( theplayer, seat, jacked ) if source == vehicle and seat == 0 then local account = getPlayerAccount( theplayer ) local accountName = (getAccountName ( account ) ) if not( accountName == "Quiel1290" or accountName == "noOne" ) then cancelEvent() outputChatBox("#9E0000This vehicle is locked for following users:#0D9905 |GB|{Q}uiel #9E0000Shared With #0D9905NoOne ", theplayer, 255, 255, 255, true) else outputChatBox("#0D9905Welcome to your vehicle, Sir!", theplayer, 255, 255, 255, true) end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), lockPrivate ) setVehicleDamageProof(vehicle, true) Link to comment
Amine#TN Posted March 14, 2017 Author Share Posted March 14, 2017 thanx it is working 1 Link to comment
^iiEcoo'x_) Posted March 15, 2017 Share Posted March 15, 2017 20 hours ago, A.mine said: thanx it is working Use Table , Link to comment
Amine#TN Posted March 15, 2017 Author Share Posted March 15, 2017 table of what bro 1 Link to comment
^iiEcoo'x_) Posted March 15, 2017 Share Posted March 15, 2017 (edited) 25 minutes ago, A.mine said: table of what bro Vehicle ! -- # Example local Table = { } addCommandHandler ("Car", function ( player ) local x , y , z = getElementPosition ( player ) local Table[player] = createVehicle( id , x , y , z ) end ) addEventHandler ("onPlayerQuit",root, if isElement ( Table[source] ) then destroyElement ( Table[source] ) Table[source] = nil end end ) Edited March 15, 2017 by #_iMr.[E]coo Link to comment
Amine#TN Posted March 15, 2017 Author Share Posted March 15, 2017 i did not need it when the player want his car he must go to the place where i create it and thanx 1 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