Error123 Posted October 18, 2012 Share Posted October 18, 2012 (edited) Well i made this script and i blowed every thing, i want to set the PilotVehMark visible only to Pilot team but i failed( and so many bugs in the command... Help me to fix the bugs and to set PilotVehMark visible to only who is in "Pilot" team. Private Edited October 21, 2012 by Guest Link to comment
Araa Posted October 18, 2012 Share Posted October 18, 2012 What bugs are there? Post your debugerror. For the visible only thing use the 10th argument when creating the marker or simply use setElementVisibleTo Link to comment
Error123 Posted October 18, 2012 Author Share Posted October 18, 2012 then plz fix it and put it in for me cuz i added it with correct form and it say bad argument, plz fix it or give me something to put it in Link to comment
myonlake Posted October 18, 2012 Share Posted October 18, 2012 local pilotMark = createMarker(1711.1593017578, 1615.5653076172, 9, "cylinder", 2, 255, 255, 0, 255) local pilotBlip = createBlipAttachedTo(pilotMark, 56) local pilotped = createPed(61, 1711.1593017578, 1615.5653076172, 10, 252.005493) local teamPilot = createTeam("Pilot", 255, 255, 0) local pilotVehMark = createMarker(1719.3674316406, 1612.0157470703, 8.5, "cylinder", 1.75, 255, 255, 0, 255) setElementFrozen(pilotped, true) addEventHandler("onMarkerHit", root, function(hitElement, matchingDimension) if getElementType(hitElement) == "player" and matchingDimension then if source == pilotMark then if isPedInVehicle(hitElement) then return end setElementModel(hitElement, 61) setPlayerTeam(hitElement, teamPilot) elseif source == pilotVehMark then if getTeamName(getPlayerTeam(hitElement)) == "Pilot" then local x, y, z = getElementPosition(hitElement) local pilotVeh = createVehicle(583, x - 3, y + 2, z + 0.5) if isPedInVehicle(hitElement) then removePedFromVehicle(hitElement) end warpPedIntoVehicle(hitElement, pilotVeh) outputChatBox("Vehicle spawned.", hitElement, 0, 153, 0, false) end end end end ) Link to comment
Araa Posted October 18, 2012 Share Posted October 18, 2012 for _, player in ipairs(getElementsByType("player")) do setElementVisibleTo(pilotMark, player, false) end for _, player in ipairs(getPlayersInTeam(teamPilot)) do setElementVisibleTo(pilotMark, player, true) end Link to comment
Error123 Posted October 18, 2012 Author Share Posted October 18, 2012 Fusion it with the other one Link to comment
myonlake Posted October 19, 2012 Share Posted October 19, 2012 Are you serious...? local pilotMark = createMarker(1711.1593017578, 1615.5653076172, 9, "cylinder", 2, 255, 255, 0, 255) local pilotBlip = createBlipAttachedTo(pilotMark, 56) local pilotped = createPed(61, 1711.1593017578, 1615.5653076172, 10, 252.005493) local teamPilot = createTeam("Pilot", 255, 255, 0) local pilotVehMark = createMarker(1719.3674316406, 1612.0157470703, 8.5, "cylinder", 1.75, 255, 255, 0, 255) setElementFrozen(pilotped, true) addEventHandler("onMarkerHit", root, function(hitElement, matchingDimension) if getElementType(hitElement) == "player" and matchingDimension then if source == pilotMark then if isPedInVehicle(hitElement) then return end setElementModel(hitElement, 61) setPlayerTeam(hitElement, teamPilot) elseif source == pilotVehMark then if getTeamName(getPlayerTeam(hitElement)) == "Pilot" then local x, y, z = getElementPosition(hitElement) local pilotVeh = createVehicle(583, x - 3, y + 2, z + 0.5) if isPedInVehicle(hitElement) then removePedFromVehicle(hitElement) end warpPedIntoVehicle(hitElement, pilotVeh) outputChatBox("Vehicle spawned.", hitElement, 0, 153, 0, false) end end end end ) addEventHandler("onPlayerJoin", root, function() for _, player in ipairs(getElementsByType("player")) do setElementVisibleTo(pilotMark, player, false) end for _, player in ipairs(getPlayersInTeam(teamPilot)) do setElementVisibleTo(pilotMark, player, true) end end ) Link to comment
Error123 Posted October 19, 2012 Author Share Posted October 19, 2012 Thank you it's working you can't spawn vehicle if you are not in pilot team, but there is a bug when i enter the pilotVehMark with the tug it spawn another one and warp me , i want it to spawn only 1 and can't spawn if you are in vehicle Thank you for all Link to comment
myonlake Posted October 19, 2012 Share Posted October 19, 2012 Well perhaps you could change the code by yourself? We are not making scripts for you. local pilotMark = createMarker(1711.1593017578, 1615.5653076172, 9, "cylinder", 2, 255, 255, 0, 255) local pilotBlip = createBlipAttachedTo(pilotMark, 56) local pilotped = createPed(61, 1711.1593017578, 1615.5653076172, 10, 252.005493) local teamPilot = createTeam("Pilot", 255, 255, 0) local pilotVehMark = createMarker(1719.3674316406, 1612.0157470703, 8.5, "cylinder", 1.75, 255, 255, 0, 255) setElementFrozen(pilotped, true) addEventHandler("onMarkerHit", root, function(hitElement, matchingDimension) if getElementType(hitElement) == "player" and matchingDimension then if isPedInVehicle(hitElement) then return end if not getElementData(hitElement, "pilot.on-duty") then if source == pilotMark then setElementModel(hitElement, 61) setPlayerTeam(hitElement, teamPilot) setElementData(hitElement, "pilot.on-duty", true, true) elseif source == pilotVehMark then if getTeamName(getPlayerTeam(hitElement)) == "Pilot" then local x, y, z = getElementPosition(hitElement) local pilotVeh = createVehicle(583, x - 3, y + 2, z + 0.5) warpPedIntoVehicle(hitElement, pilotVeh) outputChatBox("Vehicle spawned.", hitElement, 0, 153, 0, false) setElementData(hitElement, "pilot.on-duty", true, true) end end end end end ) addEventHandler("onPlayerJoin", root, function() for _, player in ipairs(getElementsByType("player")) do setElementVisibleTo(pilotMark, player, false) end for _, player in ipairs(getPlayersInTeam(teamPilot)) do setElementVisibleTo(pilotMark, player, true) end end ) Link to comment
Techial Posted October 19, 2012 Share Posted October 19, 2012 getPedOccupiedVehicle: https://wiki.multitheftauto.com/wiki/GetPedOccupiedVehicle local playerVehicle = getPedOccupiedVehicle(thePlayer) if playerVehicle then outputChatBox("You already have a vehicle!",thePlayer, 255, 0, 0, true) else --Spawn code here end Regards, Techial. Link to comment
myonlake Posted October 19, 2012 Share Posted October 19, 2012 getPedOccupiedVehicle:https://wiki.multitheftauto.com/wiki/GetPedOccupiedVehicle local playerVehicle = getPedOccupiedVehicle(thePlayer) if playerVehicle then outputChatBox("You already have a vehicle!",thePlayer, 255, 0, 0, true) else --Spawn code here end Regards, Techial. I think your post was unnecessary since I fixed it in my last post. Link to comment
Error123 Posted October 19, 2012 Author Share Posted October 19, 2012 I ment that i wanted : the player have permission to spawn only 1 vehicule meaning he only can spawn one veh, don't give me the scipt just the code and i put it Link to comment
myonlake Posted October 20, 2012 Share Posted October 20, 2012 Script = code and viceversa. Check the "code" I posted. Link to comment
Error123 Posted October 20, 2012 Author Share Posted October 20, 2012 (edited) whats exactly changed? it's spawns two vehicles and more and more each time i enter the vehicle look , i editted it Private now i thank you for helping me to script this, but something i want it fixed,i want the Marker that spawn Tug be invisible, visible only for who are in Pilot Team, well now it don't work if you are not in pilot team, but i want it invisible maybe setElementAlpha, well give me a suggest, and thanks for all. Edited October 21, 2012 by Guest Link to comment
Techial Posted October 20, 2012 Share Posted October 20, 2012 (edited) function resetData() local account = getPlayerAccount(source) setAccountData(account, "spawned", "0") end addEventHandler("onPlayerLogin", root, resetData) local account = getPlayerAccount(source) if(tostring(getAccountData(account, "spawned"))=="0") then setAccountData(account, "spawned", "1") -- Spawn code here else outputChatBox("Sorry, you can't spawn more than 1 vehicle.", source, 255, 0, 0, true) end Pilot team marker addEventHandler("onPlayerSpawn", getRootElement(), function() for _, player in ipairs(getElementsByType("player")) do setElementVisibleTo(pilotMark, player, false) end for _, player in ipairs(getPlayersInTeam(teamPilot)) do setElementVisibleTo(pilotMark, player, true) end end ) Edited October 20, 2012 by Guest Link to comment
Error123 Posted October 20, 2012 Author Share Posted October 20, 2012 Yeah working, i ment that if he try to spawn another vehicle the other one get destroyed and warp him into the new one, Thank you... 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