Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. Pero esta en el mismo recurso, verdad?
  2. Castillo

    Help

    Try this: addEventHandler('onPlayerChat',root, function (msg, msgType) if (msgType == 0 and string.find(getPlayerName(source),'XX|')) then outputChatBox(getPlayerName(source) ..": #FFFFFF".. msg,root,0,255,255,true) end end )
  3. Castillo

    Need help

    That script is client side, and you're using a server side event. local posX, posY, posZ = 269.70001220703, -1895.0999755859, 0.69999998807907 local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) local radioURL = "http://www.181.fm/winamp.pls?station=181-power&style=mp3" local radius = 150 local volume = 4.0 addEventHandler("onClientResourceStart",resourceRoot, function() local radio = playSound3D(radioURL, posX, posY, posZ, false) setSoundVolume(radio, volume) setSoundMaxDistance(radio, radius) end ) message = { "#ffff00RADIO: #ffffffStream stopped" } addEventHandler("onClientColShapeLeave",RadioColshape, function(tplayer) if (getElementType(tplayer) == "player" and tplayer == localPlayer) then local msg = math.random(#message) setTimer(outputChatBox, 800, 1, msg, tplayer, 255, 255, 255, true) end end )
  4. This script "pushes" players, not vehicles! You must do like this: /push (SAUR)Castillo
  5. -- client side: mision = guiCreateWindow(266,136,294,325,"",false) guiWindowSetMovable(mision,false) guiWindowSetSizable(mision,false) memo = guiCreateMemo(9,121,275,150,"TEXTO DE MISION",false,mision) guiMemoSetReadOnly(memo,true) misionlabel = guiCreateLabel(99,35,99,32,"Misión 1",false,mision) guiSetFont(misionlabel,"sa-header") informe = guiCreateLabel(11,97,104,17,"Informe de misión",false,mision) guiSetFont(informe,"default-bold-small") botonabrir = guiCreateButton(46,282,204,22,">",false,mision) guiSetVisible(mision,false) choice = guiCreateWindow(561,367,156,94,"",false) aceptarM1 = guiCreateButton(10,25,137,28,"Aceptar misión",false,choice) rechazarM1 = guiCreateButton(10,54,137,28,"Rechazar misión",false,choice) guiSetVisible(choice,false) addEventHandler("onClientGUIClick",root, function () if (source == botonabrir) then if not guiGetVisible(choice) then guiSetVisible(choice,true) end elseif (source == rechazarM1) then guiSetVisible(mision,false) guiSetVisible(choice,false) showCursor(false) end end ) function mostrarMision() guiSetVisible (mision,true) showCursor(true) end addEvent("mostrarMisionTT",true) addEventHandler("mostrarMisionTT",getRootElement(),mostrarMision) -- server side: marcadorM1T = createMarker(44,1525.1999511719,12.800000190735,"cylinder",2,46,208,14,255) addEventHandler("onMarkerHit",marcadorM1T, function (hitPlayer) if getElementType(hitPlayer) == "player" then if (getPlayerTeam(hitPlayer) == grupoTerrorista) then triggerClientEvent(hitPlayer,"mostrarMisionTT",hitPlayer) end end end ) P.D: La variable "grupoTerrorista" esta en este script, verdad?
  6. Te falta el módulo de MySQL. https://wiki.multitheftauto.com/wiki/Mysql
  7. Use this one: function pushim (thePlayer, commandName, ...) local player = findPlayer(...) if (not player) then outputChatBox("* /push: player not found", thePlayer) return end if isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) x,y,z = getElementVelocity(vehicle) setElementVelocity ( vehicle, x, y, z+0.30) outputChatBox( getPlayerName(thePlayer).. " Push " ..getPlayerName(player), getRootElement(), 255, 255, 0, true) end end addCommandHandler("push", pushim) function findPlayer(namepart) local player = getPlayerFromName(namepart) if player then return player end for _,player in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(player):lower(),"#%x%x%x%x%x%x", ""), namepart:lower(), 1, true) then return player end end return false end
  8. Try this: local t = { } function checkValues( source,arg1,arg2 ) if (arg1 > 60) then t[ source ][ 'min' ] = tonumber( t[ source ][ 'min' ] or 0 ) + 1 t[ source ][ 'sec' ] = 0 elseif (arg2 > 3600) then t[ source ][ 'sec' ] = 0 t[ source ][ 'min' ] = 0 t[ source ][ 'hour' ] = tonumber( t[ source ][ 'hour' ] or 0 ) + 1 end return arg1, arg2 end setTimer( function( ) for _, v in pairs( getElementsByType( "player" ) ) do if (not t[ v ]) then t[ v ] = {["hour"] = 0, ["min"] = 0, ["sec"] = 0} end t[ v ][ 'sec' ] = tonumber( t[ v ][ 'sec' ] or 0 ) + 1 local min,hour = checkValues ( v, t[ v ][ 'min' ] or 0, t[ v ][ 'hour' ] or 0 ) setElementData( v, "Tiempo Jugado", tostring( hour )..':'..tostring( min ) ) end end, 1000, 0 ) function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local sValue = getElementData( source,'Tiempo Jugado' ) setAccountData ( playeraccount, "Tiempo Jugado", sValue ) end t[ source ] = nil end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local time = getAccountData ( playeraccount, "Tiempo Jugado" ) if ( time ) then setElementData ( source, "Tiempo Jugado", time ) end end end addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) addEventHandler ( "onPlayerLogin", root, onPlayerLogin )
  9. Wrong, it's SERVER SIDE. @matito6: Did you refresh by /refresh? or just writing refresh in server console (black window)?
  10. Learn how to make a meta.xml here: https://wiki.multitheftauto.com/wiki/Meta.xml P.S: Everyone: Please let him do it by himself.
  11. En el recurso: "sql/mysql.lua" encontraras las siguientes variables: local server = get( "server" ) or "localhost" local user = get( "user" ) or "root" local password = get( "password" ) or "" local db = get( "database" ) or "mta" Solo cambialas en el script, guardarlo y cerralo.
  12. @Benxamix: That doesn't answer his question. @Xeno: Try this: viewtopic.php?f=13&t=29363 I don't know if it works or not.
  13. exports.BHZ4_scoreboard:addScoreboardColumn('Tiempo Jugado') setTimer( function( ) for _, v in pairs( getElementsByType( "player" ) ) do local totalTime = getElementData( v,"totalTime" ) or 0 setElementData( v,"totalTime",totalTime+1 ) setElementData( v,"Tiempo Jugado",math.floor( tonumber( totalTime )/3600 ).." H : "..math.floor( tonumber( totalTime )/60 ).." M" ) end end, 1000, 0 ) function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local time = getElementData ( source, "totalTime" ) setAccountData ( playeraccount, "totalTime", time ) end end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local time = getAccountData ( playeraccount, "totalTime" ) if ( time ) then setElementData ( source, "totalTime", time ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin)
  14. Would you give more information? are you willing to pay to the Scripter for his/her time?
  15. Castillo

    Lua classes

    As far as I know there are examples in that link.
  16. Nunca funcionaron para mi, osea para que funcionen necesitas editar la scoreboard y agregarlos.
  17. La scoreboard no detecta los colores HEX, pero podes desabilitarlos con una setting que tiene.
  18. Castillo

    Help pls!

    Weapon stats doesn't has any bug, I've used them in one of my script's and works fine.
  19. -- client side: function levelup () local Exp = getElementData(localPlayer,"ExP") local Level = getElementData(localPlayer,"Level") if isElement(expLabel) then destroyElement(expLabel) end expLabel = guiCreateLabel(0.777,0.22,0.1708,0.0963,"ExP gained: ??\nTotal ExP: ".. tostring(Exp) .."\nLevel: ".. tostring(Level),true) guiLabelSetColor(expLabel,0,255,0) guiLabelSetVerticalAlign(expLabel,"top") guiLabelSetHorizontalAlign(expLabel,"left",false) guiSetFont(expLabel,"clear-normal") setTimer ( levelup, 2000, 1) end setTimer ( levelup, 2000, 1) -- server side: exports.scoreboard:scoreboardAddColumn("ExP") exports.scoreboard:scoreboardAddColumn("Level") local levels = {[30] = 1, [55] = 2, [75] = 3, [85] = 4, [95] = 5, [120] = 6, [150] = 7, [230] = 8, [350] = 9, [500] = 10} function win(ammo, killer, weapon, bodypart) if (killer and killer ~= source) then local H = getElementData(killer, "ExP") local S = getElementData(killer, "Level") local killer1 = getPlayerName(killer) local noob = getPlayerName(source) setElementData(killer, "ExP", tonumber(H)+1) if levels[tonumber(H)] then setElementData(killer, "Level", "Lvl ".. tostring(levels[tonumber(H)]) .." !") triggerClientEvent ( killer, "playSound", killer ) end outputChatBox(killer1 .. "Killed " .. noob .. " and gained +1 Exp", getRootElement(), 255, 255, 0, false) end end addEventHandler( "onPlayerWasted", getRootElement(), win) function onLogin (_,account) setElementData(source, "Level", getAccountData(account, "lvl") or "Level 0 !") setElementData(source, "ExP", getAccountData(account, "exp") or "0") end addEventHandler ("onPlayerLogin", root, onLogin) function saveData(thePlayer, theAccount) if (theAccount and not isGuestAccount(theAccount)) then setAccountData (theAccount, "lvl", getElementData(thePlayer, "Level")) setAccountData (theAccount, "exp", getElementData(thePlayer, "ExP")) end end addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function (prev) saveData(source, prev) end)
  20. function pushim (thePlayer, commandName, ...) local player = findPlayer(...) if (not player) then outputChatBox("* /push: player not found", thePlayer) return end if isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) x,y,z = getElementVelocity(vehicle) setElementVelocity ( vehicle, x, y, z+0.30) outputChatBox( getPlayerName(thePlayer).. " Push " ..getPlayerName(player), getRootElement(), 255, 255, 0, true) end end addCommandHandler("push", pushim) function findPlayer(namepart) local player = getPlayerFromName(namepart) if player then return player end for _,player in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(player):lower(),"#%x%x%x%x%x%x", ""), namepart:lower(), 1, true) then return player end end return false end
  21. Castillo

    Help me

    Do you have notepad++? it has a feature to change the Encoding.
  22. Try this: exports.scoreboard:scoreboardAddColumn("EXP") exports.scoreboard:scoreboardAddColumn("Level") local levels = {[30] = 1, [55] = 2, [75] = 3, [85] = 4, [95] = 5, [120] = 6, [150] = 7, [230] = 8, [350] = 9, [500] = 10} function win(ammo, killer, weapon, bodypart) if (killer and killer ~= source) then local H = getElementData(killer, "EXP") local S = getElementData(killer, "Level") local killer1 = getPlayerName(killer) local noob = getPlayerName(source) setElementData(killer, "EXP", tonumber(H)+1) triggerClientEvent ( killer, "playSound" , killer ) if levels[tonumber(H)] then setElementData(killer, "Level", "Lvl ".. levels[tonumber(H)] .." !") triggerClientEvent ( killer, "playSound" , killer ) end outputChatBox(killer1 .. "Killed " .. noob .. " and gained +1 EXP", getRootElement(), 255, 255, 0, false) end end addEventHandler( "onPlayerWasted", getRootElement(), win) function onLogin (_,account) setElementData(source, "Level", getAccountData(account, "lvl") or "Level 0 !") setElementData(source, "EXP", getAccountData(account, "exp") or "0") end addEventHandler ("onPlayerLogin", root, onLogin) function saveData(thePlayer, theAccount) if (theAccount and not isGuestAccount(theAccount)) then setAccountData (theAccount, "lvl", getElementData(thePlayer, "Level")) setAccountData (theAccount, "exp", getElementData(thePlayer, "EXP")) end end addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function (prev) saveData(source, prev) end)
  23. You're welcome. P.S: Just one? ;P
  24. Castillo

    Help pls!

    Well, it has to work, maybe you put it vice-versa? like this: alreadyS = 0 addEventHandler("onPlayerJoin",root, function () bindKey(source,"x","down",setStat) end) addEventHandler("onResourceStart",resourceRoot, function () for index, player in ipairs(getElementsByType("player")) do bindKey(player,"x","down",setStat) end end) function setStat(player) local currentWeaponID = getPedWeapon(player) if (currentWeaponID == 34) then if (alreadyS == 0) then setPedStat ( player, 79, 999 ) alreadyS = 1 outputChatBox("Works", player, 255, 69, 0) else setPedStat ( player, 79, 300 ) alreadyS = 0 outputChatBox("works!!.", player, 255, 69, 0) end end end
  25. Me lo imaginaba, ya que ambos scripts son lo mismo.
×
×
  • Create New...