Jump to content

Carlossg

Members
  • Posts

    162
  • Joined

  • Last visited

Everything posted by Carlossg

  1. Carlossg

    Why don't work?

    I'm not sure,try whit this: function database:SQLTable() executeSQLCreateTable ( 'Money', 'player_serial STRING, money INT' ) executeSQLCreateTable ( 'Points', 'player_serial STRING, points INT' ) end addEventHandler('onResourceStart', getResourceRootElement(getThisResource()), database:SQLTable ) Then, more you can simplify your script ,better. PD:To a very very sure to we can fix script you need to post complete code.
  2. Wow, actualicé y ya funciona correctamente. Otra cosa; ¿hay alguna función con la que pueda bloquear la descarga de ciertos archivos?. También este script no funciona por el momento no muestra la gui, lo poco que llevo no funciona. function getServerMaps() local mapsTable = {} for resourceKey, resourceValue in ipairs(getResources()) do local name = getResourceInfo ( resourceValue, "name" ) local type = getResourceInfo ( resourceValue, "type" ) local author = getResourceInfo ( resourceValue, "author" ) local game = getResourceInfo ( resourceValue, "gamemodes" ) if (type == "map" and game == "race") then table.insert(mapsTable, {name=name, author=author or "Unknown"}) end end return mapsTable end function buyMap () local mapas = getServerMaps() spawnScreenMenu = guiCreateWindow ( 0.15, 0.33, 0.7, 0.34, "Welcome to map customer", true ) spawnScreenOKButton = guiCreateButton ( 0.4, 0.85, 0.20, 0.15, "OK", true, spawnScreenMenu ) guiWindowSetMovable ( spawnScreenMenu, true ) guiWindowSetSizable ( spawnScreenMenu, false ) spawnScreenGridList = guiCreateGridList ( 0, 0.1, 1, 0.9, true, spawnScreenMenu ) guiGridListSetSelectionMode ( spawnScreenGridList, 2 ) guiGridListAddColumn ( spawnScreenGridList, "Maps", 0.3 ) guiSetVisible(spawnScreenMenu, false) for index, map in ipairs(mapas) do guiGridListSetItemText ( spawnScreenGridList, row, 1, mapsTable, false, false ) end end addEventHandler("onClientResourceStart", resourceRoot,buyMap) -- function bindTheKeys () for k, v in ipairs(getElementsByType("player")) do bindKey(v, "F1", "down", triggerGUI) end end addEventHandler("onClientResourceStart", resourceRoot, bindTheKeys) function bindKeyToConnectingPlayer(player) if player then bindKey(player, "F1", "down", triggerGUI) end end addEventHandler("onClientPlayerJoin", getRootElement(), bindKeyToConnectingPlayer) function triggerGUI(key,keyState) if key == "F1" and keyState == "down" then guiSetVisible(spawnScreenMenu, true) end end PD:El script es client-side y creo que es ahí dónde está el error.
  3. otra cosa,puede ser que esté utiliazando mal el: GetPlayerIdleTime ya que obtengo in kick automático al entrar a mi servidor
  4. miren,cogí este ejemplo de la wiki, que está mal en la wiki me explico: function pingkick() local ping = getPlayerPing(thePlayer) if (tonumber(ping) > 400) then outputChatBox("Your ping is pretty high! Please fix it.", thePlayer) end end addEventHandler("onPlayerJoin", getRootElement(), pingkick) setTimer(pingkick, 60000, 0) primero lo modifiqué ya que le faltaba tonumber en el if de la linea 3 y ahora tira un fallo: WARNING: antilag\ping.lua:2: Bad argument @ 'getPlayerPing' el cuál provoca: ERROR: antilag\ping.lua:3: attempt to compare number with nil Me gustaría solucionar este error, por favor ya que estoy haciendo un antilag y eso es solo una parte del código .
  5. Carlossg

    Server 1.2

    I see other bug Can be scoreboard bugged? I don't see colur I see: MYna#ffffffme and I set Color ON
  6. Carlossg

    Server 1.2

    Ok, First hello. The last day I install MTA 1.2 ( Server only ) in my pc, right I configure to my commands and then I start. At the moment people can connect to server if I tell IP, but server doesn't appear on list,someone tell me it. On server start I see: Querying game-monitor.com master server... unavailable! Querying backup master server... success! This error to me is only on 1.2. P.D:If you want to test if appear server's name is:KHD best MTA server (test 1.2)
  7. Ok pero siguen sin ir los colorcodes por cierto y he solucinado lo del flip aunque no tengas dinero lo ha probado una persona ahora solo me falta por que no da 1000$ al coger el hunter y por que no guarda el dinero que ganas en la DB. Edit: ¿Así valdría?: addCommandHandler("flip", function(thePlayer, flip, ammount) if tonumber(ammount) > tonumber(getElementData(thePlayer,"data.money")) then outputChatBox("You don't have that kind of money",thePlayer,255,0,0) elseif tonumber(ammount) > 1000 then outputChatBox("You can't flip more than 1000$",thePlayer,255,0,0) end local money = tonumber(getElementData(thePlayer,"data.money")) if tonumber(ammount) <= tonumber(money) and tonumber(ammount) <= 1000 then if math.random (2) == 1 then setElementData(thePlayer, "data.money", money+tonumber(ammount)) outputChatBox("Flip: "..getPlayerName(thePlayer).. " flip " ..tonumber(ammount).. " and Wins!!",getRootElement(),0,255,0, true ) else setElementData(thePlayer, "data.money", money-tonumber(ammount)) outputChatBox("Flip: "..getPlayerName(thePlayer).." flip " ..tonumber(ammount).. " and Lose!!",getRootElement(),255,0,0, true ) end end end) No entiendo muy bien el uso de getRootElement()
  8. No me hagas mucho caso pero creo que 1 = solo no se puede poner tendrían que ser 2 == y ~= por experiencia de programación en PSP significa un desigual. P.D: ¿Alguno de los servers de tu firma es tuyo?.
  9. ¿Sin las comillas o con ellas?
  10. EDITADO Otra cosa que no entiendo es porque no se activan los colores HEX ni los R G B que he puesto en el mensaje.
  11. Creo que he solucionado lo del bug de la cantidad pero no estoy seguro ya que no puedo probarlo, He aquí el script corregido: addCommandHandler("flip", function(thePlayer, flip, ammount) if tonumber(ammount) > tonumber(getElementData(thePlayer,"data.money")) then outputChatBox("You don't have that kind of money",thePlayer,255,0,0) elseif tonumber(ammount) > 1000 then outputChatBox("You can't flip more than 1000$",thePlayer,255,0,0) end local money = tonumber(getElementData(thePlayer,"data.money")) if tonumber(ammount) <= tonumber(money) and tonumber(ammount) <= 1000 then if math.random (2) == 1 then setElementData(thePlayer, "data.money", money+tonumber(ammount)) outputChatBox("Flip: "..getPlayerName(thePlayer):gsub("#%x%x%x%x%x%x","").. " flip " ..tonumber(ammount).. " and Wins!!",0,255,0, true ) else setElementData(thePlayer, "data.money", money-tonumber(ammount)) outputChatBox("Flip: "..getPlayerName(thePlayer):gsub("#%x%x%x%x%x%x","").." flip " ..tonumber(ammount).. " and Lose!!",255,0,0, true ) end end end) Me gustaría que me digeraís si así por encima tiene algún error. No está corregido lo de que no guarda el dinero ya que no sé como hacerlo .
  12. Castillo, desde que he añadido lo del comando flip ya no da el bonus de los 1000$ al coger el hunter, y el script del flip funciona pero tiene unos bugs, que es que no actualiza el money en la base de datos SQL,y el otro es que cuando le dan a flip pueden hacer un flip de 3000$ perfectamente aunque les tira el mensage "You can't flip more than 1000$" y también que aunque no tengan el dinero que sea les da el error pero si ganan se los dan y si no se los pone negativo. Me gustaría que se actualizara y que no tuviese esos bugs tan feos.
  13. Hola, primero tengo otra duda He encontrado en la lista un server llamado SAUR que tiene una idea genial, y es que al principio descargas un pequeño archivo de 800Kb aproximadamente que al descargarse empieza un video o una vista de águila(o pajaro) mostrandote aspectos del servidor para soportar la siguiente descarga de unos 16 o 17 Mb. Bien me gustaría saber como se hace ésto ya que mi server de race tiene una ENORME descarga de mods y la mayoría de players que entran, se salen. También me gustaría saber la solucion al problema que postee hace nada (el tema de arriba).
  14. Carlossg

    Disable

    How I can disable on scoreboard the race stats Control Point and Position
  15. Cool map can you send me link? Nice infernus mod can you send me link too?
  16. jeje ya lo encontré gracias
  17. Pos yo no lo encontré :( :(
  18. Bueno, funciona pero no actualiza el dinero en la scoreboard. El código solo(lo he modificado un poco): addCommandHandler("flip", function(thePlayer, flip, ammount) if tonumber(ammount) > tonumber(getElementData(thePlayer,"data.money")) then outputChatBox("You don't have that kind of money",thePlayer,255,0,0) elseif tonumber(ammount) > 1000 then outputChatBox("You can't flip more than 1000$",thePlayer,255,0,0) end local money = tonumber(getElementData(thePlayer,"data.money")) if math.random (2) == 1 then setElementData(thePlayer, "data.money", money+tonumber(ammount)) outputChatBox("Flip: "..getPlayerName(thePlayer):gsub("#%x%x%x%x%x%x","").. " flip " ..tonumber(ammount).. " and Wins!!",0,255,0, true ) else setElementData(thePlayer, "data.money", money-tonumber(ammount)) outputChatBox("Flip: "..getPlayerName(thePlayer):gsub("#%x%x%x%x%x%x","").." flip " ..tonumber(ammount).. " and Lose!!",255,0,0, true ) end end) No sé por que no se configuran los colores y, tampoco por qué no funciona el TRUE que he puesto para que acepte los color codes, ya que he tenido que poner gsub("#%x%x%x%x%x%x","") Y, aquí el código en el escript entero function creatingTables() exports.scoreboard:addScoreboardColumn("Cash") executeSQLCreateTable("playerData", "serial STRING, Cash INT, DMAttempts INT, DDAttempts INT") outputChatBox("Cash System by KHD started.") for index, player in ipairs(getElementsByType("player")) do addAccountIfNotExists(player) end end addEventHandler("onResourceStart", resourceRoot, creatingTables) function addAccountIfNotExists(player) local serial = getPlayerSerial(player) local CheckPlayer = executeSQLSelect ( "playerData", "*", "serial = '" .. serial .. "'" ) if ( type( CheckPlayer ) == "table" and #CheckPlayer == 0 ) or not CheckPlayer then executeSQLInsert ( "playerData", "'"..serial.."','0','0','0'" ) else local Cash = tonumber(CheckPlayer [1]["Cash"]) setElementData(source,"Cash", Cash) setElementData(source,"data.money",Cash,true) end end addEventHandler("onPlayerJoin",root,function () addAccountIfNotExists(source) end) function DestructionMoney(mapInfo,mapOptions,gameOptions) info = mapInfo.modename if mapInfo.modename == "Destruction derby" then for k,v in ipairs(getElementsByType("player")) do local serial = getPlayerSerial(v) local DDAttempts = executeSQLSelect ( "playerData", "DDAttempts","serial = '" .. serial .. "'") local DDAttempts = tonumber(DDAttempts[1]["DDAttempts"]) + 1 executeSQLUpdate ( "playerData", "DDAttempts = '"..DDAttempts.."'","serial = '" .. serial .. "'") setElementData(v,"data.DDAttempts",DDAttempts,true) end end end addEvent("onMapStarting") addEventHandler("onMapStarting", getRootElement(), DestructionMoney) function DestructionMoney2(thePlayer) local playername = getPlayerName(thePlayer) local serial = getPlayerSerial(thePlayer) local Cash = executeSQLSelect ( "playerData", "Cash","serial = '" .. serial .. "'") outputChatBox("*Wins: "..playername.." took $"..get('MoneyForDD').." for winning the map!",getRootElement(),255,255,0) local Cash = tonumber(Cash[1]["Cash"]) + get('MoneyForDD') setElementData(thePlayer ,"Cash", Cash) setElementData(thePlayer ,"data.money",Cash,true) setElementData(thePlayer ,"data.playername",playername,true) executeSQLUpdate ( "playerData", "Cash = '"..Cash.."'","serial = '" .. serial .. "'") end function hunterBonus(pickupID, pickupType, vehicleModel) if (info == "Destruction derby" and pickupType == "vehiclechange" and vehicleModel == 425) then local serial = getPlayerSerial(source) local Cash = executeSQLSelect ( "playerData", "Cash","serial = '" .. serial .. "'") local Cash = tonumber(Cash[1]["Cash"]) + 1000 outputChatBox("*Hunter: "..getPlayerName(source).." gets a $1000 hunter bonus!",source,25,125,225) setElementData(source ,"Cash", Cash) setElementData(source ,"data.money",Cash,true) executeSQLUpdate ( "playerData", "Cash = '"..Cash.."'","serial = '" .. serial .. "'") end end addEventHandler("onPlayerPickUpRacePickup",getRootElement(),hunterBonus) addCommandHandler("cash", function (thePlayer) local money = tonumber(getElementData(thePlayer,"data.money")) if (money) then outputChatBox("Your money is $".. tostring(money) .."!",thePlayer,0,255,0) end end) addCommandHandler("flip", function(thePlayer, flip, ammount) if tonumber(ammount) > tonumber(getElementData(thePlayer,"data.money")) then outputChatBox("You don't have that kind of money",thePlayer,255,0,0) elseif tonumber(ammount) > 1000 then outputChatBox("You can't flip more than 1000$",thePlayer,255,0,0) end local money = tonumber(getElementData(thePlayer,"data.money")) if math.random (2) == 1 then setElementData(thePlayer, "data.money", money+tonumber(ammount)) outputChatBox("Flip: "..getPlayerName(thePlayer):gsub("#%x%x%x%x%x%x","").. " flip " ..tonumber(ammount).. " and Wins!!",0,255,0, true ) else setElementData(thePlayer, "data.money", money-tonumber(ammount)) outputChatBox("Flip: "..getPlayerName(thePlayer):gsub("#%x%x%x%x%x%x","").." flip " ..tonumber(ammount).. " and Lose!!",255,0,0, true ) end end) Desde que he añadido lo del flip ya no da 1000$ al coger el hunter P.D.:Ya tengo teclado nuevo.
  19. y lo de escribir que no se entiende una mierda es k se me a roto el teclado y no puedo escribir comas ni simbolos asi Edit: ¿Y el código como quedaría con ese dinero simbolico?
  20. Gracias pero no es con dinero real del mta es con dinero símbolico de este script que me ayudaste viewtopic.php?f=91&t=37651 Por lo de los mapas gracias ahora solo tengo que hacer una ventena y que muestre eso y por cierto P.S que es Post Scripting?
  21. Con que comandos podría hacer un explorador de mapas IGUALITO al de el admin panel nada mas que cambiar el set as netx map por Buy map .Solo quiero saber los comandos y si podría sacarlo del codigo del admin panel
×
×
  • Create New...