Jump to content

Flipi

Members
  • Posts

    321
  • Joined

  • Last visited

Everything posted by Flipi

  1. Flipi

    Ayuda resource

    No se preocupen ya está solucionado ! (gracias a todos)
  2. Flipi

    Ayuda resource

    mira hice esto y funciona, pero lo que quiero ahora es como poner que la cantidad de nitro (el porcentaje) cambie de color cuando va disminuyendo al igual que la vida del vehiculo. intenté hacer lo mismo que con lo del "-- Kph Colors --, -- Mph Colors --, -- Health Colors --" y agregar "local nColor" a la parte del dxDrawText del nitro. local rx, ry = guiGetScreenSize ( ) function vehiclestatus ( ) if ( isPedInVehicle ( localPlayer ) == false ) then return false end local x, y, z = getElementPosition( localPlayer ) local car = getPedOccupiedVehicle ( localPlayer ) local sx, sy, sz = getElementVelocity ( car ) local kphSpeed = math.ceil( ( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) local mphSpeed = math.ceil( ( ( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) / 1.61 ) local health = getElementHealth ( car ) local name = getVehicleName ( car ) local currenthealth = math.floor( health/10 ) local fNitroLevel = getVehicleNitroLevel ( car ) if ( type ( fNitroLevel ) == "number" ) then fNitroLevel = math.floor ( ( fNitroLevel * 100 ) ) end local hColor = "#40FF00" local kColor = "#40FF00" local mColor = "#40FF00" -- Kph Colors -- if ( kphSpeed < 20 ) then kColor = "#D8F6CE" elseif ( kphSpeed < 40 ) then kColor = "#BCF5A9" elseif ( kphSpeed < 60 ) then kColor = "#9FF781" elseif ( kphSpeed < 70 ) then kColor = "#82FA58" elseif ( kphSpeed < 80 ) then kColor = "#64FE2E" elseif ( kphSpeed < 90 ) then kColor = "#40FF00" end -- Mph Colors -- if ( mphSpeed < 20 ) then mColor = "#D8F6CE" elseif ( mphSpeed < 40 ) then mColor = "#BCF5A9" elseif ( mphSpeed < 60 ) then mColor = "#9FF781" elseif ( mphSpeed < 70 ) then mColor = "#82FA58" elseif ( mphSpeed < 80 ) then mColor = "#64FE2E" elseif ( mphSpeed < 90 ) then mColor = "#40FF00" end -- Health Colors -- if ( currenthealth < 20 ) then hColor = "#ff0000" elseif ( currenthealth < 40 ) then hColor = "#FF6400" elseif ( currenthealth < 60 ) then hColor = "#C86400" elseif ( currenthealth < 70 ) then hColor = "#C89600" elseif ( currenthealth < 80 ) then hColor = "#329600" elseif ( currenthealth < 90 ) then hColor = "#40FF00" end dxDrawRectangle( ( rx-205 ), ( ry-78 ), 199, 17, tocolor(0, 0, 0, 180), true) dxDrawRectangle( ( rx-205 ), ( ry-54 ), 199, 17, tocolor(0, 0, 0, 180), true) dxDrawRectangle( ( rx-205 ), ( ry-30 ), 199, 17, tocolor(0, 0, 0, 180), true) dxDrawText ( "#0080FFVelocidad: #FFFFFF"..kColor..""..tostring(kphSpeed).." #FF8000Kmh #0080FF/ "..mColor..""..tostring(mphSpeed).." #FF8000Mph", ( rx - 199 ), ( ry - 77 ), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1,"default-bold", "left", "top", false, false, true, true, false ) dxDrawText ( "#0080FFVehiculo: #FFFFFF".. hColor ..""..tostring(currenthealth).."#0080FF% #FF8000| #0080FF"..tostring(name).."", ( rx - 199 ), ( ry - 53 ), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1,"default-bold", "left", "top", false, false, true, true, false ) dxDrawText ( "#0080FFNitro: #40FF00".. ( type ( fNitroLevel ) == "number" and fNitroLevel .."#0080FF%" or "#FF8000Sin nitro" ), (rx - 199 ), ( ry - 29), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1, "default-bold", "left", "top", false, false, true, true, false ) end addEventHandler ( "onClientRender", root, vehiclestatus )
  3. Flipi

    Help

    he got a local on that already so.. dxDrawText ( "#0080FFNitro: [size=6][b]..hColor..[/b][/size]".. ( type ( fNitroLevel ) == "number" and fNitroLevel .."#0080FF%" or "No nitro" ), (rx - 199 ), ( ry - 29), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1, "default-bold", "left", "top", false, false, true, true, false ) Yeah, but that'll use the same color as the health bar, it won't matter if the nitro goes down, it'll use the health value to set the color. I tried the same thing, but the problem is that the vehicle stats only appears when activating the nitro
  4. Flipi

    Help

    he got a local on that already so.. dxDrawText ( "#0080FFNitro: [size=6][b]..hColor..[/b][/size]".. ( type ( fNitroLevel ) == "number" and fNitroLevel .."#0080FF%" or "No nitro" ), (rx - 199 ), ( ry - 29), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1, "default-bold", "left", "top", false, false, true, true, false ) I tried, but the problem is that the vehicle stats appears when you activate the nitro and disappears the vehicle stats when disable the nitro.
  5. Flipi

    Help

    thanks!, and how I can do that when you reduce the nitro percentage change color equal to health car?
  6. Flipi

    Help

    see the images..
  7. Flipi

    Help

    hi, how do i fix this problem? (nitro) how to change the word false? and how do I remove the decimals? (nitro) screen: http://imageshack.us/a/img837/4341/szid.png screen2: http://imageshack.us/a/img14/4149/8xog.png local rx, ry = guiGetScreenSize ( ) function vehiclestatus ( ) if ( isPedInVehicle ( localPlayer ) == false ) then return false end local x, y, z = getElementPosition( localPlayer ) local car = getPedOccupiedVehicle ( localPlayer ) local sx, sy, sz = getElementVelocity ( car ) local kphSpeed = math.ceil( ( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) local mphSpeed = math.ceil( ( ( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) / 1.61 ) local health = getElementHealth ( car ) local name = getVehicleName ( car ) local currenthealth = math.floor( health/10 ) local fNitroLevel = getVehicleNitroLevel( car ) local hColor = "#00ff00" -- Health Colors -- if ( currenthealth < 20 ) then hColor = "#ff0000" elseif ( currenthealth < 40 ) then hColor = "#FF6400" elseif ( currenthealth < 60 ) then hColor = "#C86400" elseif ( currenthealth < 70 ) then hColor = "#C89600" elseif ( currenthealth < 80 ) then hColor = "#329600" elseif ( currenthealth < 90 ) then hColor = "#00ff00" end dxDrawRectangle( ( rx-205 ), ( ry-78 ), 199, 17, tocolor(0, 0, 0, 180), true) dxDrawRectangle( ( rx-205 ), ( ry-54 ), 199, 17, tocolor(0, 0, 0, 180), true) dxDrawRectangle( ( rx-205 ), ( ry-30 ), 199, 17, tocolor(0, 0, 0, 180), true) dxDrawText ( "#0080FFVelocidad: #FFFFFF"..tostring(kphSpeed).." #FF8000Kmh #0080FF/ #FFFFFF"..tostring(mphSpeed).." #FF8000Mph", ( rx - 199 ), ( ry - 77 ), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1,"default-bold", "left", "top", false, false, true, true, false ) dxDrawText ( "#0080FFVehiculo: #FFFFFF".. hColor ..""..tostring(currenthealth).."#0080FF% #FF8000| #0080FF"..tostring(name).."", ( rx - 199 ), ( ry - 53 ), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1,"default-bold", "left", "top", false, false, true, true, false ) dxDrawText ( "#0080FFNitro: #FF8000"..tostring(fNitroLevel).."#0080FF%", (rx - 199 ), ( ry - 29), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1, "default-bold", "left", "top", false, false, true, true, false ) end addEventHandler ( "onClientRender", root, vehiclestatus )
  8. Flipi

    Ayuda resource

    Aca lo agrege, pero el problema es que cuando activo el nitro, el porcentaje de agotamiento da muchos decimales, y como puedo poner que en vez de false diga "no nitro" IMG: http://imageshack.us/a/img837/4341/szid.png IMG2: http://imageshack.us/a/img14/4149/8xog.png local rx, ry = guiGetScreenSize ( ) function vehiclestatus ( ) if ( isPedInVehicle ( localPlayer ) == false ) then return false end local x, y, z = getElementPosition( localPlayer ) local car = getPedOccupiedVehicle ( localPlayer ) local sx, sy, sz = getElementVelocity ( car ) local kphSpeed = math.ceil( ( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) local mphSpeed = math.ceil( ( ( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) / 1.61 ) local health = getElementHealth ( car ) local name = getVehicleName ( car ) local currenthealth = math.floor( health/10 ) local fNitroLevel = getVehicleNitroLevel( car ) local hColor = "#00ff00" -- Health Colors -- if ( currenthealth < 20 ) then hColor = "#ff0000" elseif ( currenthealth < 40 ) then hColor = "#FF6400" elseif ( currenthealth < 60 ) then hColor = "#C86400" elseif ( currenthealth < 70 ) then hColor = "#C89600" elseif ( currenthealth < 80 ) then hColor = "#329600" elseif ( currenthealth < 90 ) then hColor = "#00ff00" end dxDrawRectangle( ( rx-205 ), ( ry-78 ), 199, 17, tocolor(0, 0, 0, 180), true) dxDrawRectangle( ( rx-205 ), ( ry-54 ), 199, 17, tocolor(0, 0, 0, 180), true) dxDrawRectangle( ( rx-205 ), ( ry-30 ), 199, 17, tocolor(0, 0, 0, 180), true) dxDrawText ( "#0080FFVelocidad: #FFFFFF"..tostring(kphSpeed).." #FF8000Kmh #0080FF/ #FFFFFF"..tostring(mphSpeed).." #FF8000Mph", ( rx - 199 ), ( ry - 77 ), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1,"default-bold", "left", "top", false, false, true, true, false ) dxDrawText ( "#0080FFVehiculo: #FFFFFF".. hColor ..""..tostring(currenthealth).."#0080FF% #FF8000| #0080FF"..tostring(name).."", ( rx - 199 ), ( ry - 53 ), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1,"default-bold", "left", "top", false, false, true, true, false ) dxDrawText ( "#0080FFNitro: #FF8000"..tostring(fNitroLevel).."#0080FF%", (rx - 199 ), ( ry - 29), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1, "default-bold", "left", "top", false, false, true, true, false ) end addEventHandler ( "onClientRender", root, vehiclestatus )
  9. Flipi

    Ayuda resource

    me podrias ayudar, porque nose como hacerlo (basicamente es un texto diciendo la cantidad de nitro que le queda al vehiculo)
  10. Flipi

    Ayuda resource

    Hola, quiero editar este resource para que en la parte del nitro me de la cantidad de nitro que tiene el vehiculo, pero nose como hacerlo local rx, ry = guiGetScreenSize ( ) function vehiclestatus ( ) if ( isPedInVehicle ( localPlayer ) == false ) then return false end local x, y, z = getElementPosition( localPlayer ) local car = getPedOccupiedVehicle ( localPlayer ) local sx, sy, sz = getElementVelocity ( car ) local kphSpeed = math.ceil( ( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) local mphSpeed = math.ceil( ( ( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) / 1.61 ) local health = getElementHealth ( car ) local name = getVehicleName ( car ) local currenthealth = math.floor( health/10 ) local nos = 0; local hColor = "#00ff00" -- Health Colors -- if ( currenthealth < 20 ) then hColor = "#ff0000" elseif ( currenthealth < 40 ) then hColor = "#FF6400" elseif ( currenthealth < 60 ) then hColor = "#C86400" elseif ( currenthealth < 70 ) then hColor = "#C89600" elseif ( currenthealth < 80 ) then hColor = "#329600" elseif ( currenthealth < 90 ) then hColor = "#00ff00" end -- Nitro Colors -- if ( nos < 20 ) then hColor = "#ff0000" elseif ( nos < 40 ) then hColor = "#FF6400" elseif ( nos < 60 ) then hColor = "#C86400" elseif ( nos < 70 ) then hColor = "#C89600" elseif ( nos < 80 ) then hColor = "#329600" elseif ( nos < 90 ) then hColor = "#00ff00" end dxDrawRectangle( ( rx-205 ), ( ry-78 ), 199, 17, tocolor(0, 0, 0, 180), true) dxDrawRectangle( ( rx-205 ), ( ry-54 ), 199, 17, tocolor(0, 0, 0, 180), true) dxDrawRectangle( ( rx-205 ), ( ry-30 ), 199, 17, tocolor(0, 0, 0, 180), true) dxDrawText ( "#0080FFVelocidad: #FFFFFF"..tostring(kphSpeed).." #FF8000Kmh #0080FF/ #FFFFFF"..tostring(mphSpeed).." #FF8000Mph", ( rx - 199 ), ( ry - 77 ), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1,"default-bold", "left", "top", false, false, true, true, false ) dxDrawText ( "#0080FFVehiculo: #FFFFFF".. hColor ..""..tostring(currenthealth).."#0080FF% #FF8000| #0080FF"..tostring(name).."", ( rx - 199 ), ( ry - 53 ), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1,"default-bold", "left", "top", false, false, true, true, false ) dxDrawText ( "#0080FFNitro: #FFFFFF".. hColor ..""..tostring(nos).." end addEventHandler ( "onClientRender", root, vehiclestatus )
  11. Flipi

    Edit Resource

    pero donde agrego lo que quiero poner: function setCameraOnPlayerJoin() fadeCamera(source, true, 5) setTimer ( fadeCamera, 5000, 1, source, true, 0.5 ) setCameraMatrix(source, 1000.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) end addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin)
  12. Flipi

    Edit Resource

    Hola, me gustaria como editar este script de login y registro, para que al ingresar la camara este en esta posición: function setCameraOnPlayerJoin() fadeCamera(source, true, 5) setTimer ( fadeCamera, 5000, 1, source, true, 0.5 ) setCameraMatrix(source, 1000.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) end addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin) Script: ojo que el client tiene blackloginscreen client wdwLogin_Pannel = {} tabPannel_Main = {} tab_Login = {} tab_Register = {} blackLoginScreen = true blackScreenTime = 5 GuestEnable = true function open_log_reg_pannel() if not(isElement(wdwLogin_Pannel)) then if blackLoginScreen == true then fadeCamera(true,0,0,0,0) end local sWidth,sHeight = guiGetScreenSize() local Width,Height = 473,284 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) wdwLogin_Pannel = guiCreateWindow(X,Y,Width,Height,"Panel de Registro",false) guiWindowSetSizable(wdwLogin_Pannel,false) tabPannel_Main = guiCreateTabPanel(9,23,455,251,false,wdwLogin_Pannel) tab_Login = guiCreateTab("Login",tabPannel_Main) lbl_Login = guiCreateLabel(103,72,42,19,"Login:",false,tab_Login) guiLabelSetVerticalAlign(lbl_Login,"center") guiLabelSetHorizontalAlign(lbl_Login,"right",false) guiSetFont(lbl_Login,"default-bold-small") edit_Login = guiCreateEdit(156,72,169,23,"",false,tab_Login) edit_password = guiCreateEdit(156,106,169,23,"",false,tab_Login) guiEditSetMaxLength ( edit_Login,25) guiEditSetMaxLength ( edit_password,25) guiEditSetMasked ( edit_password, true ) lbl_Password = guiCreateLabel(48,106,96,19,"Password:",false,tab_Login) guiLabelSetVerticalAlign(lbl_Password,"center") guiLabelSetHorizontalAlign(lbl_Password,"right",false) guiSetFont(lbl_Password,"default-bold-small") lbl_top_info = guiCreateLabel(80,6,300,35,"Por favor escriba su nombre de usuario y password.",false,tab_Login) guiLabelSetColor(lbl_top_info,0,128,255) guiLabelSetVerticalAlign(lbl_top_info,"center") guiLabelSetHorizontalAlign(lbl_top_info,"center",false) lbl_about_legth = guiCreateLabel(142,42,184,18,"Max. de largo: 25 simbolos",false,tab_Login) guiLabelSetColor(lbl_about_legth,0,128,255) guiLabelSetVerticalAlign(lbl_about_legth,"center") guiLabelSetHorizontalAlign(lbl_about_legth,"center",false) checkbox_save = guiCreateCheckBox(329,110,100,20,"[Guardar]",false,false,tab_Login) guiSetFont(checkbox_save,"default-small") btn_Login = guiCreateButton(164,162,147,41,"Login",false,tab_Login) guiSetFont(btn_Login,"default-bold-small") login_tab_error_msg = guiCreateLabel(31,131,419,25,"Error_login_tab",false,tab_Login) guiLabelSetColor(login_tab_error_msg,255,0,0) guiLabelSetVerticalAlign(login_tab_error_msg,"center") guiLabelSetHorizontalAlign(login_tab_error_msg,"center",false) guiSetFont(login_tab_error_msg,"default-bold-small") if GuestEnable == true then btnGuest = guiCreateButton(29,168,94,32,"Jugar como Invitado",false,tab_Login) guiSetFont(btnGuest,"default-small") guiSetVisible(btnGuest,true) else if isElement(btnGuest) then guiSetVisible(btnGuest,false) end btnGuest = nil end tab_Register = guiCreateTab("Register",tabPannel_Main) lbl_account_name = guiCreateLabel(43,39,119,21,"Usuario:",false,tab_Register) guiLabelSetVerticalAlign(lbl_account_name,"center") guiLabelSetHorizontalAlign(lbl_account_name,"right",false) guiSetFont(lbl_account_name,"default-bold-small") lbl_reg_top_info = guiCreateLabel(66,5,364,31,"Por favor, rellene todos los campos! [No utilice \"!@#$\"%'^&*()\"]",false,tab_Register) guiLabelSetColor(lbl_reg_top_info,0,128,255) guiLabelSetVerticalAlign(lbl_reg_top_info,"center") guiLabelSetHorizontalAlign(lbl_reg_top_info,"center",false) edit_account_name = guiCreateEdit(172,40,176,23,"",false,tab_Register) guiEditSetMaxLength ( edit_account_name,25) lbl__reg_tab_password = guiCreateLabel(43,71,119,21,"Password:",false,tab_Register) guiLabelSetVerticalAlign(lbl__reg_tab_password,"center") guiLabelSetHorizontalAlign(lbl__reg_tab_password,"right",false) guiSetFont(lbl__reg_tab_password,"default-bold-small") edit__reg_tab_password = guiCreateEdit(172,71,176,23,"",false,tab_Register) guiEditSetMaxLength ( edit__reg_tab_password,25) edit__reg_tab_Repassword = guiCreateEdit(172,102,176,23,"",false,tab_Register) guiEditSetMaxLength ( edit__reg_tab_Repassword,25) lvl_reg_tab_Repassword = guiCreateLabel(43,102,119,21,"Repite la password:",false,tab_Register) guiLabelSetVerticalAlign(lvl_reg_tab_Repassword,"center") guiLabelSetHorizontalAlign(lvl_reg_tab_Repassword,"right",false) guiSetFont(lvl_reg_tab_Repassword,"default-bold-small") btn_reg_tab_register = guiCreateButton(153,161,174,42,"Confirma y registra!",false,tab_Register) guiSetFont(btn_reg_tab_register,"default-bold-small") reg_tab_error_msg = guiCreateLabel(66,129,364,31,"Error_reg_ttab",false,tab_Register) guiLabelSetColor(reg_tab_error_msg,255,20,0) guiLabelSetVerticalAlign(reg_tab_error_msg,"center") guiLabelSetHorizontalAlign(reg_tab_error_msg,"center",false) guiSetFont(reg_tab_error_msg,"default-bold-small") guiSetVisible(wdwLogin_Pannel,true) showCursor(true) guiSetText(reg_tab_error_msg, "") guiSetText(login_tab_error_msg, "") local username, password = loadLoginFromXML() if not( username == "" or password == "") then guiCheckBoxSetSelected ( checkbox_save, true ) guiSetText ( edit_Login, tostring(username)) guiSetText ( edit_password, tostring(password)) else guiCheckBoxSetSelected ( checkbox_save, false ) guiSetText ( edit_Login, tostring(username)) guiSetText ( edit_password, tostring(password)) end addEventHandler("onClientGUIClick",btn_Login,onClickBtnLogin) addEventHandler("onClientGUIClick",btn_reg_tab_register,onClickBtnRegister) if GuestEnable == true then addEventHandler("onClientGUIClick",btnGuest,onClickGuest) end end end function start_cl_resource() open_log_reg_pannel() end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),start_cl_resource) function loadLoginFromXML() local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if usernameNode and passwordNode then return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode) else return "", "" end xmlUnloadFile ( xml_save_log_File ) end function saveLoginToXML(username, password) local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end xmlNodeSetValue (usernameNode, tostring(username)) end if (password ~= "") then local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue (passwordNode, tostring(password)) end xmlSaveFile(xml_save_log_File) xmlUnloadFile (xml_save_log_File) end addEvent("saveLoginToXML", true) addEventHandler("saveLoginToXML", getRootElement(), saveLoginToXML) function resetSaveXML() local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end end if (password ~= "") then local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue (passwordNode, "") end xmlSaveFile(xml_save_log_File) xmlUnloadFile (xml_save_log_File) end addEvent("resetSaveXML", true) addEventHandler("resetSaveXML", getRootElement(), resetSaveXML) function onClickBtnLogin(button,state) if(button == "left" and state == "up") then if (source == btn_Login) then username = guiGetText(edit_Login) password = guiGetText(edit_password) if guiCheckBoxGetSelected ( checkbox_save ) == true then checksave = true else checksave = false end triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,checksave) end end end function onClickBtnRegister(button,state) if(button == "left" and state == "up") then
  13. Flipi

    Ayuda script!

    nop, no aparece el mensaje ;/
  14. Flipi

    Ayuda script!

    Lo puse y no pasa nada, no envia ningun error, solo funciona el drift pero no da dinero.
  15. Flipi

    Ayuda script!

    si, pero estaba algo malo en el script, aparte creo que no se entendio.
  16. Flipi

    Ayuda script!

    Hola, tengo una duda, quisiera saber como hacer para que la cantidad de Drift que haga un jugador sea tambien el dinero que gane por los drift, ejemplo: pablo hizo "528" de Drift, entonces gana "528" de dinero... client: local BannedIDs = { 432, 532 } local rootElem = getRootElement() local thisRoot = getResourceRootElement(getThisResource()) local player = getLocalPlayer() local vehicle local size = 1.2 local modo = 0.01 local score = 0 local screenScore = 0 local tick local idleTime local multTime local driftTime local Yellow = tocolor(255,128,0) local Red = tocolor(234,0,3) local TempCol = Yellow local mult = 1 local tablamult = {350,1400,4200,11200} local anterior = 0 local mejor = 0 local total = 0 local Shadow = tocolor(0,0,0,255) local global_mejor = 0 local global_nombre = "N/A" local screenWidth, screenHeight = guiGetScreenSize() local x1,y1,x2,y2 = screenWidth*0.2,screenHeight*0.1,screenWidth*0.8,screenHeight*0.8 addEventHandler("onClientResourceStart", thisRoot, function() addEventHandler("onClientRender", rootElem, showText) outputChatBox("* #0080FFEsperando datos de drift del server...", 255, 255, 255, true) triggerServerEvent("driftClienteListo", rootElem, player) end ) addEventHandler("onClientResourceStop", thisRoot, function() removeEventHandler("onClientRender", rootElem, showText) end ) function isValidVehicle() local temp = getPedOccupiedVehicle(player) if not temp or getVehicleOccupant(temp,0) ~= player or getVehicleType(temp) ~= "Automobile" then return false end local vehID = getElementModel(temp) for k,v in ipairs(BannedIDs) do if vehID == v then return false end end return temp end function showText() dxDrawText(string.format("Mejor Drift: %s - %d",global_nombre,global_mejor),22,567,screenWidth,screenHeight,Shadow,1,"pricedown") dxDrawText(string.format("Mejor Drift: %s - %d",global_nombre,global_mejor),20,565,screenWidth,screenHeight,Yellow,1,"pricedown") vehicle = isValidVehicle() if not vehicle then return end if size > 1.3 then modo = -0.01 elseif size < 1.2 then modo = 0.01 end size = size + modo tick = getTickCount() local angulo,velocidad = angle() local tempBool = tick - (idleTime or 0) < 750 if not tempBool and score ~= 0 then anterior = score setElementData(player, "Anterior Drift", anterior) total = total+anterior setElementData(player, "Total Drift", total) if score > mejor then mejor = score setElementData(player, "Mejor Drift", mejor) checkPuntaje(mejor) end triggerEvent("onVehicleDriftEnd", rootElem, tick-driftTime-750) score = 0 end if angulo ~= 0 then if score == 0 then triggerEvent("onVehicleDriftStart", rootElem) driftTime = tick end if tempBool then score = score + math.floor(angulo*velocidad)*mult else score = math.floor(angulo*velocidad)*mult end if TempCol == Red then TempCol = Yellow end screenScore = score idleTime = tick end local temp2 = string.format("Factor: X%d\n%s",mult,mult~=5 and string.format("Ganar X%d con %d",mult+1,tablamult[mult]) or "MAX") dxDrawText(temp2, 21.09,166.09,screenWidth,screenHeight, Shadow, 1.2, "default-bold","left") dxDrawText(temp2, 20,165,screenWidth,screenHeight, Yellow, 1.2, "default-bold","left","top", false,true,false) if velocidad <= 0.3 and mult ~= 1 then dxDrawText("\n\nMuy Lento!", 21.09,166.09,screenWidth,screenHeight, Shadow, 1.2, "default-bold","left") dxDrawText("\n\nMuy Lento!", 20,165,screenWidth,screenHeight, Yellow, 1.2, "default-bold","left","top", false,true,false) end if tick - (idleTime or 0) < 3000 then local temp = "DRIFT" if score >= 100000 then temp = "DRIFT\n\nDrift King!" elseif score >= 50000 then temp = "DRIFT\n\nInsane Drift!" elseif score >= 20000 then temp = "DRIFT\n\nOutrageous!" elseif score >= 15000 then temp = "DRIFT\n\nColossal!" elseif score >= 7000 then temp = "DRIFT\n\nSuberb!" elseif score >= 3000 then temp = "DRIFT\n\nGreat Drift!" elseif score >= 1000 then temp = "DRIFT\n\nGood Drift!" end dxDrawText(temp, x1+2,y1+2,x2,y2, Shadow, 2.2, "sans","center") dxDrawText(temp, x1,y1,x2,y2, TempCol, 2.2, "sans","center","top", false,true,false) dxDrawText(string.format("\n%d",screenScore), x1+4,y1-8,x2,y2, Shadow, size, "pricedown","center") dxDrawText(string.format("\n%d",screenScore), x1,y1-10,x2,y2, TempCol, size, "pricedown","center","top", false,true,false) end end function angle() local vx,vy,vz = getElementVelocity(vehicle) local modV = math.sqrt(vx*vx + vy*vy) if not isVehicleOnGround(vehicle) then return 0,modV end local rx,ry,rz = getElementRotation(vehicle) local sn,cs = -math.sin(math.rad(rz)), math.cos(math.rad(rz)) local deltaT = tick - (multTime or 0) if mult~= 1 and modV <= 0.3 and deltaT > 750 then mult = mult-1 multTime = tick elseif deltaT > 1500 then local temp = 1 if score >= 11200 then temp = 5 elseif score >= 4200 then temp = 4 elseif score >= 1400 then temp = 3 elseif score >= 350 then temp = 2 end if temp>mult then mult = temp multTime = tick end end if modV <= 0.2 then return 0,modV end --speed over 40 km/h local cosX = (sn*vx + cs*vy)/modV if cosX > 0.966 or cosX < 0 then return 0,modV end --angle between 15 and 90 degrees return math.deg(math.acos(cosX))*0.5, modV end addEvent("driftCarCrashed", true) addEventHandler("driftCarCrashed", rootElem, function() if score ~= 0 then score = 0 mult = 1 TempCol = Red triggerEvent("onVehicleDriftEnd", rootElem, 0) end end ) addEvent("driftActualizarRecord", true) addEventHandler("driftActualizarRecord", rootElem, function(score, name) global_mejor = score global_nombre = name end ) function resetScore() anterior,mejor,total = 0,0,0 setElementData(player, "Anterior Drift", anterior) setElementData(player, "Total Drift", total) setElementData(player, "Mejor Drift", mejor) end addEvent("driftResetAllScores", true) addEventHandler("driftResetAllScores", rootElem, resetScore) addCommandHandler("resetdrift", resetScore) function checkPuntaje(BestDrift) triggerServerEvent("driftNuevoRecord", rootElem, BestDrift, string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "")) end server: local root = getRootElement() local thisResourceRoot = getResourceRootElement(getThisResource()) local drift_records = {} local drift_mejor = 0 local drift_nombre = "N/A" addEventHandler ( "onResourceStart", thisResourceRoot, function() call(getResourceFromName("scoreboardd"), "addScoreboardColumn", "Mejor Drift", 11, 11, 0.11) call(getResourceFromName("scoreboardd"), "addScoreboardColumn", "Anterior Drift", 12, 12, 0.11) call(getResourceFromName("scoreboardd"), "addScoreboardColumn", "Total Drift", 13, 13, 0.11) executeSQLCreateTable("recordsDrift","pista TEXT, nombre TEXT, score INTEGER") addEvent("driftClienteListo", true) addEventHandler("driftClienteListo", root, function(player) triggerClientEvent(player, "driftActualizarRecord", root, drift_mejor, drift_nombre) if drift_mejor == 0 then outputChatBox("* #0080FFNo hay records", player, 255, 255, 255, true) else outputChatBox(string.format("* #0080FFEl nuevo record es de [#FF8000%d#0080FF] puntos [#FF8000%s#0080FF]", drift_mejor, drift_nombre), player, 255, 255, 255, true) end end) end ) addEventHandler ( "onResourceStop", thisResourceRoot, function() call(getResourceFromName("scoreboardd"), "removeScoreboardColumn", "Mejor Drift", 11, 11, 0.11) call(getResourceFromName("scoreboardd"), "removeScoreboardColumn", "Anterior Drift", 12, 12, 0.11) call(getResourceFromName("scoreboardd"), "removeScoreboardColumn", "Total Drift", 13, 13, 0.11) end ) addEventHandler ( "onGamemodeMapStart", root, function(mapResource) local mapname = getResourceInfo(mapResource, "name") or getResourceName(mapResource) local command = string.format("pista='%s'",mapname) local record = executeSQLSelect("recordsDrift","nombre, score",command) if #record == 0 then executeSQLInsert("recordsDrift",string.format("'%s', 'N/A', 0",mapname)) drift_mejor = 0 drift_nombre = "N/A" else drift_mejor = record[1]["score"] drift_nombre = record[1]["nombre"] end triggerClientEvent(root, "driftActualizarRecord", root, drift_mejor, drift_nombre) triggerClientEvent(root, "driftResetAllScores", root) if drift_mejor == 0 then outputChatBox("* #0080FFNo hay records", 255, 255, 255, true) else outputChatBox(string.format("* #0080FFEl nuevo record es de #FF8000%d #0080FFpuntos #FF8000(%s)", drift_mejor, drift_nombre), player, 255, 255, 255, true) end end) addEventHandler ( "onGamemodeMapStop", root, function(mapResource) local mapname = getResourceInfo(mapResource, "name") or getResourceName(mapResource) if not mapname then return end local command = string.format("pista='%s'",mapname) executeSQLUpdate("recordsDrift",string.format("nombre = '%s', score = %d", drift_nombre, drift_mejor), command) end) addEventHandler("onVehicleDamage", root, function() thePlayer = getVehicleOccupant(source, 0) if thePlayer then triggerClientEvent(thePlayer, "driftCarCrashed", root, source) end end) addEvent("driftNuevoRecord", true) addEventHandler("driftNuevoRecord", root, function(score, name) if score > drift_mejor then outputChatBox(string.format("* #0080FFNuevo record! #0080FF[#FF8000%d puntos#0080FF] #0080FF[#FF8000%s#0080FF]",score,name), player, 255, 255, 255, true) drift_mejor = score drift_nombre = name triggerClientEvent(root, "driftActualizarRecord", root, drift_mejor, drift_nombre) end end) Me dijeron que se podría usar esto: (pero nose donde agregarlo) function opcion1() local cantidad = getElementData(localPlayer, "score") givePlayerMoney( tonumber(cantidad)) end -- o tambien function opcion2() local cantidad = getElementData(localPlayer, "Mejor Drift") givePlayerMoney( tonumber(cantidad)) end
  17. Flipi

    Ayuda Script

    gracias si funciona, pero el outputServerLog( "CHAT: * ".. getPlayerName ( source )..": #0080FF" .. message, 255, 255, 255, true) esta demas
  18. Flipi

    Ayuda Script

    si, ya me di cuenta, gracias , una pregunta: como puedo hacer que los codigos de color de los nombres se desactive?, se que es con string.format
  19. Flipi

    Ayuda Script

    gracias ya lo solucione
  20. Flipi

    Ayuda Script

    Hola, tengo una duda con el comando /me, la cosa es que quiero modificarlo con un color distinto, solo que nose como hacerlo funcionar Server-type: addEventHandler ( "onPlayerChat", getRootElement(), function ( player, message, messageType ) if messageType == 1 then outputServerLog( "CHAT: * ".. getPlayerName ( player )..": #0080FF" .. message, 255, 255, 255, true) end end)
  21. Tienes que ir a freeroam/fr_client.lua, abrir y borrar lo que quieres en este caso estan en las lineas 1424 hasta 1475 wndMain = { 'wnd', text = 'FR GUI', x = 10, y = 150, width = 280, controls = { {'lbl', text='Local player'}, {'br'}, {'btn', id='skin', window=wndSkin}, {'br'}, {'chk', id='jetpack', onclick=toggleJetPack}, {'chk', id='falloff', text='fall off bike', onclick=toggleFallOffBike}, {'br'}, {'lbl', text='Vehicles'}, {'br'}, {'btn', id='createvehicle', window=wndCreateVehicle, text='create'}, {'btn', id='upgrades', window=wndUpgrades}, {'br'}, {'chk', id='lightson', text='Lights on', onclick=forceLightsOn}, {'chk', id='lightsoff', text='Lights off', onclick=forceLightsOff}, {'br'}, {'br'}, }, oncreate = mainWndShow, onclose = mainWndClose } procura desactivar las opciones de /cv, /repair, entre otros en el setting de freeroam en resources en el panel del admin
  22. Creo que yo ya le di lo que necesitaba. ha perdón, es que no vi los comentarios
  23. tienes que definir el source en el outputChatBox: outputChatBox ( "* " [b].. getPlayerName(source) ..[/b] " has got the Hunter!", getRootElement(), 255, 0, 0, true )
  24. Flipi

    Duda.

    No, pero puedes crear un script con características similares como este resource de la comunidad https://community.multitheftauto.com/in ... ls&id=4515
×
×
  • Create New...