Pedro001 Posted September 10, 2018 Share Posted September 10, 2018 Could someone tell me what is wrong with this code, please? I keep getting the message "You can't do it" myVehicle = createVehicle(411,-2668, 1245, 56) setVehicleDamageProof(myVehicle,true) accountName = Sopro function VIPVehicle (thePlayer) outputDebugString("Started") account = getPlayerAccount(thePlayer) local proverka = getAccountName ( account ) if proverka == accountName then outputChatBox("*Welcome.",thePlayer,255,255,0) playSoundFrontEnd(thePlayer,46) else outputChatBox("*You are can't sit in this car!",thePlayer,255,0,0) removePedFromVehicle ( thePlayer ) outputDebugString("Fail") end end addEventHandler("onVehicleEnter",myVehicle,VIPVehicle) function VIPVehicleSpawn (thePlayer) account = getPlayerAccount(thePlayer) local x,y,z = getElementPosition(thePlayer) local proverka = getAccountName ( account ) if proverka == accountName then setElementPosition(myVehicle,x + 5,y,z) else outputChatBox("**You can't do it",thePlayer,255,0,0) end end addCommandHandler("vehh",VIPVehicleSpawn) Link to comment
xMKHx Posted September 10, 2018 Share Posted September 10, 2018 myVehicle = createVehicle(411,-2668, 1245, 56) setVehicleDamageProof(myVehicle,true) accountName == "Sopro" function VIPVehicle (thePlayer) outputDebugString("Started") account = getPlayerAccount(thePlayer) local proverka = getAccountName ( account ) if proverka == accountName then outputChatBox("*Welcome.",thePlayer,255,255,0) playSoundFrontEnd(thePlayer,46) else outputChatBox("*You are can't sit in this car!",thePlayer,255,0,0) removePedFromVehicle ( thePlayer ) outputDebugString("Fail") end end addEventHandler("onVehicleEnter",myVehicle,VIPVehicle) function VIPVehicleSpawn (thePlayer) account = getPlayerAccount(thePlayer) local x,y,z = getElementPosition(thePlayer) local proverka = getAccountName ( account ) if proverka == accountName then setElementPosition(myVehicle,x + 5,y,z) else outputChatBox("**You can't do it",thePlayer,255,0,0) end end addCommandHandler("vehh",VIPVehicleSpawn) Link to comment
Mr.Loki Posted September 10, 2018 Share Posted September 10, 2018 (edited) 5 hours ago, Pedro001 said: Could someone tell me what is wrong with this code, please? I keep getting the message "You can't do it" Your problem is line 4 accountName = Sopro You used Sopro as a variable and not a string. accountName = "Sopro" Edited September 10, 2018 by Mr.Loki 1 1 Link to comment
Pedro001 Posted September 11, 2018 Author Share Posted September 11, 2018 16 hours ago, Mr.Loki said: Your problem is line 4 accountName = Sopro You used Sopro as a variable and not a string. accountName = "Sopro" Waa! Don't know how I didn't think of that! hehe Thank you very much! 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