Sign in to follow this  
Pedro001

Could someone help me?

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)
	

 

Share this post


Link to post
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)

 

Share this post


Link to post
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

Share this post


Link to post
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! 😁

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.