Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. With just that line we can't help you, post the rest of the script.
  2. function getNewLocation ( player, seat ) local vehicle = getPedOccupiedVehicle ( player ) local id = getElementModel ( vehicle ) if ( id == 448 ) and ( seat == 0 )then outputChatBox ( "A new location has been marker in your map, deliver you pizza on time!" ) local num = math.random ( #markersPosition ) marker = createMarker ( markersPosition [ num ] [ 1 ], markersPosition [ num ] [ 2 ], markersPosition [ num ] [ 3 ], "checkpoint", 1.5, 100, 150, 50 ) blip = createBlipAttachedTo ( marker, 51 ) addEventHandler ( "onClientMarkerHit", marker, function ( hitElement ) if ( hitElement and getElementType ( hitElement ) == "player" and hitElement == localPlayer ) then destroyElement ( marker ) destroyElement ( blip ) setTimer ( getNewLocation, 2000, 1, localPlayer, seat ) end end ) end end addEventHandler ( "onClientVehicleEnter", root, getNewLocation ) Proba con eso.
  3. Is not confused, because what you want is us to make the scripts for you, you are not learning at all.
  4. 1: attachElements 2: Define the object, like this: object = createObject ( model, x + 1, y, z, 0, 0, 0 ) and just before creating you do: if ( isElement ( object ) ) then destroyElement ( object ) end object = createObject ( model, x + 1, y, z, 0, 0, 0 )
  5. https://community.multitheftauto.com/ind ... ls&id=5538 I don't see the point of it, the command "/serial" is already built-on.
  6. ------------ -- Events -- ------------ function playerJoined() check(source) end addEventHandler("onPlayerJoin",getRootElement(),playerJoined) function playerChangedNick(oldNick,newNick) -- Use timer to wait until the nick really has changed setTimer(check,1000,1,source) end addEventHandler("onPlayerChangeNick",getRootElement(),playerChangedNick) function playerQuit() removePlayerFromTeam(source) end addEventHandler("onPlayerQuit",getRootElement(),playerQuit) -- Check for ACL Groups on login/logout function loggedIn() check(source) end addEventHandler("onPlayerLogin",getRootElement(),loggedIn) function loggedOut() check(source) end addEventHandler("onPlayerLogout",getRootElement(),loggedOut) -- Holds the teams as defined in the settings local teams = {} --- -- Reads the settings and creates the teams if enabled. -- function initiate() local rootNode = xmlLoadFile("config.xml") local children = xmlNodeGetChildren(rootNode) if children == false then return end for _,node in pairs(children) do local attributes = xmlNodeGetAttributes(node) local name = attributes.name local color = {getColorFromString(attributes.color)} if not color[1] then color = {255,255,255} end teams[name] = attributes teams[name].color = color teams[name].team = createTeam(name,unpack(color)) end for k,v in ipairs ( getElementsByType ( "player" ) ) do check ( v ) end end addEventHandler("onResourceStart",resourceRoot,initiate) --------------- -- Functions -- --------------- --- -- Checks the player's nick and ACL Groups and sets his team if necessary. -- -- @param player player: The player element -- function check(player) if not isElement(player) or getElementType(player) ~= "player" then debug("No player") return end local nick = getPlayerName(player) local accountName = getAccountName(getPlayerAccount(player)) for name,data in pairs(teams) do local tagMatch = false local aclGroupMatch = false if data.tag ~= nil and string.find(nick,data.tag,1,true) then tagMatch = true end if data.aclGroup ~= nil and accountName and isObjectInACLGroup("user."..accountName,aclGetGroup(data.aclGroup)) then aclGroupMatch = true end if data.required == "both" then if tagMatch and aclGroupMatch then addPlayerToTeam(player,name) setTimer(check2, 500, 1) return end else if tagMatch or aclGroupMatch then addPlayerToTeam(player,name) setTimer(check2, 500, 1) return end end end removePlayerFromTeam(player) setPlayerTeam(player,nil) setTimer(check2, 500, 1) end function check2() if toboolean(get("noEmptyTeams")) then for i,v in pairs(teams) do team2 = teams[i].name team = getTeamFromName(teams[i].name) if isElement(team) and getElementType(team) == "team" then if countPlayersInTeam(team) == 0 then debug("Removed team '" .. tostring(team2) .. "' since it has no players") destroyElement(team) end end end end end --- -- Adds a player to the team appropriate for the name. -- It is not checked if the team is really defined in the table, since -- it should only be called if it is. -- -- Creates the team if it doesn't exist. -- -- @param player player: The player element -- @param string name: The name of the team -- function addPlayerToTeam(player,name) local team = teams[name].team if not isElement(team) or getElementType(team) ~= "team" then team = createTeam(teams[name].name,unpack(teams[name].color)) teams[name].team = team end setTimer(setPlayerTeam, 500, 1, player, team) debug("Added player '"..getPlayerName(player).."' to team '"..name.."'") end --- -- Removes a player from a team. Also checks if any team -- needs to be removed. -- -- @param player player: The player element -- function removePlayerFromTeam(player) setPlayerTeam(player, nil) debug("Removed player '"..getPlayerName(player).."' from team") --[[if toboolean(get("noEmptyTeams")) then for i,v in pairs(teams) do team = getTeamFromName(teams[i].name) if isElement(team) and getElementType(team) == "team" then if countPlayersInTeam(team) == 0 then destroyElement(team) end end end end]] end --- -- Converts a string-boolean into a boolean. -- -- @param string string: The string (e.g. "false") -- @return true/false Returns false if the string is "false" or evaluates to false (nil/false), true otherwise -- function toboolean(string) if string == "false" or not string then return false end return true end ----------- -- Debug -- ----------- -- Little debug function to turn on/off debug setElementData(getResourceRootElement(),"debug",true) function debug(string) if getElementData(getResourceRootElement(),"debug") then outputDebugString("autoteams: "..string) end end The problem was the empty team setting checker, I removed the check at "initiate" function.
  7. Their position is changed.
  8. local hRow = nil hWnd = guiCreateWindow( 0.1, 0.1, 0.2, 0.65, "Hats", true ); hButton_use = guiCreateButton( 0.1, 0.725, 0.5, 0.1, "Use", true, hWnd ); hButton_close = guiCreateButton( 0.1, 0.85, 0.5, 0.1, "Close", true, hWnd ); local aObjects = { { "Gate", 980 }, { "Bottle", 980 }, { "Flower pot", 980 }, { "Bin", 980 }, { "Fan", 980 }, { "WW1 hat", 980 }, { "WW2 hat" }; hGrid = guiCreateGridList( 0.1, 0.10, 0.8, 0.60, true, hWnd ); guiGridListAddColumn( hGrid, "ZM hats", 0.85 ); for i,m_obj in ipairs( aObjects ) do hRow = guiGridListAddRow( hGrid ); -- guiGridListSetItemText ( hGrid, hRow, 1, tostring( m_obj [ 1 ] ), false, false ); guiGridListSetItemData ( hGrid, hRow, 1, tostring( m_obj [ 2 ] ) ); end function use ( ) local row, col = guiGridListGetSelectedItem ( hGrid ) if ( row and col and row ~= -1 and col ~= -1 ) then local model = tonumber ( guiGridListGetItemData ( hGrid, row, 1 ) ) local x, y, z = getElementPosition ( localPlayer ) createObject ( model, x + 1, y, z, 0, 0, 0 ) end end addEventHandler ( "onClientGUIClick", hButton_use, use, false )
  9. Yes, I got them from a Stargate mod for GTA SA. @Perfect: The light is a "corona" marker attached to a invisible object to move it.
  10. Castillo

    ¿im good? VI

    function soundBind ( _, keyState ) if ( keyState == "down" ) then sound = playSound ( "music2.mp3" ) elseif ( keyState == "up" ) then if ( sound ) then stopSound ( sound ) end end end bindKey ( "w", "both", soundBind )
  11. By "actual" color you mean team color?
  12. elseif ( action == "slap" ) then local vehicle = getPedOccupiedVehicle ( player ) local theElement = ( vehicle and vehicle or player ) if ( getElementHealth ( theElement ) > 0 ) then if ( getElementType ( theElement ) == "player" and not isPedDead ( theElement ) ) or ( getElementType ( theElement ) == "vehicle" and not isVehicleBlown ( theElement ) ) then if ( ( not data ) or ( not tonumber ( data ) ) ) then data = 20 end if ( ( tonumber ( data ) >= 0 ) ) then if ( tonumber ( data ) > getElementHealth ( theElement ) ) then if ( getElementType ( theElement ) == "player" ) then setTimer ( killPed, 50, 1, theElement ) else setTimer ( blowVehicle, 50, 1, theElement ) end else setElementHealth ( theElement, getElementHealth ( theElement ) - data ) end local x, y, z = getElementVelocity ( theElement ) setElementVelocity ( theElement, x , y, z + 0.2 ) mdata = data else action = nil end else action = nil end else action = nil end
  13. You can check if the target is on a vehicle with: isPedOnVehicle, and if he/she is, then get his/her vehicle with: getPedOccupiedVehicle.
  14. I don't know, that's what he had, so I though he was checking if it's sending a "killer" at all.
  15. Click the link which redirects to the wiki and read the example.
  16. That's because is a element, you should use: tostring ( ): outputChatBox ( "Killer: ".. tostring ( collider ), source )
  17. You must use the Engine functions to replace the texture. engineLoadTXD engineImportTXD
  18. @Vendetta: What is the problem exactly? does it output any debugscript error? @SunLight: What you just said makes no sense.
  19. Eso es porque solo es un argumento de rotacion no 3.
  20. You can try replacing them with this resource: https://community.multitheftauto.com/ind ... ls&id=3016
  21. Your code should work, maybe the DFF is the problem.
  22. That's because you forgot to add the row with: guiGridListAddRow
×
×
  • Create New...