Jump to content

DNL291

Retired Staff
  • Posts

    3,875
  • Joined

  • Days Won

    67

Everything posted by DNL291

  1. Está correto. No caso da função compartilhada (client & server) que você citou, ela estando no lado client, o arquivo de script será baixado pelo client que entrou no servidor e, estando no lado server, o script será executado diretamente pelo servidor sem a necessidade de baixar o script afim de executá-lo. As funções do lado client são executadas apenas para o jogador local, é uma execução individual, que se você quiser executar para todos os jogadores (ou determinados jogadores) caso seja necessário, terá que acionar a determinada função através do lado server com triggerClientEvent. O lado server é algo global, que ao contrário do client, já será executado para todos os jogadores do servidor.
  2. Bem, uma equipe de segurança não tem e isso nem será necessário ao meu ver. A segurança já fica por conta do programador, por meio de scripts e dos administradores.
  3. DNL291

    [Problem]

    Try this: local allowedTeams = { ["Mechanics"] = true, ["Mechanic"] = true, ["Staff"] = true, ["Admins"] = true, } function fix (theVehicle, seat, jacked) if seat ~= 0 then local driver = getVehicleController(theVehicle) if (getElementType(driver) == "player") then if allowedTeams[getTeamName(getPlayerTeam(source))] and getElementHealth(theVehicle) < 999 then local price = 1001 - getElementHealth(theVehicle) givePlayerMoney(source, price*20) fixVehicle(theVehicle) outputChatBox("You have fixed this car", source, 0, 255, 0) end end end end addEventHandler("onPlayerVehicleEnter", getRootElement(), fix)
  4. exports['scoreboard']:scoreboardAddColumn(columnName, root, width) exports['scoreboard']:scoreboardSetColumnPriority(columnName, priority)
  5. function hi (player) if not isPlayerMuted(player) then outputChatBox("#FFFFFF<"..getPlayerName(player).."#ffffff>:Hey #00ffffGuys !",root,255,255,255,true) else outputChatBox("You are muted.",player, 255, 255, 0,true) end end addCommandHandler ( "hi", hi )
  6. theCop not seem to be defined at line 12.
  7. DNL291

    GUI Bind

    Put this inside the event "onClientResourceStart". for i = 1,20 do guiSetVisible ( GUIEditor.label[i] ,false ) end bindKey('F7','down', function ( ) for i = 1,20 do guiSetVisible ( GUIEditor.label[i] , not guiGetVisible ( GUIEditor.label[i] ) ) end end )
  8. Não, nunca vi pelo que me lembro. Obs: Evite fazer BUMP nos tópicos.
  9. Você pode armazenar com setElementData.
  10. 3B00DG4MER, Try this: Client function createveh() local pspawner = getLocalPlayer() local x, y, z = getElementPosition ( pspawner ) local vehicle = guiGridListGetItemText ( GUIEditor.gridlist[1], guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ), 1 ) if vehicle then outputChatBox("You selected "..vehicle..".",pspawner) triggerServerEvent("onSpawnVeh", localPlayer, tonumber(vehicle)) guiSetVisible(GUIEditor.window[1], false) showCursor(false) end end addEventHandler("onClientGUIClick", spawn, createveh, false) Server local vehicle = {} function spawnvehicle( vehID ) if isElement(vehicle[source]) then destroyElement(vehicle[source]) end local x, y, z = getElementPosition(source) vehicle[source] = createVehicle(vehID , x, y, z) if vehID == 560 then setVehicleColor ( vehicle[source], 7, 7, 0, 0 ) end warpPedIntoVehicle( source, vehicle[source] ) end addEvent( "onSpawnVeh", true ) addEventHandler( "onSpawnVeh", root, spawnvehicle )
  11. Works, thank you very much! You're welcome.
  12. Try this: function addBlueOnDamage ( totalAmmo, killer ) local killerPerson = getPlayerName ( killer ) if getElementType(killer) == "player" then fadeCamera ( killer, false, 1.0, 75, 161, 214 ) setTimer ( fadeCameraDelayed, 500, 1, killer ) end end addEventHandler ( "onPlayerWasted", getRootElement(), addBlueOnDamage ) function fadeCameraDelayed(killer) if (isElement(killer)) then fadeCamera(killer, true, 0.5) end end
  13. function createveh() local pspawner = getLocalPlayer() local x, y, z = getElementPosition ( pspawner ) local vehicle = guiGridListGetItemText ( GUIEditor.gridlist[1], guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ), 1 ) guiSetVisible(GUIEditor.window[1], false) outputChatBox("You selected "..vehicle..".",pspawner) local veh = createVehicle ( vehicle, x, y, z, 0,0,90 ) if vehicle == "560" then setVehicleColor ( veh, 7, 7, 0, 0 ) end showCursor(false) end addEventHandler("onClientGUIClick", spawn, createveh, false)
  14. You must to define the interior of the marker. local enterMarker = createMarker(1481.139, -1771.914, 19.5, "arrow", 1.5, 0, 255, 255, 0) local exitMarker = createMarker(389.76, 173.768, 1008.383, "cylinder", 1.5, 0, 255, 255, 0) setElementInterior(exitMarker, 3) function markerEnter(hitPlayer) if(hitPlayer == localPlayer) then setElementInterior (getLocalPlayer(), 3, 384.705, 173.77, 1008.383) end end addEventHandler ("onClientMarkerHit", enterMarker, markerEnter) function markerExit(hitPlayer) if(hitPlayer == localPlayer) then setElementInterior (getLocalPlayer(), 0, 1481.262, -1768.324, 18.796) end end addEventHandler ("onClientMarkerHit", exitMarker, markerExit)
  15. Do you mean remove an event handler? If so, use removeEventHandler.
  16. When you remove a player from the team, use setAccountData and remove the old player team from his account.
  17. DNL291

    Question

    Link: https://community.multitheftauto.com/in ... ls&id=8249
  18. Like this: --Server addEventHandler( "onPlayerLogin", function() triggerClientEvent(source, "doEnablePanel", source) end ) addEventHandler( "onPlayerLogout", function() triggerClientEvent(source, "doDisablePanel", source) end ) --Client addEvent("doDisablePanel", true) addEvent("doEnablePanel", true) function disablePanel() unbindKey("M", "down", showPanel) end addEventHandler("doDisablePanel", root, disablePanel) function enablePanel() bindKey("M", "down", showPanel) end addEventHandler("doEnablePanel", root, enablePanel) The client must be in the same script that the panel is in.
  19. Use bindkey("M", "down", showPanel) when player log in and unbindKey("M", "down", showPanel) when the player log out. If bindkey is on the client-side, you will need to use triggerClientEvent.
  20. Sorry, i didn't understand exactly what you mean.
  21. Armazena a quantidade de territórios que cada gang tem e o que mais for preciso armazenar. E em seguida, obtém esses dados com a função addCommandHandler e classifica.
  22. You're welcome. Yeah, my bad.
  23. It will not work at all, because the name of the function is already a MTA function (which will cause a stack overflow) and "mar" is defined locally. Also, there are other errors in the event "onMarkerHit".
×
×
  • Create New...