Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. setTimer ( function ( ) for _, player in ipairs ( getElementsByType ( "player" ) ) do local wanted = getPlayerWantedLevel ( player ) local x, y, z = getElementPosition ( player ) if ( wanted <= 0 ) then destroyElement ( obj ) elseif ( wanted >= 0 ) then obj = createObject ( 1247, x, y, z ) attachElements ( obj, player, 0, 0, 1.5 ) end end end ,1000, 0 ) This is not efficient though.
  2. Well, there's no event for when wanted level changes, so you maybe should make a timer to loop all players, or make a custom event.
  3. function Police ( text, type ) local team = getPlayerTeam ( source ) if ( team and getTeamName ( team ) == "Police" ) then if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Console" ) ) then outputChatBox ( "#0000FF* [Police] x ".. getPlayerName ( source ) .." :#ffFFff " .. text, getRootElement(), true ) cancelEvent ( ) end end end addEventHandler ( "onPlayerChat", getRootElement(), Police )
  4. I don't really understand what are you trying to do, though, the first problem I see is that you are placing 'source' as argument, but 'source' is already defined.
  5. Castillo

    dxGUI

    I'm not sure, there was another one, could be that one.
  6. If so, you can use getElementData to get the class.
  7. Do you save the class on element data?
  8. Yo uso este: viewtopic.php?f=108&t=33905
  9. Oh yeah, I set it to freeze it again instead of unfreeze, copy it again.
  10. No offense, but that doesn't make any sense, try this: function startup() local file = xmlLoadFile("pns.xml") for k, v in ipairs(xmlNodeGetChildren(file)) do local pos = split(xmlNodeGetAttribute(v,"pos"),string.byte(",")) local marker = createMarker(pos[1],pos[2],pos[3],"cylinder") createBlipAttachedTo(marker,63,2,255,0,0,255,0,250) setElementData(marker,"pnsMarker",true) setGarageOpen(tonumber(xmlNodeGetAttribute(v,"garage")),true) end xmlUnloadFile(file) end addEventHandler("onResourceStart",getResourceRootElement(),startup) function payNSpray(hitElement) if (getElementData(source,"pnsMarker") == true) then if (getElementType(hitElement) == "vehicle") then if (getElementHealth(hitElement) < 1000) then if (getVehicleOccupant(hitElement)) then local driver = getVehicleOccupant(hitElement) local charge = math.floor(1000-getElementHealth(hitElement)) if (getPlayerMoney(driver) >= charge) then setElementFrozen ( hitElement, true ) outputChatBox("Your vehicle has been repaired for $"..charge..".",driver,255,255,0) fixVehicle(hitElement) takePlayerMoney(driver,charge) for k, v in ipairs({"accelerate","enter_exit","handbrake"}) do toggleControl(driver,v,false) end setControlState(driver,"handbrake",true) fadeCamera(driver,false,1) setTimer(restoreControl,1000,1,driver) else local extraCost = math.floor(charge-getPlayerMoney(driver)) outputChatBox("You need an additional $"..extraCost.." for a repair.",driver,255,0,0) end end end end end end addEventHandler("onMarkerHit",getRootElement(),payNSpray) function restoreControl(driver) for k, v in ipairs({"accelerate","enter_exit","handbrake"}) do toggleControl(driver,v,true) end local vehicle = getPedOccupiedVehicle ( driver ) if ( vehicle ) then setElementFrozen ( vehicle, false ) end setControlState(driver,"handbrake",false) fadeCamera(driver,true) end
  11. @Mr.Pres[T]ege: That isn't even what he was looking for, or maybe he didn't explain it right. That means that he wants a marker to open the ammunation GUI, not to teleport a player to the interior.
  12. Well, if you don't want to see that I'm helping you, I won't even bother replying. You obviously want others to do things for you, like many people around here, something as simple as this shouldn't be hard at all, you obviously don't pay attention at all.
  13. No, you did a mess, try to do it again from scratch.
  14. Castillo

    dxGUI

    There was another one uploaded, you could try it.
  15. Castillo

    HIRES Radar

    Editing it. Open "radar.lua" file which is inside the resource and replace the content of it with this: -- No touch, kthxbai local tiles = { } local timer local enabled = false local ROW_COUNT = 12 function toggleCustomTiles ( ) -- Toggle! enabled = not enabled -- Check whether we enabled it if enabled then -- Load all tiles handleTileLoading ( ) -- Set a timer to check whether new tiles should be loaded (less resource hungry than doing it on render) timer = setTimer ( handleTileLoading, 500, 0 ) else -- If our timer is still running, kill it with fire if isTimer ( timer ) then killTimer ( timer ) end -- Unload all tiles, so the memory footprint has disappeared magically for name, data in pairs ( tiles ) do unloadTile ( name ) end end outputChatBox ( "Custom radar "..(enabled and "enabled" or "disabled")) end addEventHandler ( "onClientResourceStart", resourceRoot, toggleCustomTiles ) bindKey("F5","down",toggleCustomTiles) addCommandHandler ( "cusradar", toggleCustomTiles ) function handleTileLoading ( ) -- Get all visible radar textures local visibleTileNames = table.merge ( engineGetVisibleTextureNames ( "radar??" ), engineGetVisibleTextureNames ( "radar???" ) ) -- Unload tiles we don't see for name, data in pairs ( tiles ) do if not table.find ( visibleTileNames, name ) then unloadTile ( name ) end end -- Load tiles we do see for index, name in ipairs ( visibleTileNames ) do loadTile ( name ) end end function table.merge ( ... ) local ret = { } for index, tbl in ipairs ( {...} ) do for index, val in ipairs ( tbl ) do table.insert ( ret, val ) end end return ret end function table.find ( tbl, val ) for index, value in ipairs ( tbl ) do if value == val then return index end end return false end ------------------------------------------- -- -- Tile loading and unloading functions -- ------------------------------------------- function loadTile ( name ) -- Make sure we have a string if type ( name ) ~= "string" then return false end -- Check whether we already loaded this tile if tiles[name] then return true end -- Extract the ID local id = tonumber ( name:match ( "%d+" ) ) -- If not a valid ID, abort if not id then return false end -- Calculate row and column local row = math.floor ( id / ROW_COUNT ) local col = id - ( row * ROW_COUNT ) -- Now just calculate start and end positions local posX = -3000 + 500 * col local posY = 3000 - 500 * row -- Fetch the filename local file = string.format ( "sattelite/sattelite_%d_%d.jpeg", row, col ) -- Now, load that damn file! (Also create a transparent overlay texture) local texture = dxCreateTexture ( file ) -- If it failed to load, abort if not texture --[[or not overlay]] then outputChatBox ( string.format ( "Failed to load texture for %q (%q)", tostring ( name ), tostring ( file ) ) ) return false end -- Now we just need the shader local shader = dxCreateShader ( "texreplace.fx" ) -- Abort if failed (don't forget to destroy the texture though!!!) if not shader then outputChatBox ( "Failed to load shader" ) destroyElement ( texture ) return false end -- Now hand the texture to the shader dxSetShaderValue ( shader, "gTexture", texture ) -- Now apply this stuff on the tile engineApplyShaderToWorldTexture ( shader, name ) -- Store the stuff tiles[name] = { shader = shader, texture = texture } -- Return success return true end function unloadTile ( name ) -- Get the tile data local tile = tiles[name] -- If no data is present, we failed if not tile then return false end -- Destroy the shader and texture elements, if they exist if isElement ( tile.shader ) then destroyElement ( tile.shader ) end if isElement ( tile.texture ) then destroyElement ( tile.texture ) end -- Now remove all reference to it tiles[name] = nil -- We succeeded return true end
  16. Functions: createMarker setElementInterior Event: onClientMarkerHit
  17. The only way to block that is removing the command itself from the freeroam script.
  18. Castillo

    [WIP]MTAM

    Hi people. I was thinking today, would this resource be actually interesting for any server? because a lot of people has told me that it wouldn't be that useful without multi-server system ( chatting between servers, watching profiles, etc... ), so my question is, do you think I should continue working on this even when it does not include multi-server system?
  19. addEventHandler ( "onPlayerLogin", getRootElement ( ), function ( ) triggerClientEvent ( source, "onLogin", source ) end ) And change "source()" at client side with "root".
  20. Instead of triggering to root, use the player that logged in ( source ).
×
×
  • Create New...