ReZurrecti0n

Members
  • Content Count

    71
  • Joined

  • Last visited

Community Reputation

4 Neutral

About ReZurrecti0n

  • Rank
    Transformer
  • Birthday 12/12/1979

Details

  • Location
    Florida, US
  • Occupation
    Game Designer
  • Interests
    Role Play Games

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Marker = createMarker(1702.7998046875, -1079.2001953125, 22.89999961853, "cylinder", 2, 0, 0, 255) -- Global variable for a marker (Probably should be local) local myMarker = createMarker(1702.7998046875, -1079.2001953125, 22.89999961853, 'cylinder', 2.0, 0, 0, 255, 150) -- Locl variable for a marker function MarkerHit( Element, matchingDimension )-- The function, notice the arugments as it will be useful (Element is whatever hits the marker, a player) -- triggerClientEvent ( "onMarkerHit", getRootElement())-- This will call MarkerHit, but we already triggered MarkerHit, so this is an infinite loop outputChatBox("GG",Element)-- This is our goal... By adding the Element argument, sends the message ONLY to the player that hit the marker end -- Ends the function, easy enough addEventHandler( "onMarkerHit", getRootElement(), MarkerHit )-- Defines that MTA-SA's onMarkerHit will be the function MarkerHit, had to change this too... It will take some time, but you must learn in general how coding/scripting is done, try to understand what every line is doing. Use the MTA-SA Wiki for Events, Functions and such. Lua is the language MTA SA uses, will need to learn how the language operates too. Remember, baby steps
  2. You should always try to pin point the problem by adding output messages everywhere. Or prints, but anyway, try putting a output right after the createmarker so you know that was successfully made, then another message right before TriggerClientEvent… Wait, I don't even think you need the TriggerClientEvent line, that would keep looping forever... Try commenting out that line and see if it works
  3. I've already resolved the issue... However, I was unable to detect if a player was in a vehicle from the onwastedplayer event, so I don't think that code would work based on that. My trouble was that the player would teleport with the vehicle the player died in (Blowing up their own vehicle) when the vehicle was respawned. I solved it by simply stopping the vehicle from respawning until the player spawned... I appreciate your help though, I strive to learn more everyday
  4. Line 2, after "cylinder" you put 2.0 instead of just 2 as the size, that might be your issue
  5. I don't think you can destroy a player (I remember reading something that mentioned this a while back) The only way I know how to destroy a player is to disconnect them from the server altogether, but I could be wrong as I'm not yet that familiar with MTA-SA
  6. Seems like you are trying to check a variable that doesn't exist or has been removed... But yes, MrTasty is right, we could help you more with more details
  7. I had thought of that, but the custom name tag still appears at the new location which led me to believe it wasn't a camera issue, I appreciate the thought though I did resolve my issue with my previous post, now the vehicle doesn't respawn until the player does which I figured was the best fix for it
  8. This is what I ended up doing: Lucky for me, the player is still detected in the vehicle on this event... function VehicleExplode() if(getVehicleOccupants(source))then toggleVehicleRespawn(source,false) setTimer(function(source)toggleVehicleRespawn(source,true);end,300000,1,source) end end
  9. I'm testing by simply taking a Hydra and blowing itself up. Nothing has worked yet, can't remove the player from the vehicle, nor teleport the player either. I guess because the player is considered dead and not respawned yet. I'm thinking about targeting the vehicle instead, I can use a variable to remember what vehicle the player was in and if that vehicle respawns, cancel the event and respawn it when the player spawns... Will mess around a bit and try some work arounds, but still open to ideas if anyone has any and will report any results Is anyone familiar with resetVehicleExplosionTime and how it works, exactly? I mean if used to stop the respawn at that point, will it still respawn later?
  10. Hmm, I did not even think to just remove the check, that could work... I was also thinking before I went to bed about just teleporting the player Thank you, I will give these both a shot and report back my results
  11. When the player dies in a vehicle from exploding it, the vehicle will respawn and teleport the player along with it. This is because I have the player wait a minute or so before respawning and the vehicle ends up respawning first. So my first attempt was to check if the player who died was in a vehicle, but this check doesn't trigger. Then I thought I would try it the other way around and detect if a player was in the vehicle before it respawned and also failed the check. Although the player is still in the vehicle, after death, it would seem the system considers the player out of any vehicle... I have also tried to freeze the player, but still teleported with the respawning vehicle, it didn't work. So what I need to do is find a way to respawn the vehicle, but keep the player where he died, any ideas? function PlayerWasted(ammo,killer,weapon,body,stealth) if(isPedInVehicle(source))then removePedFromVehicle(source) end Also: When the vehicle does respawn and the player teleports with it, it gives another "Death Sound" as if the player was killed again. In case that info may help any...
  12. Figuring out how tables work in Lua was... Rather challenging, but did manage to figure out the very basics. For those who read this thread in hoping of an example of tables, this is what my final code turned out to be and now everything works as it was intended: local Element={} -- The simplest form of declaring a table, I decided not to get fancy with it function ClientResourceStart(resource) PED=createPed(271,-1641.0,-2248.0,31.5,0.0) -- 1st Test Ped Element[PED]={Name="Zach"} -- Giving 1st Test Ped a Name in the table setPedArmor(PED,100.0) PED=createPed(241,-1639.0,-2248.0,31.5,0.0) -- 2nd Test Ped Element[PED]={Name="Bill"} PED=createPed(158,-1643.0,-2248.0,31.5,0.0) -- 3rd Test Ped Element[PED]={Name="Mary"} setTimer(Seconds,1000,0) -- Will run the Seconds Function every second to check if player is in Range and has a LOS end function Seconds() local f1,f2,f3=getCameraMatrix() -- Another loop for players, currently only testing with Peds though for l,t in ipairs(getElementsByType("ped"))do local f4,f5,f6=getElementPosition(t) if(getDistanceBetweenPoints3D(f1,f2,f3,f4,f5,f6)<=25.0)then if(isLineOfSightClear(f4,f5,f6+2,f1,f2,f3))then local f7,f8=getScreenFromWorldPosition(f4,f5,f6+1) if(f7)and(f8)and(not Element[t]["Visible"])then -- Checks to make sure this Ped isn't already marked with "Visible" Element[t]["Visible"]=true -- Adds a new entry to the table, Visible Element[t]["ID"]="NPC" -- Adds yet another new entry to the table end elseif(Element[t]["Visible"])then -- Ped no longer in L.O.S. Element[t]["Visible"]=nil -- Removes the entry from the table Element[t]["ID"]=nil -- Removes the entry from the table end elseif(Element[t]["Visible"])then -- Ped no longer in Range Element[t]["Visible"]=nil -- Removes the entry from the table Element[t]["ID"]=nil -- Removes the entry from the table end end end function ClientRender()-- This event is constantly called, it's not wise to add anything here unless you have NO other choice... You were warned! for l,t in pairs(Element)do if(Element[l]["Visible"])then -- Checks if the element in this loop has "Visible" marked (Or exist even) DrawDXTextOnElement(l,"(#A0A0A0"..Element[l]["ID"].."#808080) #C0C0C0"..Element[l]["Name"].."",0.95,25.0,128,128,128,255,1.3) -- ^ The line above displays the Peds ID and Name above the head ^ DrawDXBoxOnElement(l,102,7,1.01,25.0,0,0,0,75)-- Black Outline Box for Health DrawDXBoxOnElement(l,100,5,1.009,25.0,64,0,0,75)-- Damage Box for Health DrawDXBoxOnElement(l,getElementHealth(l),5,1.009,25.0,255,0,0)-- Amount Box for Health if(getPedArmor(l)>0)then -- If no armor, don't bother showing an empty armor bar... DrawDXBoxOnElement(l,102,7,1.06,25.0,0,0,0,75)-- Black Outline Box for Armor DrawDXBoxOnElement(l,100,5,1.059,25.0,64,64,64,75)-- Damage Box for Armor DrawDXBoxOnElement(l,getPedArmor(l),5,1.059,25.0,255,255,255)-- Amount Box for Armor end DrawDXTextOnElement(l,"LOCAL: OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",1.12,25.0,255,255,255,255,1.3) -- Just a positioning test, this needs updating end end end Thanx again IIYama Everything in this thread has now been resolved XD
  13. Since I got it to work, I've been changing the code and decided it's probably best I update what I have atm. Especially now that you have an idea of what I'm trying to do: -- Clientside Script: local PlayerVisible={} function ClientResourceStart(resource) PED=createPed(271,-1641.0,-2248.0,31.5,0.0)-- !!! TEMP !!! PED2=createPed(241,-1640.0,-2248.0,31.5,0.0)-- !!! TEMP !!! (These are the 3 Peds I'm testing with) PED3=createPed(158,-1642.0,-2248.0,31.5,0.0)-- !!! TEMP !!! setPedArmor(PED,100.0) setTimer(Seconds,1000,0) collectgarbage()-- I will be removing ALL of these found throughout my scripts shortly... end function ClientRender()-- This event is constantly called, it's not wise to add anything here unless you have to for l,t in pairs(PlayerVisible)do if(PlayerVisible[l])then -- Now Works !!! --outputChatBox("TM: #FFFFFFPoint Z!",255,150,50,true) -- The following line is what I'm now trying to figure out (Working with Tables) [Currently not working correctly] DrawDXTextOnElement(l,"(#A0A0A0"..PlayerVisible[l].id.."#808080) #C0C0C0"..PlayerVisible[l].name.."",0.95,25.0,128,128,128,255,1.3) -- ^ If the above line were to be removed, everything else would work as it should... ^ DrawDXBoxOnElement(l,102,7,1.01,25.0,0,0,0)-- Black Outline Box for Health DrawDXBoxOnElement(l,100,5,1.009,25.0,64,0,0)-- Damage Box for Health DrawDXBoxOnElement(l,getElementHealth(l),5,1.009,25.0,255,0,0)-- Amount Box for Health DrawDXBoxOnElement(l,102,7,1.06,25.0,0,0,0)-- Black Outline Box for Armor DrawDXBoxOnElement(l,100,5,1.059,25.0,64,64,64)-- Damage Box for Armor DrawDXBoxOnElement(l,getPedArmor(l),5,1.059,25.0,255,255,255)-- Amount Box for Armor DrawDXTextOnElement(l,"LOCAL: OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",1.12,25.0,255,255,255,255,1.3) end end end function Seconds() local f1,f2,f3=getCameraMatrix() -- There is another loop for type "players" here, but removed for the time being as it needs updating and only testing on Peds atm for l,t in ipairs(getElementsByType("ped"))do local f4,f5,f6=getElementPosition(t) if(getDistanceBetweenPoints3D(f1,f2,f3,f4,f5,f6)<=25.0)then if(isLineOfSightClear(f4,f5,f6+2,f1,f2,f3))then local f7,f8=getScreenFromWorldPosition(f4,f5,f6+1) if(f7)and(f8)and(not PlayerVisible[t])then PlayerVisible[t]=true -- Works, but need to make this a table of some kind PlayerVisible[t].id="NPC" -- This can't be right PlayerVisible[t].name="Bill" -- This also doesn't seem to work outputChatBox("TM: #00FF00Point A!",255,150,50,true) end elseif(PlayerVisible[t])then -- Ped no longer in L.O.S. PlayerVisible[t]=nil -- This where I was destroying the "table" end elseif(PlayerVisible[t])then -- Ped no longer in Range PlayerVisible[t]=nil -- This is also where I was destroying the "table" end end end I think what I need to do now is create a table that contains elements with various keys to store data such as: Element, "Name", "ID" and so on... Problem is, I'm not yet familiar with how to create such a table and then use it correctly. The On/Off statement was more or less for testing before going onwards So... In order for me to finish this, I have to find out how these table structures work exactly... To make the ID and NAME along with the ELEMENT itself all work
  14. I'll explain what exactly I'm trying to make here in order to better understand what I want the code to do: The "Seconds" function will trigger every second to check for Players/Peds (Currently only testing Peds though) that are in range of the player and also have a L.O.S. This is because I don't want to put all these loops and checks under the ClientRender Event since it is constantly called. Anyway, the Player/Ped is then marked with PlayerVisible while/when still in range and has a L.O.S., if that Player/Ped loses either, then that is when it is removed. Although not shown in any of the code above, once a Player/Ped is marked with PlayerVisible (Point Z), DX Draws are used on the marked element to create ID, Playername, Health Bar, Armor Bar and Local Text which would come from saying anything in the local chat. So basically, this can just be thought of something like a simple nametag, if a player is close enough with a L.O.S. then it'll be seen by that player (Peds too) DrawDXTextOnElement(l,"LOCAL: OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",1.12,25.0,255,255,255,255,1.3) I have always thought that the l position in loops were always numbers(1st Var), but in this case it must be the stored element because it draws it on the Ped it found (But also keep in mind, I'm currently only testing on Peds as other players will need to be handled slightly different I'm sure) So far, it is working, next I will test on 3 different Peds all at the same time to be sure, then finally add in support for other players and whatnot Short Answer: Only players who fall out of range or lose L.O.S. lose the statement
  15. I figured it out, I did need to use pairs and not ipairs, thx IIYama But I was also pointing at the t var when I needed to be pointing at the l var function ClientRender()-- This event is constantly called, it's not wise to add anything here unless you have NO other choice... You were warned! for l,t in pairs(PlayerVisible)do -- I suspect this line is the problem?! ((( I just needed to change from ipairs to pairs, thx IIYama ))) if(PlayerVisible[l])then -- If this "statement" is removed, Point Z is reached... ((( I just had to change the [t] to [l] and now it works ))) outputChatBox("TM: #FFFFFFPoint Z!",255,150,50,true)-- Not reaching this point... ((( With the noted changes, I now reach Point Z ))) end end end