Adde Posted February 28, 2013 Share Posted February 28, 2013 I´m trying to create a function that stop players that´s in a vehicle from using 6 markers but I can´t complete it. I don´t know exactly how to do it, but I can imagine about how it should be and I don´t know how to make a table or something so it happends to all markers. I searched and searched for answears but couldn´t find any or understand. Here is markers, eventhandler and function from the script. marker1 = createMarker (-1616.25,684.86,6.18,"cylinder",1.5,0,60,200,100) marker2 = createMarker (-1569.64,670.04,6.18,"cylinder",1.5,0,60,200,100) marker3 = createMarker (-1296,442.03,6.18,"cylinder",1.5,0,60,200,100) marker4 = createMarker (-1539.93,484.16,6.17,"cylinder",1.5,0,60,200,100) marker5 = createMarker (227.69,1921.02,16.5,"cylinder",1.5,0,60,200,100) marker6 = createMarker (-72.36,2048.72,17.40,"cylinder",1.5,0,60,200,100) addEventHandler ( "onMarkerHit", marker1, spawninTeam1 ) addEventHandler ( "onMarkerHit", marker2, spawninTeam1 ) addEventHandler ( "onMarkerHit", marker3, spawninTeam2 ) addEventHandler ( "onMarkerHit", marker4, spawninTeam2 ) addEventHandler ( "onMarkerHit", marker5, spawninTeam3 ) addEventHandler ( "onMarkerHit", marker6, spawninTeam3 ) ==something like== function VehicleMarkerHit() if (isPedInVehicle(player)) then return end addEvent(joinTeam, false) addEventHandler("onMarkerHit", marker, VehicleMarkerHit I will be very thankfull for answears Link to comment
MTA Team 0xCiBeR Posted February 28, 2013 MTA Team Share Posted February 28, 2013 Your in the wrong forum my dear friend...Move to English Please! Link to comment
PaiN^ Posted February 28, 2013 Share Posted February 28, 2013 If i'm right then this how your code should look like : addEventHandler( "onMarkerHit", root, function ( hitElement ) if getElementType( hitElement ) == "player" then if isPlayerInVehicle( hitElement ) then return else if ( source == marker1 ) then spawnPlayer( hitElement, x, y, z ) elseif ( source == marker2 ) then spawnPlayer( hitElement, x, y, z ) elseif ( source == marker3 ) then spawnPlayer( hitElement, x, y, z ) elseif ( source == marker4 ) then spawnPlayer( hitElement, x, y, z ) elseif ( source == marker5 ) then spawnPlayer( hitElement, x, y, z ) elseif ( source == marker6 ) then spawnPlayer( hitElement, x, y, z ) end end end end ) Link to comment
Adde Posted February 28, 2013 Author Share Posted February 28, 2013 Hmm, did not work. bad "playerpointer" @ "setplayerteam" bad argument @ "spawnplayer" should it be in client or server? Link to comment
Vision Posted February 28, 2013 Share Posted February 28, 2013 It should be on server side. Link to comment
Adde Posted February 28, 2013 Author Share Posted February 28, 2013 Okay, that´s where i have it. Link to comment
PaiN^ Posted February 28, 2013 Share Posted February 28, 2013 Hmm, did not work. bad "playerpointer" @ "setplayerteam" bad argument @ "spawnplayer" should it be in client or server? I didn't use stPlayerTeam !! You have edited it incorrectly .. Post the code you edited ..! Link to comment
Adde Posted February 28, 2013 Author Share Posted February 28, 2013 No i just copied it, It´s in the rest of the script there is setplayerteam. Should I place it it a special place? It can be that, or? Link to comment
PaiN^ Posted February 28, 2013 Share Posted February 28, 2013 You didn't replace the x, y, z by the coordinates -_-" ? Link to comment
Adde Posted February 28, 2013 Author Share Posted February 28, 2013 F***, I thought it was set as search for coordinates. I change now.. It changing skin to cj and no armor added longer, etc lol. Link to comment
iPrestege Posted February 28, 2013 Share Posted February 28, 2013 addEventHandler( "onMarkerHit", root, function ( hitElement ) if getElementType( hitElement ) == "player" then if not isPlayerInVehicle( hitElement ) then if ( source == marker1 ) then setElementPosition( hitElement, x, y, z ) elseif ( source == marker2 ) then setElementPosition( hitElement, x, y, z ) elseif ( source == marker3 ) then setElementPosition( hitElement, x, y, z ) elseif ( source == marker4 ) then setElementPosition( hitElement, x, y, z ) elseif ( source == marker5 ) then setElementPosition( hitElement, x, y, z ) elseif ( source == marker6 ) then setElementPosition( hitElement, x, y, z ) end end end end ) Link to comment
Adde Posted February 28, 2013 Author Share Posted February 28, 2013 (edited) Thank you, now it works but the problem is, it still works with car maybe it work if I add addEvent("setTeam",false) ? Edited February 28, 2013 by Guest Link to comment
iPrestege Posted February 28, 2013 Share Posted February 28, 2013 (edited) You're Welcome. @ #The_Pain In You're Code "return" return for what @ Adde Just Remove This Fucking Line or Send Me Full Script "PM" . function VehicleMarkerHit() if (isPedInVehicle(player)) then return end addEvent(joinTeam, false) addEventHandler("onMarkerHit", marker, VehicleMarkerHit Edited February 28, 2013 by Guest Link to comment
iPrestege Posted February 28, 2013 Share Posted February 28, 2013 addEventHandler( "onMarkerHit", root, function ( hitElement ) if getElementType( hitElement ) == "player" then if not isPedInVehicle( hitElement ) then if ( source == marker1 ) then setElementPosition( hitElement, x, y, z ) elseif ( source == marker2 ) then setElementPosition( hitElement, x, y, z ) elseif ( source == marker3 ) then setElementPosition( hitElement, x, y, z ) elseif ( source == marker4 ) then setElementPosition( hitElement, x, y, z ) elseif ( source == marker5 ) then setElementPosition( hitElement, x, y, z ) elseif ( source == marker6 ) then setElementPosition( hitElement, x, y, z ) end end end end ) Link to comment
Adde Posted February 28, 2013 Author Share Posted February 28, 2013 (edited) It just don´t work -.- Edited February 28, 2013 by Guest Link to comment
X-SHADOW Posted February 28, 2013 Share Posted February 28, 2013 Can You Post the script so we can help you ? Link to comment
iPrestege Posted February 28, 2013 Share Posted February 28, 2013 (edited) but work with me if am not in fuc k vehicle it won't work. Edited February 28, 2013 by Guest Link to comment
Adde Posted February 28, 2013 Author Share Posted February 28, 2013 Can You Post the script so we can help you ? marker1 = createMarker (-1616.25,684.86,6.18,"cylinder",1.5,0,60,200,100) marker2 = createMarker (-1569.64,670.04,6.18,"cylinder",1.5,0,60,200,100) marker3 = createMarker (-1296,442.03,6.18,"cylinder",1.5,0,60,200,100) marker4 = createMarker (-1539.93,484.16,6.17,"cylinder",1.5,0,60,200,100) marker5 = createMarker (227.69,1921.02,16.5,"cylinder",1.5,0,60,200,100) marker6 = createMarker (-72.36,2048.72,17.40,"cylinder",1.5,0,60,200,100) Blip1 = createBlip (-1616.25,684.86,6.18,59,2,255,0,0,255) Blip2 = createBlip (-1569.64,670.04,6.18,59,2,255,0,0,255) Blip3 = createBlip (-1296,442.03,6.18, 59,2,255,0,0,255) Blip4 = createBlip (-1539.93,484.16,6.17,59,2,255,0,0,255) Blip5 = createBlip (227.69,1921.02,16.5,59,2,255,0,0,255) Blip6 = createBlip (-72.36,2048.72,17.40,59,2,255,0,0,255) player = source function teams() Staff = createTeam ( "Staff", 255, 128, 0 ) SWAT = createTeam ( "SWAT", 100, 100, 100 ) Military = createTeam ( "Military", 0, 204, 0 ) Army = createTeam ( "Army", 59, 166, 109 ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), teams ) function onPlayerSpawn (player) setPlayerTeam ( source, Army ) spawnPlayer ( source, 235.4085, 1911.13, 18 ) givePlayerMoney ( source, 2000 ) setPedArmor ( source, 60 ) setElementModel( source, 179 ) setPlayerNametagColor ( source, 59, 166, 109 ) fadeCamera ( source, true, 3 ) end addEventHandler ( "onPlayerJoin", getRootElement(), onPlayerSpawn ) function spawninSWAT (player, OnPlayerMarkerHit ) setPlayerTeam ( player, SWAT ) setPedArmor ( player, 50 ) setElementModel( player, 285 ) setPlayerNametagColor ( player, 100, 100, 100 ) outputChatBox ( "New member in SWAT team", source, 0, 255, 255 ) end addEvent("setSWAT", true) addEventHandler ( "onMarkerHit", marker1, spawninSWAT ) addEventHandler ( "onMarkerHit", marker2, spawninSWAT ) function spawninMilitary (player, commandName ) setPlayerTeam ( player, Military ) setPedArmor ( player, 60 ) setElementModel( player, 287 ) setPlayerNametagColor ( player, 0, 204, 0 ) outputChatBox ( "New member in Military team", source, 0, 255, 255 ) end addEvent("setMilitary", true) addEventHandler ( "onMarkerHit", marker3, spawninMilitary ) addEventHandler ( "onMarkerHit", marker4, spawninMilitary ) function spawninArmy (player, commandName ) setPlayerTeam ( player, Army ) setPedArmor ( player, 60 ) setElementModel( player, 179 ) setPlayerNametagColor ( player, 59, 166, 109 ) outputChatBox ( "New member in Army team", source, 0, 255, 255 ) end addEvent("setArmy", true) addEventHandler ( "onMarkerHit", marker5, spawninArmy ) addEventHandler ( "onMarkerHit", marker6, spawninArmy ) function spawninStaff (player, commandName ) local accName1 = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..accName1, aclGetGroup ( "Owner" ) ) or hasObjectPermissionTo( player, 'function.kickPlayer', false ) then setPlayerTeam ( player, Staff ) setPedArmor ( player, 100 ) setElementModel ( player, 217 ) setPlayerNametagColor ( player, 255, 128, 0 ) end end addCommandHandler ( "Staff", spawninStaff ) addEventHandler( "onMarkerHit", root, function ( hitElement ) if getElementType( hitElement ) == "player" then if not isPlayerInVehicle( hitElement ) then if ( source == marker1 ) then setElementPosition( hitElement, -1616.25,684.86,7.18 ) elseif ( source == marker2 ) then setElementPosition( hitElement, -1569.64,670.04,7.18 ) elseif ( source == marker3 ) then setElementPosition( hitElement, -1296,442.03,7.18 ) elseif ( source == marker4 ) then setElementPosition( hitElement, -1539.93,484.16,7.17 ) elseif ( source == marker5 ) then setElementPosition( hitElement, 227.69,1921.02,17.5 ) elseif ( source == marker6 ) then setElementPosition( hitElement, -72.36,2048.72,18.40 ) end end end end ) Link to comment
X-SHADOW Posted February 28, 2013 Share Posted February 28, 2013 marker1 = createMarker (-1616.25,684.86,6.18,"cylinder",1.5,0,60,200,100) marker2 = createMarker (-1569.64,670.04,6.18,"cylinder",1.5,0,60,200,100) marker3 = createMarker (-1296,442.03,6.18,"cylinder",1.5,0,60,200,100) marker4 = createMarker (-1539.93,484.16,6.17,"cylinder",1.5,0,60,200,100) marker5 = createMarker (227.69,1921.02,16.5,"cylinder",1.5,0,60,200,100) marker6 = createMarker (-72.36,2048.72,17.40,"cylinder",1.5,0,60,200,100) Blip1 = createBlip (-1616.25,684.86,6.18,59,2,255,0,0,255) Blip2 = createBlip (-1569.64,670.04,6.18,59,2,255,0,0,255) Blip3 = createBlip (-1296,442.03,6.18, 59,2,255,0,0,255) Blip4 = createBlip (-1539.93,484.16,6.17,59,2,255,0,0,255) Blip5 = createBlip (227.69,1921.02,16.5,59,2,255,0,0,255) Blip6 = createBlip (-72.36,2048.72,17.40,59,2,255,0,0,255) Staff = createTeam ( "Staff", 255, 128, 0 ) SWAT = createTeam ( "SWAT", 100, 100, 100 ) Military = createTeam ( "Military", 0, 204, 0 ) Army = createTeam ( "Army", 59, 166, 109 ) function onPlayerSpawn (player) setPlayerTeam ( player, Army ) spawnPlayer ( player, 235.4085, 1911.13, 18 ) givePlayerMoney ( player, 2000 ) setPedArmor ( player, 60 ) setElementModel( player, 179 ) setPlayerNametagColor ( player, 59, 166, 109 ) fadeCamera ( player, true, 3 ) end addEventHandler ( "onPlayerJoin", getRootElement(), onPlayerSpawn ) function spawninSWAT (player) setPlayerTeam ( player, SWAT ) setPedArmor ( player, 50 ) setElementModel( player, 285 ) setPlayerNametagColor ( player, 100, 100, 100 ) outputChatBox ( "New member in SWAT team", player, 0, 255, 255 ) end addEvent("setSWAT", true) addEventHandler ( "onMarkerHit", marker1, spawninSWAT ) addEventHandler ( "onMarkerHit", marker2, spawninSWAT ) function spawninMilitary (player) setPlayerTeam ( player, Military ) setPedArmor ( player, 60 ) setElementModel( player, 287 ) setPlayerNametagColor ( player, 0, 204, 0 ) outputChatBox ( "New member in Military team", player, 0, 255, 255 ) end addEvent("setMilitary", true) addEventHandler ( "onMarkerHit", marker3, spawninMilitary ) addEventHandler ( "onMarkerHit", marker4, spawninMilitary ) function spawninArmy (player) setPlayerTeam ( player, Army ) setPedArmor ( player, 60 ) setElementModel( player, 179 ) setPlayerNametagColor ( player, 59, 166, 109 ) outputChatBox ( "New member in Army team", player, 0, 255, 255 ) end addEvent("setArmy", true) addEventHandler ( "onMarkerHit", marker5, spawninArmy ) addEventHandler ( "onMarkerHit", marker6, spawninArmy ) function spawninStaff (player) local accName1 = getAccountName ( getPlayerAccount ( player ) ) if accName1 then if isObjectInACLGroup ("user."..accName1, aclGetGroup ( "Owner" ) ) or hasObjectPermissionTo( player, 'function.kickPlayer', false ) then setPlayerTeam ( player, Staff ) setPedArmor ( player, 100 ) setElementModel ( player, 217 ) setPlayerNametagColor ( player, 255, 128, 0 ) end end addCommandHandler ( "Staff", spawninStaff ) addEventHandler( "onMarkerHit", root, function ( hitElement ) if getElementType( hitElement ) == "player" then if not isPlayerInVehicle( hitElement ) then if ( player == marker1 ) then setElementPosition( hitElement, -1616.25,684.86,7.18 ) elseif ( player == marker2 ) then setElementPosition( hitElement, -1569.64,670.04,7.18 ) elseif ( player == marker3 ) then setElementPosition( hitElement, -1296,442.03,7.18 ) elseif ( player == marker4 ) then setElementPosition( hitElement, -1539.93,484.16,7.17 ) elseif ( player == marker5 ) then setElementPosition( hitElement, 227.69,1921.02,17.5 ) elseif ( player == marker6 ) then setElementPosition( hitElement, -72.36,2048.72,18.40 ) end end end end) end Link to comment
PaiN^ Posted February 28, 2013 Share Posted February 28, 2013 marker1 = createMarker (-1616.25,684.86,6.18,"cylinder",1.5,0,60,200,100) marker2 = createMarker (-1569.64,670.04,6.18,"cylinder",1.5,0,60,200,100) marker3 = createMarker (-1296,442.03,6.18,"cylinder",1.5,0,60,200,100) marker4 = createMarker (-1539.93,484.16,6.17,"cylinder",1.5,0,60,200,100) marker5 = createMarker (227.69,1921.02,16.5,"cylinder",1.5,0,60,200,100) marker6 = createMarker (-72.36,2048.72,17.40,"cylinder",1.5,0,60,200,100) Blip1 = createBlip (-1616.25,684.86,6.18,59,2,255,0,0,255) Blip2 = createBlip (-1569.64,670.04,6.18,59,2,255,0,0,255) Blip3 = createBlip (-1296,442.03,6.18, 59,2,255,0,0,255) Blip4 = createBlip (-1539.93,484.16,6.17,59,2,255,0,0,255) Blip5 = createBlip (227.69,1921.02,16.5,59,2,255,0,0,255) Blip6 = createBlip (-72.36,2048.72,17.40,59,2,255,0,0,255) Staff = createTeam ( "Staff", 255, 128, 0 ) SWAT = createTeam ( "SWAT", 100, 100, 100 ) Military = createTeam ( "Military", 0, 204, 0 ) Army = createTeam ( "Army", 59, 166, 109 ) addEventHandler( "onMarkerHit", root, function ( hitElement ) if getElementType( hitElement ) == "player" then if not isPlayerInVehicle( hitElement ) then if ( source == marker1 ) or ( source == marker2 ) then setPlayerTeam ( hitElement, SWAT ) setPedArmor ( hitElement, 50 ) setElementModel( hitElement, 285 ) setPlayerNametagColor ( hitElement, 100, 100, 100 ) outputChatBox ( "New member in SWAT team", hitElement, 0, 255, 255 ) setElementPosition( hitElement, -1616.25,684.86,7.18 ) elseif ( source == marker3 ) or ( source == marker4 ) then setElementPosition( hitElement, -1296,442.03,7.18 ) setPlayerTeam ( hitElement, Military ) setPedArmor ( hitElement, 60 ) setElementModel( hitElement, 287 ) setPlayerNametagColor ( hitElement, 0, 204, 0 ) outputChatBox ( "New member in Military team", hitElement, 0, 255, 255 ) elseif ( player == marker5 ) or ( source == marker6 then setElementPosition( hitElement, 227.69,1921.02,17.5 ) setPlayerTeam ( player, Army ) setPedArmor ( player, 60 ) setElementModel( player, 179 ) setPlayerNametagColor ( player, 59, 166, 109 ) outputChatBox ( "New member in Army team", player, 0, 255, 255 ) end end end end end Link to comment
Adde Posted March 1, 2013 Author Share Posted March 1, 2013 Tried both, nothing works X-shadow, Same thing as before. The_Pain, the script didn´t start. It said something with " rpg.lua:36: ")" expected near then " Link to comment
X-SHADOW Posted March 1, 2013 Share Posted March 1, 2013 marker1 = createMarker (-1616.25,684.86,6.18,"cylinder",1.5,0,60,200,100) marker2 = createMarker (-1569.64,670.04,6.18,"cylinder",1.5,0,60,200,100) marker3 = createMarker (-1296,442.03,6.18,"cylinder",1.5,0,60,200,100) marker4 = createMarker (-1539.93,484.16,6.17,"cylinder",1.5,0,60,200,100) marker5 = createMarker (227.69,1921.02,16.5,"cylinder",1.5,0,60,200,100) marker6 = createMarker (-72.36,2048.72,17.40,"cylinder",1.5,0,60,200,100) Blip1 = createBlip (-1616.25,684.86,6.18,59,2,255,0,0,255) Blip2 = createBlip (-1569.64,670.04,6.18,59,2,255,0,0,255) Blip3 = createBlip (-1296,442.03,6.18, 59,2,255,0,0,255) Blip4 = createBlip (-1539.93,484.16,6.17,59,2,255,0,0,255) Blip5 = createBlip (227.69,1921.02,16.5,59,2,255,0,0,255) Blip6 = createBlip (-72.36,2048.72,17.40,59,2,255,0,0,255) Staff = createTeam ( "Staff", 255, 128, 0 ) SWAT = createTeam ( "SWAT", 100, 100, 100 ) Military = createTeam ( "Military", 0, 204, 0 ) Army = createTeam ( "Army", 59, 166, 109 ) addEventHandler( "onMarkerHit", root, function ( hitElement ) if getElementType( hitElement ) == "player" then if not isPlayerInVehicle( hitElement ) then if ( source == marker1 ) or ( source == marker2 ) then setPlayerTeam ( hitElement, SWAT ) setPedArmor ( hitElement, 50 ) setElementModel( hitElement, 285 ) setPlayerNametagColor ( hitElement, 100, 100, 100 ) outputChatBox ( "New member in SWAT team", hitElement, 0, 255, 255 ) setElementPosition( hitElement, -1616.25,684.86,7.18 ) elseif ( source == marker3 ) or ( source == marker4 ) then setElementPosition( hitElement, -1296,442.03,7.18 ) setPlayerTeam ( hitElement, Military ) setPedArmor ( hitElement, 60 ) setElementModel( hitElement, 287 ) setPlayerNametagColor ( hitElement, 0, 204, 0 ) outputChatBox ( "New member in Military team", hitElement, 0, 255, 255 ) elseif ( player == marker5 ) or ( source == marker6 )then setElementPosition( hitElement, 227.69,1921.02,17.5 ) setPlayerTeam ( player, Army ) setPedArmor ( player, 60 ) setElementModel( player, 179 ) setPlayerNametagColor ( player, 59, 166, 109 ) outputChatBox ( "New member in Army team", player, 0, 255, 255 ) end end end end) Link to comment
Scooby Posted March 1, 2013 Share Posted March 1, 2013 also: isPlayerInVehicle should be isPedInVehicle Link to comment
Adde Posted March 1, 2013 Author Share Posted March 1, 2013 I talked with a friend and it was just that easy to do: function spawninSWAT (player, OnPlayerMarkerHit ) if isPedInVehicle(player) then return end setPlayerTeam ( player, SWAT ) setPedArmor ( player, 50 ) setElementModel( player, 285 ) setPlayerNametagColor ( player, 100, 100, 100 ) outputChatBox ( "New member in SWAT team", source, 0, 255, 255 ) end addEvent("setSWAT", true) addEventHandler ( "onMarkerHit", marker1, spawninSWAT ) addEventHandler ( "onMarkerHit", marker2, spawninSWAT ) But thx anyway guys 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