Jump to content

opnaiC

Members
  • Posts

    156
  • Joined

  • Last visited

Everything posted by opnaiC

  1. if ( alwaysRenderMap or getElementInterior(localPlayer) == 0 ) then dxSetRenderTarget(rt, true) local x, y = getElementPosition(localPlayer) local X, Y = mW/2 -(x/(6000/worldW)), mH/2 +(y/(6000/worldH)) local camX,camY,camZ = getElementRotation(getCamera()) dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, "img/radar_map.jpg", camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255)) dxSetRenderTarget() end local rt = dxCreateRenderTarget(290, 175) This is how it is now
  2. I think I need some help to get this working because its to hard for me.
  3. Allready tried the same stuff for the first pixel line
  4. I fixed what you post and its working now like that: Only the first pixel line is green but not the rest. Script: addEventHandler('onClientResourceStart', resourceRoot, function() texture = dxCreateTexture("img/radar_map.jpg") if (texture) then dxSetTextureEdge(texture, "border", tocolor(0, 255, 0)) end end ) ...
  5. So when I use dxCreateImage can I use this ? Cause I tried it and it isnt working .. Can you explain what do you mean with the argument texture ? This is what I tried: img = dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, "img/radar_map.jpg", camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255)) dxSetTextureEdge(img, "border", tocolor(255, 0, 0, 255))
  6. Hi, How I can fix that black edge on the radar map ? Is there any other way without making the map bigger ?
  7. function onWasted() if not( isGuestAccount (getPlayerAccount(source)) ) then local jailtime = getAccountData(getPlayerAccount(source), "Jailtime" ) or 0 local theWeapon = getPedWeapon (source) local weaponAmmo = getPedTotalAmmo (source) if tonumber(jailtime) == nil or 0 then outputChatBox ("1", root) fadeCamera (source, false) setTimer (spawnPlayer, 1000, 1, source, 1161.3000488281, -1376.0999755859, 4, 0, getPedSkin (source), 0, 0, getPlayerTeam(source)) setTimer (setElementHealth, 1500, 1, source, 10) setTimer (setCameraTarget, 1250, 1, source, source) setTimer (fadeCamera, 2000, 1, source, true) setTimer (giveWeapon, 2000, 1, source, theWeapon, weaponAmmo, true) elseif tonumber(jailtime) > 0 then outputChatBox ("2", root) fadeCamera (source, false) setTimer (spawnPlayer, 1000, 1, source, 264.20001220703, 77.599998474121, 1001, 0, getPedSkin (source), 6, 1, getPlayerTeam(source)) setTimer (portjail, 1500, 1) setTimer (setElementHealth, 1500, 1, source, 10) setTimer (setCameraTarget, 1250, 1, source, source) setTimer (fadeCamera, 2000, 1, source, true) setTimer (giveWeapon, 2000, 1, source, theWeapon, weaponAmmo, true) end end end addEventHandler ("onPlayerWasted", getRootElement(), onWasted) Its saying compared nil with a number. I tried to change it but either 1 or 2 is working (outputchatbox).
  8. opnaiC

    [HELP] skin

    local skins = { 73,287,312,179,61 } function skin () local thePlayer = client local playeraccount = getPlayerAccount ( thePlayer ) local fac = getAccountData(playeraccount,"Faction") or 0 local rank = getAccountData(playeraccount,"Rank") or 0 if thePlayer and isElement(thePlayer) then local model = getElementModel (thePlayer) if (tonumber( fac) == 8 ) then if not skins[model] then -- something should be wrong here setAccountData(playeraccount, "SkinBeforeJob", tonumber(model)) if (tonumber(rank) == 1) then setElementModel(thePlayer,73) elseif (tonumber(rank) == 2) then setElementModel(thePlayer,287) elseif (tonumber(rank) == 3) then setElementModel(thePlayer,287) elseif (tonumber(rank) == 4) then setElementModel(thePlayer,312) elseif (tonumber(rank) == 5) then setElementModel(thePlayer,179) elseif (tonumber(rank) == 6) then setElementModel(thePlayer,61) end else local oldskin = getAccountData(playeraccount, "SkinBeforeJob") or 0 setElementModel (thePlayer, tonumber(oldskin)) end end end end addEvent ("skinL", true) addEventHandler ("skinL", root, skin) It is setting the model to the new one but not to the old. Nothing in debug
  9. addEventHandler("onVehicleExplode", root, function () for _, veh in ipairs (getElementsByType("vehicle", getResourceRootElement())) do setTimer(respawnVehicle, 3000, 1, source) end end ) I made a resource. In this resource I added some vehicles. And now I want to respawn the vehicle on explode only in this resource. But its respawning all vehicles not only the vehicles that are in the resource.
  10. Hello, I am making a speedometer and need some help. So I finished the speedometer for the car speed and its working without any bugs. But now I need to make one for the fuel. I am using this to get the fuel state. getElementData(getPedOccupiedVehicle ( localPlayer ), "fuel" ) or 0 I have a config where I can change the full fuel tank for diffrent cars. Example: Infernus = 500 and Cheetah = 300. But I dont know how to calculate the rotation of the needle on the speedometer for the car tank fuel state. The rotation should be every time 180. But the problem is that the car fuel is different from model to model. So how can I calculate the rotation for all cars by different fuel tank ? I hope you can help me with that. dxDrawImage(screenX-575, screenY-320, 300,300,"img/fuel_speed.png",fuel-100,0.0,0.0,tocolor(255,255,255,255),false)-- how to calculate the fuel needle rotation?
  11. I am not asked anybody to script my gamemode I just asked for some help. The script you gave me didnt helped me so I used the one before. But thanks by the way))
  12. function respawnTimer ( source ) for _, veh in ipairs (getElementsByType("vehicle", resourceRoot)) do if getVehicleOccupant (veh) then ourVehicle = getPedOccupiedVehicle (source) end end end setTimer (respawnTimer, 500, 0) function respawnOnExplode ( ) for _, veh in ipairs (getElementsByType("vehicle", resourceRoot)) do if veh == ourVehicle then respawnVehicle (veh) end end end addEventHandler ("onVehicleExplode", root, respawnOnExplode) The vehicle that the player occupied should respawn on explode.
  13. veh is not defined in the first lines so it returns nil. how should I define it ? Also the script is not better then the previous cause with this the police can open all police cars. As example when I would add the Savanna model in grove street they could open all models.
  14. Okay I fixed one line and its working now. But like I understand this system will work for all created cars in this resource, right ? But then I would have a problem because all my factions are in one resource and I want to add this system to else of them.
  15. Hello guys, in the script below I made a table and a function that will create cars from the table information. (and this function is working) Now I want to add a /lock and /engine system only for this cars. I made 2 functions below but they wont work because they are wrong. This cars are made for the LSPD faction and player should only lock or start the engine if he is in the faction. So I am asking for help here. local pVeh = { {model = 596, x = 1570.2998046875, y = -1710.099609375, z = 5.6999998092651, rx = 0, ry = 0, rz = 0, r = 65, g = 105, b = 255, lp = "SA-AA-01", r2 = 255, g2 = 255, b2 = 255}, {model = 596, x = 1574.5, y = -1710.099609375, z = 5.6999998092651, rx = 0, ry = 0, rz = 0, r = 65, g = 105, b = 255, lp = "SA-AB-76", r2 = 255, g2 = 255, b2 = 255}, {model = 426, x = 1578.5, y = -1710, z = 5.6999998092651, rx = 0, ry = 0, rz = 0, r = 192, g = 192, b = 192, lp = "SA-TC-31"}, -- {model = 560, x = 1583.599609375, y = -1710.099609375, z = 5.6999998092651, rx = 0, ry = 0, rz = 0, r = 0, g = 0, b = 128, lp = "SA-KJ-81"}, -- {model = 579, x = 1587.7001953125, y = -1710.2001953125, z = 5.6999998092651, rx = 0, ry = 0, rz = 0, r = 70, g = 0, b = 0, lp = "SA-CZ-48"}, -- {model = 427, x = 1529.7998046875, y = -1683.7001953125, z = 6.0999999046326, rx = 0, ry = 0, rz = 270, r = 65, g = 105, b = 255, lp = "SA-UJ-40", r2 = 255, g2 = 255, b2 = 255}, {model = 427, x = 1529.7001953125, y = -1687.7998046875, z = 6.0999999046326, rx = 0, ry = 0, rz = 270, r = 65, g = 105, b = 255, lp = "SA-KS-00", r2 = 255, g2 = 255, b2 = 255}, } function buildPVehicle () for i,v in pairs (pVeh) do pVehicle = createVehicle (v.model, v.x, v.y, v.z, v.rx, v.ry, v.rz, v.lp) setVehicleLocked (pVehicle, false) setVehicleColor (pVehicle, v.r, v.g, v.b, v.r2, v.g2, v.b2) end end addEventHandler ("onResourceStart", root, buildPVehicle) function playerCarLock ( source, cmd) -- this function is wrong for i,v in pairs (pVehicle) do local playeraccount = getPlayerAccount ( source ) local fac = getAccountData(playeraccount,"Faction") or 0 if (tonumber(fac) == 2) then if getDistanceBetweenPoints3D (getElementPosition(pVehicle), getElementPosition(source)) if not isVehicleLocked (pVehicle) then setVehicleLocked (pVehicle, true ) else setVehicleLocked ( pVehicle, false ) end end end end addCommandHandler ("lock",playerCarLock) function engine ( source, cmd) -- this function is wrong for i,v in pairs (pVehicle) do if getPedOccupiedVehicle(source) == pVehicle then if (tonumber(fac) == 2) then if getVehicleEngineState(pVehicle) == false then setVehicleEngineState ( pVehicle, true ) else setVehicleEngineState ( pVehicle, false ) end end end end end addCommandHandler ("engine",engine)
  16. function startStats (player) statTable = {} for index, player in ipairs(getElementsByType("player")) do local account = getPlayerAccount(player) if account and not isGuestAccount(account) then local playerName = getPlayerName(player) local faction = getAccountData(account, "faction") or 0 local lvls = getAccountData(account, "lvl") or 0 table.insert(statTable,{playerName,faction,lvls}) end end triggerClientEvent(player,"addItems", player, statTable) end addEventHandler ("onResourceStart", root, startStats) function addItems(statTable) for i,v in pairs (statTable) do windowMenuLable1 = guiCreateLabel(x*12, y*36, x*277, y*22, "Имя: "..v[1], false, windowMenu3) windowMenuLable2 = guiCreateLabel(x*12, y*68, x*277, y*22, "Уровень: "..v[3], false, windowMenu3) windowMenuLable3 = guiCreateLabel(x*12, y*100, x*277, y*22, "Фракция: "..v[2], false, windowMenu3) end end addEvent ("addItems", true) addEventHandler ("addItems", root, addItems) Error: What did I wrong?
  17. please look at the hole script, I know what it mean but Idk why it isnt working
  18. Are you alive in this world? Do you even know how to script? Don't you see his (if) statement, line 3? If it is set to something, it will go on. Just that you can't notice, don't help pls. omg .... Its not the hole script only a part of it... look at the rest and you will undestand it
  19. Still saying trying to compare number with nil
  20. function SetJailTime() for theKey,thePlayer in ipairs(getElementsByType ( "player" )) do if ( getAccountData(getPlayerAccount(thePlayer), "Jailtime") ) then local jailtime = getAccountData(getPlayerAccount(thePlayer), "Jailtime" ) if tonumber(jailtime)) > 0 then setAccountData ( getPlayerAccount(thePlayer), "Jailtime", jailtime - 1 ) elseif tonumber(jailtime) == 0 then portoutjail(thePlayer) setAccountData(getPlayerAccount(targetplayer), "Jailtime", nil) end end end end setTimer ( SetJailTime, 60000, 0 ) Its saying attempted to compare number with nil I made a jail system and I can jail the player if he has a wanted level. But now I want to every 60 sec to take -1 from the accountdata and if its allready 0 then teleport the player out of the jail.
  21. function respawnBus (thePlayer) local theVehicle = getPedOccupiedVehicle ( thePlayer ) local model = getElementModel(theVehicle) if model == 431 then if not getVehicleOccupants (theVehicle) then setTimer (function () respawnVehicle (theVehicle) end, 5000, 1) end end end addEventHandler ("onVehicleExit", root, respawnBus) Bad Argument in 3 line. Got boolean
×
×
  • Create New...