Gtagasje Posted December 17, 2011 Posted December 17, 2011 Hi, I wanna create a one of the given markers if you enter a vehicle, and if you are on the team "Criminal". I tried this script [i made it server side]: local criminal = createTeam("Criminal", 255, 0, 0) function createAmarker () if getPlayerTeam(getTeamFromName(criminal)) then theMarkers = { createMarker (0, 0, 20), createMarker (1, 0, 20), createMarker (2, 0, 20), createMarker (3, 0, 20) } markersTable[math.random(#theMarkers)] end end addEventHandler("onVehicleEnter", getRootElement(), createAmarker) but it shows this error: "SCRIPT ERROR: :line 11: '=' expected near end." I don't know how to fix this, I tried a lot of things, but I wasn't able to fix this. Once again in short, I wan't the script to create one of the markers in the script, if the player (on criminal team) enters a vehicle. But it shows that error, which i'm not able to fix. Regards, Gtagasje Yes, this is infact a signature.
Al3grab Posted December 17, 2011 Posted December 17, 2011 well, it can be done like this local criminal = createTeam("Criminal", 255, 0, 0) function randomMarker() randomNum = math.random(1,4) if randomNum == 1 then createMarker (0, 0, 20) elseif randomNum == 2 then createMarker (1, 0, 20) elseif randomNum == 3 then createMarker (2, 0, 20) elseif randomNum == 4 then createMarker (3, 0, 20) end end function createAmarker (plr) if getPlayerTeam(plr) == getTeamFromName("Criminal") then randomMarker() end end addEventHandler("onVehicleEnter", getRootElement(), createAmarker) ING : [xXx]~Al3grab
drk Posted December 17, 2011 Posted December 17, 2011 Try this: local criminal = createTeam("Criminal", 255, 0, 0) function createAmarker () if getPlayerTeam(getTeamFromName(criminal)) then local theMarkers = { createMarker (0, 0, 20), createMarker (1, 0, 20), createMarker (2, 0, 20), createMarker (3, 0, 20) } markersTable[math.random(#theMarkers)] end end addEventHandler("onVehicleEnter", getRootElement(), createAmarker) You need 'local' before theMarkers. EPT Team Server Development: 0% Learning C++ | C++ is amazing
Gtagasje Posted December 17, 2011 Author Posted December 17, 2011 Thanks. Yes, this is infact a signature.
Castillo Posted December 17, 2011 Posted December 17, 2011 local criminal = createTeam("Criminal", 255, 0, 0) local positions = { {0, 0, 20}, {1, 0, 20}, {2, 0, 20}, {3, 0, 20}, } function createAmarker (thePlayer) if ( getPlayerTeam(thePlayer) and getPlayerTeam(thePlayer) == criminal ) then local x, y,z = unpack(positions[math.random(#positions)]) createMarker(x, y, z) end end addEventHandler("onVehicleEnter", getRootElement(), createAmarker) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
drk Posted December 17, 2011 Posted December 17, 2011 Solidsnake14, was not necessary to you reply. I have already answered and Gtagasje had achieved ... EPT Team Server Development: 0% Learning C++ | C++ is amazing
Castillo Posted December 17, 2011 Posted December 17, 2011 We can say... two options is better than one? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
drk Posted December 17, 2011 Posted December 17, 2011 Why Gtagasje need two options if only one is needed ? Ok, no problem, I don't want to "fight" in the forum ... EPT Team Server Development: 0% Learning C++ | C++ is amazing
Castillo Posted December 17, 2011 Posted December 17, 2011 Who knows? maybe someone ELSE has the same problem and want's to do it in a different way, nobody know's. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
AGENT_STEELMEAT Posted December 17, 2011 Posted December 17, 2011 Or we could say that your solution sucks Shick.
drk Posted December 17, 2011 Posted December 17, 2011 LOL, I will not reply to noob's. EPT Team Server Development: 0% Learning C++ | C++ is amazing
Xeno Posted December 17, 2011 Posted December 17, 2011 Lol. I think it was necessary for Castillo to reply because im about to use his script he posted >_>
drk Posted December 19, 2011 Posted December 19, 2011 Ok. No problem, sorry EPT Team Server Development: 0% Learning C++ | C++ is amazing
Al3grab Posted December 19, 2011 Posted December 19, 2011 @-NxZ-Shick Solid's Solution was better than mine ING : [xXx]~Al3grab
Spice Posted July 13, 2015 Posted July 13, 2015 Who knows? maybe someone ELSE has the same problem and want's to do it in a different way, nobody know's. Thanks man <3
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