Jump to content

Could someone help me?


Pedro001

Recommended Posts

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
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
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 by Mr.Loki
  • Like 1
  • Thanks 1
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...