mars Posted November 14, 2009 Share Posted November 14, 2009 hey guys, i was trying to make a bus job right now i'm kinda addicted to scripting but i made this in like, idk, 1 min? but it doesn't work 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 Link to comment
JasperNL=D Posted November 14, 2009 Share Posted November 14, 2009 hey guys,i was trying to make a bus job right now i'm kinda addicted to scripting but i made this in like, idk, 1 min? but it doesn't work 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 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) Link to comment
Dark Dragon Posted November 14, 2009 Share Posted November 14, 2009 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 Link to comment
mars Posted November 14, 2009 Author Share Posted November 14, 2009 okay, but still the marker doesn't come up. Link to comment
Dzakub Posted November 15, 2009 Share Posted November 15, 2009 I think the problem is in createMarker, exactly in the alpha argument, try to set it to 255. Link to comment
Taalasmaa Posted November 16, 2009 Share Posted November 16, 2009 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. Link to comment
Gamesnert Posted November 16, 2009 Share Posted November 16, 2009 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) Link to comment
jkub Posted November 16, 2009 Share Posted November 16, 2009 the above post seems just fine to me but you might wanna try making the function name (startbus) different from the command name(startbus) Link to comment
robhol Posted November 16, 2009 Share Posted November 16, 2009 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. 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