Bc# Posted December 4, 2012 Posted December 4, 2012 Tengo un problema al ocupar este resource: https://community.multitheftauto.com/index.php?p= ... ls&id=5812 @ElMota en este post: https://forum.multitheftauto.com/viewtop ... ee#p481332 Pudo aclarar su duda pero cuando yo pruebo el script no me funciona. ¿Como lo puedo reparar? function giveMoneyWinDie() local account = getPlayerAccount(source); local playersAlive = getAliveGuys(2); local playersDead = getDeadGuys(); local pAll = playersAlive + playersDead; local checkYourPos = pAll - playersDead; local pos = nil; if tonumber(checkYourPos) == 1 then pos = 1 else pos = checkYourPos + 1; end if tonumber(checkYourPos) == 2 then pos = 2; end if pos == 1 or pos == 21 or pos == 31 then posName = "st"; elseif pos == 2 or pos == 22 or pos == 32 then posName = "nd"; elseif pos == 3 or pos == 23 or pos == 33 then posName = "rd"; else posName = "th"; end if not getElementData(source,"gotMoney") then local money = math.ceil(getPlayerCount()*50 / pos); givePlayerMoney(source,money); outputChatBox("* You were #abcdef[#ff0000"..pos..posName.."#abcdef]#ffffff and #abcdefearned #ffffff"..money.."#00ff00$!",source,255,255,255,true); exports["Evo-notificaciones"]:showBox("info","test"); setElementData(source,"gotMoney",true); if account then setAccountData(account,"money", tostring(getPlayerMoney(source))); end end end addEventHandler("onPlayerWasted",getRootElement(),giveMoneyWinDie)
Castillo Posted December 4, 2012 Posted December 4, 2012 Te falta poner el jugador al que queres mostrarle la notificacion, ya que la funcion tiene estos argumentos ( server side ): showBox(player, value, str)
Bc# Posted December 4, 2012 Author Posted December 4, 2012 Yo se como mostrarlo a un solo jugador, se usa getPlayerName(player) ¿pero como hago para mostrarlo a todos? PD: Probé con esto y no funcionó. exports["Evo-notificaciones"]:showBox("getPlayerName(source)", "info","Terminaste ["..pos..posName.."] y Ganó $"..money.."!");
Castillo Posted December 4, 2012 Posted December 4, 2012 Esta mal, no se usa getPlayerName, se usa el elemento del jugador, en este caso seria 'player', para mostrarselo a todos vas a tener que hacer un for-loop. for _, player_ in ipairs ( getElementsByType ( "player" ) ) do exports["Evo-notificaciones"]:showBox(player_, "info",getPlayerName ( player ) .." termino ["..pos..posName.."] y ganó $"..money.."!") end
Bc# Posted December 4, 2012 Author Posted December 4, 2012 Para mostrarlo a todos funciona perfectamente pero al mostrar a la persona que realiza una accion no funciona al hacer esto: exports["Evo-notificaciones"]:showBox("player", "info","Terminaste ["..pos..posName.."] y Ganó $"..money.."!");
TwiX! Posted December 4, 2012 Posted December 4, 2012 (edited) Thats that you use my panel function giveMoneyWinDie ( ) local account = getPlayerAccount ( source ); local playersAlive = getAliveGuys ( 2 ); local playersDead = getDeadGuys ( ); local pAll = playersAlive + playersDead; local checkYourPos = pAll - playersDead; local pos = nil; if tonumber ( checkYourPos ) == 1 then pos = 1 else pos = checkYourPos + 1; end if tonumber ( checkYourPos ) == 2 then pos = 2; end if pos == 1 or pos == 21 or pos == 31 then posName = "st"; elseif pos == 2 or pos == 22 or pos == 32 then posName = "nd"; elseif pos == 3 or pos == 23 or pos == 33 then posName = "rd"; else posName = "th"; end if not getElementData ( source, "gotMoney" ) then local money = math.ceil ( getPlayerCount ( ) * 50 / pos ); givePlayerMoney ( source, money ); outputChatBox ( "* You were #abcdef[#ff0000" .. pos .. posName .. "#abcdef]#ffffff and #abcdefearned #ffffff" .. money .. "#00ff00$!", source, 255, 255, 255, true ); for _, player_ in ipairs ( getElementsByType ( "player" ) ) do exports["Evo-notificaciones"]:showBox ( player_, "info", getPlayerName ( player_ ) .. " #fffffftermino #abcdef[#ff0000" .. pos .. posName .. "#abcdef] #ffffffy gano #00ff00$" .. money .. "!" ); end setElementData ( source, "gotMoney", true ); if account then setAccountData (account, "money", tostring ( getPlayerMoney ( source ) ) ); end end end addEventHandler ( "onPlayerWasted", root , giveMoneyWinDie ) For color codes: Open Evo-notificaciones Open box_c.lua replace dxDrawText on: dxDrawText (tipBox.string,textX,textY,textX+textWidth,textY+textHeight,tocolor(222,222,222),1,"default-bold","center","center",false,true,true,true) Edited December 5, 2012 by Guest
Castillo Posted December 4, 2012 Posted December 4, 2012 Para mostrarlo a todos funciona perfectamente pero al mostrar a la persona que realiza una accion no funciona al hacer esto: exports["Evo-notificaciones"]:showBox("player", "info","Terminaste ["..pos..posName.."] y Ganó $"..money.."!"); Eso es porque pusiste las comillas, no necesita un string, necesita un elemento, quitale las comillas.
Bc# Posted December 5, 2012 Author Posted December 5, 2012 (edited) Uso: exports["Evo-notificaciones"]:showBox(player, "info","Terminaste ["..pos..posName.."] y Ganó $"..money.."!");; Pero tampoco funciona Edited December 5, 2012 by Guest
Castillo Posted December 5, 2012 Posted December 5, 2012 Talves porque estas usando: "exportaciones" en ves de "exports"?
Bc# Posted December 5, 2012 Author Posted December 5, 2012 Lol no eso fue solo error mio al escribirlo acá en el foro xDD
Recommended Posts