Jump to content

Sasu

MTA Contributors
  • Posts

    1,056
  • Joined

  • Last visited

Everything posted by Sasu

  1. Sasu

    Patriot

    addEventHandler("onClientVehicleEnter", root, function() if getElementModel( source ) == 470 ) then w = createWeapon ( "minigun", 0, 0, 0 ) setWeaponAmmo( w, 99999999 ) attachElements ( w, v, 0, 0, 1.38, 0, 30, 90) end end ) function checkVehicles() local v = getPedOccupiedVehicle(source) if ( v and getElementModel( v ) == 470 ) then setWeaponState ( w, "firing") end end bindKey("lctrl","both",checkVehicles)
  2. function VehicleAccolor (player) local accName = getAccountName ( getPlayerAccount( player ) ) if ( accName == "Reflex" )then setVehicleColor( source, 0, 0, 0 ) end end addEventHandler ( "onVehicleEnter", getRootElement(), VehicleAccolor )
  3. Monstranos la funcion cuando presionas el boton.
  4. Sasu

    Patriot

    Seguramente te refieres a esta funcion. fireWeapon
  5. addEventHandler("onPlayerCommand", root, function(cmd) if cmd == "register" or cmd == "login" then cancelEvent() end end )
  6. this will works as far as i know -- server local adminACL = {} adminACL[1] = { "Admin" } adminACL[2] = { "SuperModerator" } adminACL[3] = { "Moderator" } adminACL[4] = { "Console" } addCommandHandler("update", function(source) local playerAcc = getPlayerAccount(source) local accName = getAccountName(playerAcc) for _, objects in ipairs(adminACL) do if isObjectInACLGroup ("user."..accName, aclGetGroup ( adminACL[1] ) ) or isObjectInACLGroup ("user."..accName, aclGetGroup ( adminACL[2] ) ) or isObjectInACLGroup ("user."..accName, aclGetGroup ( adminACL[3] ) ) or isObjectInACLGroup ("user."..accName, aclGetGroup ( adminACL[4] ) ) then triggerClientEvent(source, "onAdminCommandUpdate", source) end end end ) --Client addEvent("onAdminCommandUpdate", true) addEventHandler("onAdminCommandUpdate", root, function() guiSetVisible(updatePanel, true) showCursor(true) end ) So I dont need the table -.- . Anyway I have just resolved. --Server local adminACL = { "Admin", "SuperModerator", "Moderator", "Console" } addEvent("updateOn", true) addEventHandler("updateOn", root, function() local playerAcc = getPlayerAccount(source) local accName = getAccountName(playerAcc) for _, objects in ipairs(adminACL) do if isObjectInACLGroup ("user."..accName, aclGetGroup ( objects ) ) then triggerClientEvent(source, "onAdminCommandUpdate", source) end end end ) --Client addEvent("onAdminCommandUpdate", true) addEventHandler("onAdminCommandUpdate", root, function() guiSetVisible(updatePanel, true) showCursor(true) end ) addCommandHandler("update", function() triggerServerEvent("updateOn", localPlayer) end )
  7. --Server local adminACL = { "Admin", "SuperModerator", "Moderator", "Console" } addCommandHandler("update", function(source) local playerAcc = getPlayerAccount(source) local accName = getAccountName(playerAcc) for _, objects in ipairs(adminACL) do if isObjectInACLGroup ("user."..accName, aclGetGroup ( objects ) ) then triggerClientEvent(source, "onAdminCommandUpdate", source) end end end ) --Client addEvent("onAdminCommandUpdate", true) addEventHandler("onAdminCommandUpdate", root, function() guiSetVisible(updatePanel, true) showCursor(true) end ) I don't know why this scripts works in my local server and when I upload to another server dont work . Can you say me why?
  8. --Client close = guiCreateButton(312, 169, 266, 66, "Darmelo", false, GUIEditor.window[1]) guiSetProperty(close, "NormalTextColour", "FFAAAAAA") function hola ( ) if source == close then local row, col = guiGridListGetSelectedItem ( source ) if ( row and col and row ~= -1 and col ~= -1 ) then local arma = guiGridListGetItemText ( source, row, 1 ) if ( arma == "Jetpack" ) then triggerServerEvent ( "setJetpack", localPlayer ) end end end end addEventHandler( "onClientGUIClick", root, hola) --Server function daselo() local yatiene = giveWeapon ( source, 41, 99999 ) if (yatiene) then outputChatBox ( "Tes has colocado el Spray!", source, 255, 0, 0, true ) else outputChatBox ( "Ya tienes el Spray!", source, 255, 0, 0, true ) end end addEvent("setJetpack", true) addEventHandler("setJetpack", getRootElement(), darselo)
  9. Sasu

    dxDrawText

    addEventHandler("onClientRender", root, function() local px, py, pz = getElementPosition(localPlayer) local px1, py1, pz1 = getElementPosition(ped) local distance = getDistanceBetweenPoints3D( px, py, pz, px1, py1, pz1) if isElementOnScreen(ped) and distance <= 50 then local x, y, z = getPedBonePosition(ped, 6) local sx, sy = getScreenFromWorldPosition( x, y, z+0.4) dxDrawText("Tienda de Skins", sx-100, sy, _,_,_, 2, "default-bold") end end ) How do I do to dissapear the dxDrawText when you are behind an object?
  10. Sasu

    Firefighter

    All people make mistakes. Don't worry.
  11. Puedes ejecutarlo desde server side solo para un jugador. Por ejemplo: --Server addEventHandler("onVehicleEnter", root, function(player) local name = getVehicleNameFromId(getElementModel(source)) triggerClientEvent(player, "onRequestDraw", player, "Has entrado al vehiculo "..name) end ) --Client addEvent("onRequestDraw", true) addEventHandler("onRequestDraw", root, function(text) exports["drawData"]:outputDraw(text, 0, 255, 0) end ) Esto hara que cuando un jugador entre a un vehiculo, le informe el nombre del vehiculo en color verde ( 0, 255, 0 ). Espero te ayude!
  12. Sasu

    Firefighter

    But how can I create an event that trigger when player attack the fire? $:
  13. Sasu

    Firefighter

    Whats functions and event would I need to create the job "firefighter"?
  14. Oh, You're right. I forgot that. Thank you very much.
  15. addEventHandler("onPlayerVehicleExit", root, function(veh, seat) if veh == vehicleBus[source] and getElementData(source, "Ocupacion") == "Chofer de larga distancia" and getElementModel(veh) == 431 and seat == 0 then outputChatBox("Regresa al vehiculo en menos de 40 segundos si no quieres perder la mision.", source, 255, 0, 0) function customTimer(source) if isElement(markerPrice[source]) and isElement(blipPrice[source]) then destroyElement(markerPrice[source]) destroyElement(blipPrice[source]) outputChatBox("Mision fracasada...", source, 255, 0, 0) end end timeLimit[source] = setTimer(customTimer(source), 1000, 1) end end ) I have an error with this part: WARNING: script\script.lua:124: Bad argument @ 'setTimer' [Expected function at argument 1, got nil] Line 124 = Line 12 The tables and elements are defined. Its works but it is annoying that error.
  16. You should use getElementType(attacker) to check if is a player instead of vehicle, object, etc.. as i did lol But the event and parameters is wrong. "onClientPlayerDamage" --[[ attacker: A player element representing the attacker or vehicle element (when being run over or falling off a bike). weapon: An integer representing the weapon ID the attacker used ]] Should be: function cancel ( player, attackerWeapon ) if getElementType( player ) == "player" then if getTeamName ( getPlayerTeam ( player ) ) == "Emergency" then if ( attackerWeapon == 41 ) then cancelEvent() end end end end addEventHandler ( "onClientPlayerDamage", root, cancel )
  17. Y tambien debes definir x,y con guiGetScreenSize. local x,y = guiGetScreenSize()
  18. You should use getElementType(attacker) to check if is a player instead of vehicle, object, etc..
  19. Sasu

    Ayuda simple!

    Copialo de nuevo. Ya lo edite.
  20. Sasu

    Ayuda simple!

    Intenta esto: function saveClothes() local account = getPlayerAccount(source) setAccountData(account, "PreviousModel", getElementModel(source)) if ( not isGuestAccount(account) ) and ( getElementModel(source) == 0 ) then local texture = {} local model = {} for i=0, 17, 1 do local clothesTexture, clothesModel = getPedClothes(source, i) if ( clothesTexture ~= false ) then table.insert(texture, clothesTexture) table.insert(model, clothesModel) else table.insert(texture, " ") table.insert(model, " ") end end local allTextures = table.concat(texture, ",") local allModels = table.concat(model, ",") outputDebugString("Clothessaver: Saved clothes") setAccountData(account, "Clothessaver:Texture", allTextures) setAccountData(account, "Clothessaver:Model", allModels) texture = {} model = {} end end addEventHandler("onPlayerQuit", getRootElement(), saveClothes) function setClothes() local account = getPlayerAccount(source) local model = getAccountData(account, "PreviousModel") if ( not isGuestAccount(account) ) if model == 0 then local textureString = getAccountData(account, "Clothessaver:Texture") local modelString = getAccountData(account, "Clothessaver:Model") local textures = split(textureString, 44) local models = split(modelString, 44) setElementModel(source,0) for i=0, 17, 1 do if ( textures[i+1] ~= " " ) then addPedClothes(source, textures[i+1], models[i+1], i) end end outputChatBox("Clothes were added by clothessaver", source, 0, 255, 0) textures = {} models = {} else setElementModel(source, model) outputChatBox("Clothes were added by clothessaver", source, 0, 255, 0) end end end addEventHandler("onPlayerLogin", getRootElement(), setClothes) function loadClothes(player) local account = getPlayerAccount(player) if ( not isGuestAccount(account) ) then local textureString = getAccountData(account, "Clothessaver:Texture") local modelString = getAccountData(account, "Clothessaver:Model") local textures = split(textureString, 44) local models = split(modelString, 44) setElementModel(player,0) for i=0, 17, 1 do if ( textures[i+1] ~= " " ) then addPedClothes(player, textures[i+1], models[i+1], i) end end outputChatBox("Clothes were added by clothessaver", player, 0, 255, 0) textures = {} models = {} else outputChatBox("Please login!", player, 255, 0, 0) end end addCommandHandler("loadClothes", loadClothes) function saveClothes(player) local account = getPlayerAccount(player) if ( not isGuestAccount(account) ) then if ( getElementModel(player) == 0 ) then local texture = {} local model = {} for i=0, 17, 1 do local clothesTexture, clothesModel = getPedClothes(player, i) if ( clothesTexture ~= false ) then table.insert(texture, clothesTexture) table.insert(model, clothesModel) else table.insert(texture, " ") table.insert(model, " ") end end local allTextures = table.concat(texture, ",") local allModels = table.concat(model, ",") outputDebugString("Clothessaver: Saved clothes") setAccountData(account, "Clothessaver:Texture", allTextures) setAccountData(account, "Clothessaver:Model", allModels) texture = {} model = {} else outputChatBox("Your skin must be skin 0 (CJ Skin)", player, 255, 0, 0) end else outputChatBox("Please login!", player, 255, 0, 0) end end addCommandHandler("saveClothes", saveClothes)
  21. Es gridlist? Si es gridlist: guiGridListGetSelectedItem guiGridListSetSelectedItem bindKey Ejemplo ( No testeado ): function nextSelected(key) local row, column = guiGridListGetSelectedItem( theGridList ) if key == "arrow_u" then guiGridListSetSelectedItem ( theGridList, row+1, column ) elseif key == "arrow_d" then guiGridListSetSelectedItem ( theGridList, row-1, column ) end end bindKey("arrow_d", "down", nextSelected) bindKey("arrow_u", "down", nextSelected)
  22. I only could do script that save chat and debug messages. See This: addEventHandler("onResourceStart", resourceRoot, function() local newFile = fileCreate("chatSay.log") local newFile2 = fileCreate("debugMsg.log") end ) addEventHandler("onPlayerChat", root, function(msg, msgType) local theFile = fileOpen("chatSay.log") if (theFile) then if msgType == 0 then theType = " say: " elseif msgType == 1 then theType = " (/me) " elseif msgType == 2 then theType = " (Team-Say): " end local time = getRealTime() local day = time.monthday local month = time.month local hour = time.hour local minute = time.minute local anterior = fileRead(theFile, 500) fileWrite(theFile, "[ "..hour..":"..minute.." - "..day.."/"..month.." ] "..getPlayerName(source)..""..theType..""..msg.."\n") fileClose(theFile) else outputDebugString("It is not possible to open the file 'chatSay.log'") end end ) addEventHandler("onDebugMessage", root, function(msg, lvl, file, line) local theFile = fileOpen("debugMsg.log") if (theFile) then if line == nil then line = "nil" end if file == nil then file = "nil" end if lvl == 0 then theLevel = "( "..file..":"..line.." ): " elseif lvl == 1 then theLevel = "ERROR ( "..file..":"..line.." ): " elseif lvl == 2 then theLevel = "WARNING ( "..file..":"..line.." ): " elseif lvl == 3 then theLevel = "INFO ( "..file..":"..line.." ): " end local anterior = fileRead(theFile, 500) fileWrite(theFile, theLevel..""..msg) fileClose(theFile) end end )
×
×
  • Create New...