Jump to content

Bean666

Members
  • Posts

    732
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Bean666

  1. I managed to create a solution but it's not so clean but can you please tell me how I can send both of them / what functions to use after creating them? it seems cleaner Thanks.
  2. the defusemarker is testmarker2 btw, sorry for bump.
  3. Hello, i attached a marker to a vehicle, and I have an onMarkerHit function on the marker that's attached to the vehicle, but whenever it changes position, like i drive the car somewhere else, the onMarkerHit only works where the vehicle was created. the Marker moved with the vehicle but its just the onMarkerHit, the marker on the vehicle does not work anymore, only where the marker was created the onmarkerhit works despite the marker moving with the vehicle. function createveh() testveh = createVehicle(456, -1497.548828125, 2576.759765625, 56.061462402344, 0, 0, 357.63516235352) setVehicleDamageProof(testveh,true) bx, by, bz = getElementPosition(testveh) testmarker = createMarker(bx, by, bz, "cylinder", 5.5, 0, 255, 0, 255) testmarker2 = createMarker(bx, by, bz, "cylinder", 10, 0, 255, 0, 255) attachElements(testmarker, testveh) attachElements(testmarker2, testveh) end addEventHandler("onResourceStart", resourceRoot, createveh) addEventHandler("onMarkerHit", resourceRoot, function(hitPlayer) if source == defusemarker then if hitPlayer and getElementType ( hitPlayer ) == 'player' then local theVehicle = getPedOccupiedVehicle(hitPlayer) if theVehicle then return end local playerTeam = getPlayerTeam ( hitPlayer ) if getPlayerTeam ( hitPlayer ) and getPlayerTeam ( hitPlayer ) == getTeamFromName("Red Team") then outputChatBox("Works", hitPlayer, 180, 0, 0, true) end end end end) EDIT: just noticed, that this is giving the problem since I have 2 markers attached to the vehicle, How do i make for the two of them to attach? is there anyway to attach 2 markers at a vehicle? I mean it's weird both markers go with the vehicle but only one works, the other one's location is stuck where it was created, but the marker itself was going with the vehicle. EX: i move the vehicle, i step in marker1 , it works, but when i step in marker 2, it doesnt, then when I go where the markers, vehicle was created, the marker 2 works, its stuck in the location where it was created.
  4. i can now confirm this happened due to the script modifications. Thankyou everyone. small mistake. my bad
  5. Hello, i'm having a problem with my "bought" server and my own local server. in my local server, zombies work fine, i modified the script, especially the zombie behavior, so here is the video of zombies in my local server vs the zombies in my bought server: In my bought server,i used the zombie script which I modified that works FINE AS HELL in my own local server, But this time in my bought server it ended up the zombies going crazy and not attacking and chasing players, so I deleted that file and uploaded the default zombie script from MTA community resources, and their behavior ended up the same! how to fix this? I even reinstalled MTA server files to default in my bought server considering I thought if there's a script conflicting with the zombies resource but no! its still the same, why? Its just weird that this does not happen to my local server. anyone who has encountered this that knows how to fix? Thanks in advance. and server does not lag btw. If u want to check yourself how the zombies behave, just tell me and ill send u server IP to check.
  6. just noticed wrong, thread, can someone delete this as i made a new topic on the scripting section? thanks! I thought this was a support section but didnt see the "Map", my bad moderators and admins. sorry.
  7. Hello, i'm having a problem with my "bought" server and my own local server. in my local server, zombies work fine, i modified the script, especially the zombie behavior, so here is the video of zombies in my local server vs the zombies in my bought server: In my bought server,i used the zombie script which I modified that works FINE AS HELL in my own local server, But this time in my bought server it ended up the zombies going crazy and not attacking and chasing players, so I deleted that file and uploaded the default zombie script from MTA community resources, and their behavior ended up the same! how to fix this? I even reinstalled MTA server files to default in my bought server considering I thought if there's a script conflicting with the zombies resource but no! its still the same, why? Its just weird that this does not happen to my local server. Slothman? or anyone who has encountered this that knows how to fix? Thanks in advance. @Slothman and server does not lag btw. If u want to check yourself how the zombies behave, just tell me and ill send u server IP to check.
  8. thank you and yes its not, its like every 10-20 minutes so i guess i'll be fine? and can the function getElementWithinColShape be set to a team? like the function won't detect a player in a colshape if he's not in "team1" or something like that. EX: local players = getElementsWithinColShape ( rc, "player" ) if #players < 1 then Ex: if player is in colshape but not in team "team1", he wont be counted as a number of players inside the colshape.
  9. local testteams = { {"team1"}, {"team2"} } for k, v in ipairs(getPlayersInTeam(getTeamFromName(testteams[1]))) do setElementVisibleTo (rcblip, v, true) setElementVisibleTo(arearadar, v, true) outputChatBox("test", v, 255, 255, 255, true) end I tried getting teamnames using table but i'm having error: getTeamFromName[Expected string at arg 1, got table] getPlayersInTeam(Expected team at arg 1, got boolean) bad arg#1 to ipairs table expected got boolean. EDIT: Nvm i fixed it, i used this, but im not sure if it's clean? it seems to be working fine for i, c in ipairs(testteams) do for k, v in ipairs(getPlayersInTeam(getTeamFromName((c)[1]))) do setElementVisibleTo (rcblip, v, true) setElementVisibleTo(arearadar, v, true) outputChatBox("#54F764[Rescue] #FFFFFFSome civilians have requested for help, go to the red cross location to help them", v, 255, 255, 255, true) end end
  10. nvm about question #1, just added "and" and it worked, can't edit the reply anymore so sorry for the "spam", i guess, move forward to question 2. thanks! EDIT: i have problem in question 1 again now for k, v in ipairs(getPlayersInTeam(getTeamFromName ("team1") and getTeamFromName("team2"))) do outputChatBox("works", v, 255, 255, 255, true) end the outputChatBox only works for team2, not team1. guess i'll need to create 2 loops instead?
  11. already did this, thePlayer works but only if player inside in the colshape(Obviously), then for root, it doesn't really output anything, despite me being outside the colshape. and how do i put the outputChatBox outside the loop that detects if there are less than 2 people?, if i put it outside the loop then it wont recognize if theres less than 2 people in the colshape? EDIT: nvm lol, solved, im so slow hahaha! thankyou, and btw last, how do i add two teams to detect here, like besides team1, team2 can see the message too. how do i add another team, do i create another loop for that? for k, v in ipairs(getPlayersInTeam(getTeamFromName ("team1"))) do outputChatBox("Test.", root, 255, 255, 255, true) end and also, how do i make the getElementsWithinColShape detect if the player is in a certain team? like it won't detect people inside the colshape that's not in the "team1", help would be appreciated. local players = getElementsWithinColShape ( rc, "player" ) if #players < 1 then
  12. hi, how do i do if it detects the colshape has less than 2 people, it will output a message for everyone? because if i put the output after that line it just does it to people inside the colshape(I know that) so how do i make the outputChatBox visible for everyone? not just people inside the colshape. local players = getElementsWithinColShape ( rc, "player" ) for _, thePlayer in ipairs( players ) do if #players < 2 then --?? outputChatBox("test", --??) end
  13. addEventHandler("onClientVehicleExplode", getRootElement(), function() id = getVehicleID ( source ) if id == 609 then if getElementData(source, "vehmission") == true then if getElementData(localPlayer, "mission") == true then outputChatBox("test!") end end end end) I tried this, but idk if it'll work, will it also send message to people who has the data "mission" to true? or just to the player himself. edit: just tried with another player, its a no-no, message still shows maybe i need to set the vehicle ownership or smth? but idk how to do that
  14. function commandyes() if (getElementData(source, "choosing", true)) then local theVehicle = getPedOccupiedVehicle ( source) setElementData(theVehicle, "vehmission", true) setElementData(source,"choosing", false) setElementData(source,"mission",true) outputChatBox("deliver to the destination", source, 255, 0, 0, true) setElementFrozen(theVehicle, false) end end addEvent("yes", true) addEventHandler("yes", root, commandyes) Hi, this is my code, I want to create a deliver system, in this code i set a data on a vehicle that it's on a mission, how do i create if that vehicle explodes its data will be turned to false and also the player's "mission" data to false? and how will I make onVehicleExplode trigger only on the driver's vehicle aka theVehicle, cuz i have it serverside it might affect other vehicles? even those without the data. i know i'll need onVehicleExplode for that but what functions / what do i do to make it work.
  15. Hi, i created a marker and it's small, and whenever I hit it, it gives out some functions, the problem is, it works, but if the marker is below me, it still works. EX: im in a roof and the marker is inside the building, whenever my position matches with the marker no matter how high up i am, it still triggers the onClientMarkerHit, do i need a col for my marker or theres something wrong. weapmarker = createMarker(-1519.1829833984, 2587.1801757813, 55.3,"cylinder",1.0,0,255,0,100) addEventHandler ( "onClientMarkerHit", resourceRoot, function ( hitPlayer ) if ( hitPlayer == localPlayer and getElementType ( hitPlayer ) == "player" ) then if not isPedInVehicle ( hitPlayer ) then if (interact == false) then interact = true; addEventHandler("onClientPreRender", getRootElement(), drawh); end end end end)
  16. Bean666

    Time?

    thats what happened as well, when i put > 0 it gave me that = expected error.
  17. Bean666

    Time?

    yes, i didn't see his comment before I replied, thanks y'all @IIYAMA error is : line 6: = expected near getPedArmor() it gives an error even though I put the = , and <= 0 means if less than 0 right? addEvent "onPlayerHeadshot" addEventHandler("onPlayerDamage", getRootElement(), function (attacker, weapon, bodypart, loss) if bodypart == 9 then If getPedArmor(source) <= 0 then local result = triggerEvent("onPlayerHeadshot", source, attacker, weapon, loss) if result == true then setElementHealth(source, getElementHealth(source)-20) if weapon == 34 then setElementHealth(source, getElementHealth(source)-100) end end end end ) check my edit: @IIYAMA @Tekken
  18. Bean666

    Time?

    okay okay chill out guys, it's fine, its just a few seconds away anyway, i have one last question, this is out of topic but how do i cancel this event if the user has armor? addEvent "onPlayerHeadshot" addEventHandler("onPlayerDamage", getRootElement(), function (attacker, weapon, bodypart, loss) if bodypart == 9 then local result = triggerEvent("onPlayerHeadshot", source, attacker, weapon, loss) if result == true then setElementHealth(source, getElementHealth(source)-20) if weapon == 34 then setElementHealth(source, getElementHealth(source)-100) end end end end ) I tried with getPedArmor but it didn't work, guess I used it wrong. If so please tell me
  19. Bean666

    Time?

    just did it, thanks, though it's not super synced, when player reconnects, his time is either 3-6 seconds late or ahead of mine, though not a big deal.
  20. Bean666

    Time?

    Hello in my server when I tested with other player, time is different for each of us, how to have the time synced with each other?
  21. once again, thank you so much.
  22. local locations = { {-1506.498046875, 2536.84765625, 55.888042449951,-1505.80859375, 2566.9189453125, 55.8359375,-1490.5693359375, 2649.619140625, 55.8359375,-1517.75390625, 2668.05859375, 55.6875, 20000}, {-1608.9736328125, 2452.9296875, 68.308662414551,-1582.5891113281, 2494.0854492188, 69.000640869141,-1582.5891113281, 2494.0854492188, 69.000640869141,-1576.248046875, 2503.6533203125, 69.123001098633, 20000}, {-1608.9736328125, 2452.9296875, 68.308662414551,-1582.5891113281, 2494.0854492188, 69.000640869141,-1582.5891113281, 2494.0854492188, 69.000640869141,-1576.248046875, 2503.6533203125, 69.123001098633, 20000} } function startlogin() drawall() showPlayerHudComponent ( "radar", false ) loc = math.random(#locations) smoothMoveCamera( locations[loc][1], locations[loc][2], locations[loc][3], locations[loc][4], locations[loc][5], locations[loc][6], locations[loc][7], locations[loc][8], locations[loc][9], locations[loc][10], locations[loc][11], locations[loc][12], locations[loc][13]) cameratimer = setTimer(function() loc = math.random(#locations) smoothMoveCamera( locations[loc][1], locations[loc][2], locations[loc][3], locations[loc][4], locations[loc][5], locations[loc][6], locations[loc][7], locations[loc][8], locations[loc][9], locations[loc][10], locations[loc][11], locations[loc][12], locations[loc][13]) end, 21000, 0) theme = playSound("sounds/theme.mp3", true) setSoundVolume(theme, 1.0) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),startlogin) so I made a table of locations for the smoothmovecamera, locations are random but sometimes it repeats, how to make it not repeat despite the locations being random? it's the hard way, the easy way is just to make the sequence in order(this seems like the easiest choice) but if possible i'd like them all random but not repeating but it seems hard.
×
×
  • Create New...