Jump to content

job :(


mars

Recommended Posts

Posted

hey guys,

i was trying to make a bus job right now :lol:

i'm kinda addicted to scripting :oops:

but i made this in like, idk, 1 min? :roll::lol:

but it doesn't work :x

function startbus (thePlayer, command )
     veh = getPedOccupiedVehicle ( thePlayer )
	if (veh == 431) then
		my = createMarker ( -2196, 324, 34, "cylinder", 3, 255, 255, 0, 70 )
		setElementVisibleTo ( my, getRootElement(), true )
		setElementVisibleTo ( my, thePlayer, true )
		outputChatBox ( "#FF0000[bus Companie] #00FF00get to the first station, dont get too late!", thePlayer, 255, 255, 255, true )
	end
end
addCommandHandler("startbus", startbus)
addEventHandler("startbus", getRootElement(), startbus)

if i enter a vehicle, (bus) and i type /startbus , it should make a marker and say [bus Companie] go to the first station, dont get to late!

but 1, the marker doesn't show up ^^''

and you can guess, 2. he doesn't say crap xD

Posted
hey guys,

i was trying to make a bus job right now :lol:

i'm kinda addicted to scripting :oops:

but i made this in like, idk, 1 min? :roll::lol:

but it doesn't work :x

function startbus (thePlayer, command )
     veh = getPedOccupiedVehicle ( thePlayer )
	if (veh == 431) then
		my = createMarker ( -2196, 324, 34, "cylinder", 3, 255, 255, 0, 70 )
		setElementVisibleTo ( my, getRootElement(), true )
		setElementVisibleTo ( my, thePlayer, true )
		outputChatBox ( "#FF0000[bus Companie] #00FF00get to the first station, dont get too late!", thePlayer, 255, 255, 255, true )
	end
end
addCommandHandler("startbus", startbus)
addEventHandler("startbus", getRootElement(), startbus)

if i enter a vehicle, (bus) and i type /startbus , it should make a marker and say [bus Companie] go to the first station, dont get to late!

but 1, the marker doesn't show up ^^''

and you can guess, 2. he doesn't say crap xD

1. you need a command, so delete addEventHandler ;)

2. my is wrong, it cant like that;)

What you say right now is: only the marker can see the marker, and: the marker can see you.

use this:

function startbus (thePlayer, command )
	veh = getPedOccupiedVehicle ( thePlayer )
	if (veh == 431) then
		my = createMarker ( -2196, 324, 34, "cylinder", 3, 255, 255, 0, 70, thePlayer )
		outputChatBox ( "#FF0000[bus Companie] #00FF00get to the first station, dont get too late!", thePlayer, 255, 255, 255, true )
	end
end
addCommandHandler("startbus", startbus)

Posted
function startbus (thePlayer, command )
     veh = getPedOccupiedVehicle ( thePlayer )
if (veh == 431) then
        my = createMarker ( -2196.12, 324.12, 34.12, "cylinder", 2.5, 255, 255, 0, 255, thePlayer )
outputChatBox ( "#FF0000[bus Companie] #00FF00get to the first station, dont get too late!", thePlayer, 255, 255, 255)
end
end
addCommandHandler("startbus", startbus)

Should Work.

http://www.sincitygaming.net - The next generation of gaming!

SinCity Gaming | UltiRace 24/7 - 188.165.199.162:22003

SinCity Gaming | Roleplay Gaming - Beta soon!

SinCity Gaming | Zombie Mode + - 188.165.199.162:22005

Instead of using ip: 188.165.199.162 you can use: sincitygaming.net

Posted
Should Work.

Eh, no.

Let me quote what DarkDragon said what the problem was:

the problem in this code is that a vehicle element will never be equal to a number/integer. use getElementModel to get the vehicle model id

Therefore, this should do the trick:

function startbus (thePlayer, command )
     veh = getPedOccupiedVehicle ( thePlayer )
if (getElementModel(veh) == 431) then -- Here's the fix dragon suggested
        my = createMarker ( -2196.12, 324.12, 34.12, "cylinder", 2.5, 255, 255, 0, 255, thePlayer )
outputChatBox ( "#FF0000[bus Company] #00FF00Get to the first station, don't get too late!", thePlayer, 255, 255, 255) -- Company is with a Y, and don't should have an '
end
end
addCommandHandler("startbus", startbus)

Projects:

Slothbot | Maximap

Posted

the above post seems just fine to me but you might wanna try making the function name (startbus) different from the command name(startbus)

crysis-02.png
Posted
the above post seems just fine to me but you might wanna try making the function name (startbus) different from the command name(startbus)

That shouldn't really matter.

Do NOT PM ME for help unless invited. - New MTA Script Editor

Scripting help "etiquette": understandable language, relevant code (ALL code if unsure), [Lua] tags, error messages with line numbers. Super simple stuff.

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...