Jump to content

Captain Cody

Members
  • Posts

    2,753
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Captain Cody

  1. Well you can just rename the TXT file to a lua file and load it from there. Or use XML functions in the TXT file
  2. [lua] marker = createMarker( -1240.044921875, 472.73046875, 6.1875, "cylinder", 1.5, 255, 0, 0, 255 ) marker2 = createMarker( 2817.818359375, -1449.072265625, 27.15625, "cylinder", 1.5, 255, 0, 0, 255 ) marker3 = createMarker( -1950.7351074219, 146.02836608887, 27.654912948608, "cylinder", 1.5, 255, 0, 0, 255 ) setElementDimension (marker3, 1) function show2(hitPlayer,dimension ) if dimension and getElementDimension(hitPlayer) == getElementDimension(source) then if (source == marker ) then triggerClientEvent (hitPlayer,"show",getRootElement(),hitPlayer) elseif (source == marker2) then triggerClientEvent (hitPlayer,"show",getRootElement(),hitPlayer) elseif (source == marker3) then triggerClientEvent (hitPlayer,"show",getRootElement(),hitPlayer) end end end addEventHandler("onMarkerHit", getRootElement(),show2) [/lua]
  3. marker = createMarker( -1240.044921875, 472.73046875, 6.1875, "cylinder", 1.5, 255, 0, 0, 255 ) marker2 = createMarker( 2817.818359375, -1449.072265625, 27.15625, "cylinder", 1.5, 255, 0, 0, 255 ) marker3 = createMarker( -1950.7351074219, 146.02836608887, 27.654912948608, "cylinder", 1.5, 255, 0, 0, 255 ) setElementDimension (marker3, 1) function show2(hitPlayer,dim) if (source == marker and dim) then triggerClientEvent (hitPlayer,"show",getRootElement(),hitPlayer) elseif (source == marker2) then triggerClientEvent (hitPlayer,"show",getRootElement(),hitPlayer) elseif (source == marker3) then triggerClientEvent (hitPlayer,"show",getRootElement(),hitPlayer) end end addEventHandler("onMarkerHit", getRootElement(),show2)
  4. If you're using lots of synced set element datas your server CPU usage will start increasing alot due to it constantly being sync. Using setAccountData and just using triggerClientSideEvent, will drop CPU usage alot. Also you'd only have to set it to said player once and not have to use the SQL And setElementData on join.
  5. ---- never mind, getElementParent works for GUI to.
  6. Oh wow I didn't know about that, thank you.
  7. How exactly would I use this? Can you give an example
  8. Any way to list a GUI elements children? I'm trying to make a script that automatically converts GUI into DX gui using presets I have made, but I cannot find how I would go about listing a GUI elements children as to automatically convert them all. Or even better, any way to list all the GUI from a certain resource?
  9. Oh yeh never mind, that just didn't look right at all.
  10. Using my code marker will only be deleted for you
  11. CLIENT --- addEventHandler("OnClientMarkerLeave", getRootElement(), function() if isElement(source) and getElementData(source, "tentMark") then local tent = getElementData(source, "tent") local tentCol = getElementData(source, "tentCol") if isElement(tent) then destroyElement(tentCol) destroyElement(tent) end destroyElement(source) setElementData(localPlayer, "Tent", getElementData(localPlayer, "Tent") + 1,true) triggerServerEvent ( "UnBindSetTent", resourceRoot ) end end) SERVER ---- function UnBindSetTent() unbindKey(client,"enter", "down", setTent) end addEvent( "unBindSetTent", true ) addEventHandler( "unBindSetTent", resourceRoot, UnBindSetTent) Untested.
  12. Line 7, = and > are backwards. if getPlayerWantedLevel(v) => 1 then Also line 8, add a local before wanted. Will mess up if alot of people use it in the same time period without local.
  13. If you need any help you can PM me or add me on Skype. I've been working on finishing an old Abandon project for use in an MTA server so I've been figuring out how to do stuff such as that.
  14. For the scripts that you want to download first use 1 then the scripts you want last -1 --- Put them in the META files.
  15. As walid said For the scripts that you want to download first use 1 then the scripts you want last -1
  16. function checkTimer(timer) if getMissionTimerTime (timer) < 1 then killtimer(timera) --- Continue on here. end end timera = setTimer ( checkTimer, 1000, 0,timer )
  17. function getMissionTimerTime (timer) local remaining = getTimerDetails(timer) return remaining end
  18. Xwad. Cols are very easy to fix. You export them from 3ds max using Kams scripts, then use Col editor http://www.gtagarage.com/mods/show.php?id=1154 Load up the col and hit optimize, then save. And load it up. Make sure the object is at cords 0,0,0 and rotation 0,0,0 when exporting though. Also if you want the map to look awesome, I'd recommend you do proper prelighting. http://www.gtagarage.com/mods/show.php?id=6052
  19. Well you could have just asked me through skype. Any ways you need onClientRender, and getDistanceBetween two points as Walid said. basicly, use either onClientRender or a timer to check every so often how far away you are from the house, if below said point set it visible to you, else set it invisible.
  20. For making / removing licences -- desk = createObject( 2165, -1952.6999511719, 293.79998779297, 34.5, 0, 0, 90 ) ped = createPed( 69, -1952, 294, 35.5, 89.9986267, false ) function wangcars( playerSource ) local x, y, z = getElementPosition( playerSource ) local px, py, pz = getElementPosition( ped ) local dist = getDistanceBetweenPoints3D( x, y, z, px, py, pz ) local pedhealth = getElementHealth( ped ) if ( dist < 3 ) and not ( isPedDead( ped ) ) then local playername = getAccountName(getPlayerAccount(playerSource)) local playermoney = getPlayerMoney( playerSource ) if ( fileExists( "licences/"..playername..".txt" ) ) then outputChatBox( "You already bought a driving licence.", playerSource, 255, 0, 0 ) elseif ( playermoney < 1200 ) then outputChatBox( "You don't have enough money. A driving licence costs 1200$!", playerSource, 255, 0, 0 ) else outputChatBox( "You have successfully bought a driving licence for 1200$. #BD0000Type /dellicence to delete your driving licence.", playerSource, 28, 189, 0, true ) local fileHandle = fileCreate( "licences/"..playername..".txt" ) setPlayerMoney( getPlayerFromName( playername ), playermoney - 1200 ) if ( fileHandle ) then fileWrite( fileHandle, "--Bought a driving licence--" ) fileClose( fileHandle ) end end else outputChatBox( "Since you or someone else killed the trader, you can't buy a driving licence. Ask an administrator for help.", playerSource, 255, 0, 0 ) return end end addCommandHandler( "buylicence", wangcars ) --the player also has the ability to delete his licence: function dellicence( playerSource ) local playername = getAccountName(getPlayerAccount(playerSource)) if ( fileExists( "licences/"..playername..".txt" ) ) then fileDelete( "licences/"..playername..".txt" ) outputChatBox( "You deleted your driving licence.", playerSource, 0, 255, 0 ) else outputChatBox( "You don't have a driving licence!", playerSource, 255, 0, 0 ) end end addCommandHandler( "dellicence", dellicence ) For handling if he/she has one -- function havelicence() local playerSource = source local veh = getPedOccupiedVehicle( playerSource ) if ( veh ) then local vehseat = getPedOccupiedVehicleSeat( playerSource ) if ( vehseat = 0 ) then if not( fileExists( "licences/"..getAccountName(getPlayerAccount(playerSource))..".txt" ) ) then setControlState ( playerSource, "enter_exit", true ) setControlState ( playerSource, "enter_exit", false ) outputChatBox( "You do not have a driving licence. Buy one at Wang Cars for 1200$!",playerSource, 255, 0, 0 ) end end end end addEventHandler( "onPlayerVehicleEnter", root, havelicence ) playerName was not defined in the kick player from vehicle thing. And getAccountName is a much better way of doing it. Also, onPlayerVehicleEnter uses source instead of it being defined up top.
×
×
  • Create New...