Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. What has that to do with that code?
  2. El recurso tiene funciones exportadas, para usarlas necesitas experiencia en scripting.
  3. Change: if not( accountName == "loginusernamehere" ) then To: if ( oldTeamName ~= "team name here" ) then
  4. Why do you use a public forum if you don't want others to see your code?
  5. dimension = 0 names = { } function worldc ( playerSource, _, name ) dimension = ( dimension + 1 ) setElementDimension ( playerSource, dimension ) names [ name ] = dimension --setElementData(names[name],name,dimensions[dimension]) outputChatBox ( "#00FF00*You has successfully created world named ".. name .."!", playerSource, 0, 0, 0, true ) end function worldj ( player, _, name ) if names [ name ] then setElementDimension ( player, names [ name ] ) outputChatBox ( "#00FF00*You has moved to world ".. name .."!", player, 0, 0, 0, true ) else outputChatBox ( "#00FF00*That world doesn't exist!", player, 0, 0, 0, true ) end end function worlde ( playerx ) setElementDimension ( playerx, 0 ) outputChatBox ( "#00FF00*You has exited the world!", playerx, 0, 0, 0, true ) end addCommandHandler ( "createworld", worldc ) addCommandHandler ( "joinworld", worldj ) addCommandHandler ( "exitworld", worlde )
  6. https://community.multitheftauto.com/in ... ils&id=672 P.D: Podrias crear solo un tema para pedir los recursos, no un tema para cada recurso.
  7. Why do you execute that many queries? you can do it all on just one.
  8. Castillo

    Help

    You're welcome.
  9. Castillo

    Help

    That's because you are overwritting the variable 'nColor'. 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 = "#40FF00" local kColor = "#40FF00" local mColor = "#40FF00" local nColor = "#40FF00" if ( type ( fNitroLevel ) == "number" ) then fNitroLevel = math.floor ( ( fNitroLevel * 100 ) ) -- Nitro Colors -- if ( fNitroLevel < 20 ) then nColor = "#ff0000" elseif ( fNitroLevel < 40 ) then nColor = "#FF6400" elseif ( fNitroLevel < 60 ) then nColor = "#C86400" elseif ( fNitroLevel < 70 ) then nColor = "#C89600" elseif ( fNitroLevel < 80 ) then nColor = "#329600" elseif ( fNitroLevel < 90 ) then nColor = "#40FF00" end else nColor = "#ff0000" end -- 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 ) outputChatBox ( nColor ) dxDrawText ( "#0080FFNitro: #40FF00".. nColor ..""..( 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 ) This one works ( tested ).
  10. function createSelectedVehicle(leaf) if not leaf then leaf = getSelectedGridListLeaf(wndCreateVehicle, 'vehicles') if not leaf then return end end if isTheLineClear ( vehID ) then server.giveMeVehicles(leaf.id) else errMsg('Please find a clear location to spawn the vehicle.') end end wndCreateVehicle = { 'wnd', text = 'Vehicles', width = 300, controls = { { 'lst', id='vehicles', width=280, height=340, columns={ {text='Vehicle', attr='name'} }, rows={xml='vehicles_grafuroam.xml', attrs={'id', 'name'}}, onitemdoubleclick=createSelectedVehicle }, {'btn', id='create', onclick=createSelectedVehicle}, {'btn', id='close', closeswindow=true} } } function createVehicleCommand(cmd, id) vehID = tonumber(id) or getVehicleModelFromName(id) if not vehID then return end if isTheLineClear ( vehID ) then server.giveMeVehicles(math.floor(vehID)) else errMsg('Please find a clear location to spawn the vehicle.') end end addCommandHandler('createvehicle', createVehicleCommand) addCommandHandler('cv', createVehicleCommand) local vehicleWidth = { [400] = 3.03, [401] = 3.30, [402] = 2.90, [403] = 5.30, [404] = 3.21, [405] = 3.37, [406] = 6.60, [407] = 4.89, [408] = 5.90, [409] = 4.36, [410] = 2.89, [411] = 2.69, [412] = 3.97, [413] = 3.34, [414] = 3.99, [415] = 3.04, [416] = 4.42, [417] = 16.01, [418] = 3.32, [419] = 3.45, [420] = 3.30, [421] = 3.53, [422] = 3.11, [423] = 3.60, [424] = 2.44, [425] = 9.84, [426] = 3.29, [427] = 4.48, [428] = 3.73, [429] = 2.91, [430] = 6.59, [431] = 6.66, [432] = 7.17, [433] = 5.51, [434] = 2.69, [435] = 7.33, [436] = 3.11, [437] = 6.40, [438] = 3.37, [439] = 3.04, [440] = 3.29, [441] = 2.00, [442] = 3.71, [443] = 10.38, [444] = 3.85, [445] = 3.30, [446] = 6.73, [447] = 7.58, [448] = 1.33, [449] = 5.29, [450] = 7.17, [451] = 3.06, [452] = 5.92, [453] = 6.02, [454] = 9.70, [455] = 5.35, [456] = 5.18, [457] = 2.10, [458] = 3.44, [459] = 3.27, [460] = 8.94, [461] = 1.44, [462] = 1.33, [463] = 1.40, [464] = 1.25, [465] = 0.94, [466] = 3.45, [467] = 3.53, [468] = 1.39, [469] = 7.58, [470] = 3.24, [471] = 1.49, [472] = 4.58, [473] = 2.61, [474] = 3.37, [475] = 3.26, [476] = 8.19, [477] = 3.36, [478] = 3.23, [479] = 3.39, [480] = 2.83, [481] = 1.17, [482] = 3.33, [483] = 3.44, [484] = 9.92, [485] = 2.37, [486] = 4.67, [487] = 7.71, [488] = 6.53, [489] = 3.38, [490] = 3.93, [491] = 3.00, [492] = 2.84, [493] = 6.79, [494] = 3.57, [495] = 3.22, [496] = 2.65, [497] = 7.71, [498] = 4.19, [499] = 3.99, [500] = 2.90, [501] = 0.94, [502] = 3.35, [503] = 3.40, [504] = 3.39, [505] = 3.38, [506] = 2.94, [507] = 3.60, [508] = 4.62, [509] = 1.21, [510] = 1.13, [511] = 15.03, [512] = 6.58, [513] = 6.51, [514] = 5.55, [515] = 5.68, [516] = 3.49, [517] = 3.51, [518] = 3.33, [519] = 13.87, [520] = 8.61, [521] = 1.44, [522] = 1.44, [523] = 1.44, [524] = 5.08, [525] = 3.94, [526] = 2.98, [527] = 3.14, [528] = 3.28, [529] = 3.15, [530] = 2.63, [531] = 2.31, [532] = 7.38, [533] = 2.53, [534] = 3.40, [535] = 3.15, [536] = 3.54, [537] = 11.06, [538] = 8.26, [539] = 2.61, [540] = 3.44, [541] = 2.79, [542] = 3.53, [543] = 3.24, [544] = 6.73, [545] = 2.80, [546] = 3.30, [547] = 3.28, [548] = 12.72, [549] = 3.14, [550] = 3.34, [551] = 2.86, [552] = 4.02, [553] = 18.92, [554] = 3.57, [555] = 2.84, [556] = 3.85, [557] = 3.85, [558] = 2.94, [559] = 3.05, [560] = 3.05, [561] = 3.28, [562] = 2.98, [563] = 9.65, [564] = 0.93, [565] = 2.72, [566] = 3.58, [567] = 3.71, [568] = 2.75, [569] = 9.41, [570] = 9.41, [571] = 1.61, [572] = 1.75, [573] = 4.15, [574] = 2.43, [575] = 3.26, [576] = 3.48, [577] = 45.08, [578] = 6.35, [579] = 3.31, [580] = 3.35, [581] = 1.46, [582] = 3.98, [583] = 2.52, [584] = 8.24, [585] = 3.56, [586] = 1.56, [587] = 3.24, [588] = 5.52, [589] = 2.98, [590] = 9.67, [591] = 7.38, [592] = 36.34, [593] = 9.36, [594] = 0.58, [595] = 6.34, [596] = 3.30, [597] = 3.31, [598] = 3.25, [599] = 3.57, [600] = 3.35, [601] = 4.56, [602] = 3.14, [603] = 3.38, [604] = 3.45, [605] = 3.24, [606] = 2.46, [607] = 2.43, [608] = 4.01, [609] = 4.17, [610] = 1.59, [611] = 2.11, } function isTheLineClear ( vehID ) local width = vehicleWidth [ vehID ] or 3 local px, py, pz = getElementPosition ( localPlayer ) local px, py, pz, prot local radius = 3 local playerVehicle = getPedOccupiedVehicle(localPlayer) if playerVehicle and isElement(playerVehicle) then prot, prot, prot = getVehicleRotation(playerVehicle) else prot = getPedRotation(localPlayer) end local offsetRot = math.rad(prot) local vx = px + radius * math.cos(offsetRot) local vy = py + radius * math.sin(offsetRot) local vz = pz + 2 local vrot = prot return ( isLineOfSightClear ( px, py, ( pz + 1 ), ( vx + width ), ( vy + width ), ( vz + 1 ) ) and isLineOfSightClear ( px, py, ( pz + 1 ), ( vx + width ), ( vy - width ), ( vz + 1 ) ) and isLineOfSightClear ( px, py, ( pz + 1 ), ( vx - width ), ( vy - width ), ( vz + 1 ) ) and isLineOfSightClear ( px, py, ( pz + 1 ), ( vx - width ), ( vy + width ), ( vz + 1 ) ) ) end Try it.
  11. Castillo

    Help

    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 ) ) -- Nitro Colors -- if ( fNitroLevel < 20 ) then nColor = "#ff0000" elseif ( fNitroLevel < 40 ) then nColor = "#FF6400" elseif ( fNitroLevel < 60 ) then nColor = "#C86400" elseif ( fNitroLevel < 70 ) then nColor = "#C89600" elseif ( fNitroLevel < 80 ) then nColor = "#329600" elseif ( fNitroLevel < 90 ) then nColor = "#40FF00" end else nColor = "#ff0000" end local hColor = "#40FF00" local kColor = "#40FF00" local mColor = "#40FF00" local nColor = "#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".. nColor ..""..( 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 )
  12. Then you have to edit the freeroam code, not create a new function.
  13. Castillo

    Warp

    No, that's wrong. Use: setTimer ( fadeCamera, 500, 1, true )
  14. You're trying to edit the freeroam vehicle creation system and add that players can't spawn it next to walls?
  15. Castillo

    Warp

    Well, you are fading it-in too fast, you should use a timer.
  16. Castillo

    Help

    Post the new script code.
  17. That's because you made your 'sound' variable local, so it won't exist outside of that function. local sound = playSound3D(id, x, y, z ) All you have to do is remove the 'local' infront of it.
  18. Castillo

    toJSON

    As myonlake said, account data has a string limit, so your JSON string will cut off at some point, you should use either SQLite or MySQL, or just find a work-around for account data.
  19. What's the point of that? instead of copying it from somewhere else, you could have just fixed the code he was using.
×
×
  • Create New...