Jump to content

Walid

Members
  • Posts

    1,491
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Walid

  1. Show me ??? man as i told you if you want to use guiGridListGetItemText without using guiGridListGetSelectedItem, you need to added the row index and the colmun index. Anyways if you want to added the vehicle to the grid list , all what you need is: onClientGUIComboBoxAccepted: This event is called when a ComboBox get accepted guiComboBoxGetSelected : This function returns the index of the selected combobox item guiComboBoxGetItemText: This function retrieves the text from a specific combobox item. getVehicleModelFromName: This function retrieves the model ID of a vehicle as an integer value from its name.
  2. :3 How did you know ?? i think you need to undrestand the resource before you start asking questions.
  3. How did you know that he didn't use guiGridListGetItemText ???
  4. All what you need is: guiGridListSetSelectionMode, guiGridListGetSelectedItems.
  5. Don't use onVehicleDamage, just use my code with a timer ^^ function destroyVehicleOnExplode() destroyElement (source) end addEventHandler("onVehicleExplode", root, destroyVehicleOnExplode)
  6. Here is a very simple way to debug your code. -- debug function onDmg() if isPlayerInJail(localPlayer) then outputChatBox("Yes it's") -- if you can't see this message in your chat box then you need to check if the element data ("_inJail") exist or not. cancelEvent() end end addEventHandler('onClientPlayerDamage',localPlayer,onDmg) -- check if the player is in jail function isPlayerInJail(player) if player and isElement(player) then local returns = getElementData(player,"_inJail") and true or false return returns end return false end
  7. function onDmg() if getElementData(localPlayer,'_inJail') == true then cancelEvent() end end addEventHandler('onClientPlayerDamage',localPlayer,onDmg)
  8. Try this local myString = "3NAD #" local result = (myString:find("%W") == nil) and "Allowed" or "Not allowed" outputChatBox(result)
  9. Try this local mathFloor = math.floor function getNearestVehicle( player ) if player and isElement(player) then local x, y, z = getElementPosition( player ) local vehicles = getElementsByType( "vehicle" ) local prevDistance local nearestVehicle for i=1, #vehicles do local distance = mathFloor(getDistanceBetweenPoints3D( x, y, z, getElementPosition(vehicles[i]))) if distance <= ( prevDistance or distance + 1 ) then prevDistance = distance nearestVehicle = vehicles[i] end end return nearestVehicle or false end end
  10. money: not defined here guiSetText ( GUIEditor.edit[1], "$"..convertNumber (money)) in this part addEvent( 'markerhit', true ) addEventHandler( 'markerhit', root, function () if ( not exports.saeglogin:isClientLoggedin ( ) ) then return end guiSetText ( GUIEditor.edit[1], "$"..convertNumber ( money ) ) guiSetVisible(GUIEditor.window[1],true) showCursor(true) end )
  11. Try this function unbanPlayerCommand(thePlayer, commandName, nickName) if (exports.vice_core:isSuperAdmin(thePlayer)) then if nickName then local bans = getBans() for _,ban in ipairs(bans)do if getBanNick(ban) == nickName then removeBan(ban) end end outputChatBox("#00B4FF"..nickName.."#FFFFFF successfully unbanned.", thePlayer, 255, 255, 255,true) else outputChatBox("[USAGE]:#FFFFFF /"..commandName.." [player]", thePlayer, 0, 180, 255,true) end else exports.vice_notification:addNotification(thePlayer, "Access denied", "warning") end end addCommandHandler("unban", unbanPlayerCommand, false, false)
  12. function carhud() local sWidth,sHeight = guiGetScreenSize() if isPedInVehicle(localPlayer) then local vehicle = getPedOccupiedVehicle(localPlayer) local health = math.ceil ( getElementHealth ( vehicle ) / 10 ) local speedx, speedy, speedz = getElementVelocity ( vehicle) local actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) local kmh = math.ceil(actualspeed * 180) local fuel = math.ceil(tonumber(getElementData ( vehicle, "fuel" )) or 0) dxDrawImage((400/1024)*sWidth, (550/768)*sHeight, (250/1024)*sWidth, (200/768)*sHeight, "outras/background.png",0,250,10,tocolor(0,0,0,255)) dxDrawImage((570/1024)*sWidth, (575/768)*sHeight, (25/1024)*sWidth, (150/768)*sHeight, "outras/line.png",0,0,0,tocolor(255,255,255,255)) dxDrawImage((595/1024)*sWidth, (570/768)*sHeight, (19/1024)*sWidth, (45/768)*sHeight, "outras/lock.png",0,0,0,tocolor(255,255,255,255)) dxDrawImage((595/1024)*sWidth, (620/768)*sHeight, (19/1024)*sWidth, (45/768)*sHeight, "outras/engine.png",0,0,0,tocolor(255,255,255,255)) dxDrawImage((595/1024)*sWidth, (670/768)*sHeight, (19/1024)*sWidth, (45/768)*sHeight, "outras/light.png",0,0,0,tocolor(255,255,255,255)) dxDrawText(tostring (kmh).." Km/H",(470/1024)*sWidth, (585/768)*sHeight, (20/1024)*sWidth, (40/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*0.65, newFont3,"left","top",false,false,false) dxDrawImage((430/1024)*sWidth, (575/768)*sHeight, (30/1024)*sWidth, (50/768)*sHeight, "outras/speed.png",0,0,0,tocolor(255,255,255,255)) dxDrawText(tostring (fuel).."%",(470/1024)*sWidth, (635/768)*sHeight, (20/1024)*sWidth, (50/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*0.75, newFont3,"left","top",false,false,false) dxDrawImage((430/1024)*sWidth, (625/768)*sHeight, (30/1024)*sWidth, (50/768)*sHeight, "outras/fuel.png",0,0,0,tocolor(255,255,255,255)) dxDrawText(tostring (health).."%",(470/1024)*sWidth, (680/768)*sHeight, (20/1024)*sWidth, (50/768)*sHeight, tocolor(255,255,255,255), (sWidth/1024)*0.75, newFont3,"left","top",false,false,false) dxDrawImage((430/1024)*sWidth, (675/768)*sHeight, (30/1024)*sWidth, (50/768)*sHeight, "outras/wrench.png",0,0,0,tocolor(255,255,255,255)) end end addEventHandler("onClientVehicleEnter", getRootElement(), function(thePlayer) if thePlayer == getLocalPlayer() then addEventHandler("onClientRender", getRootElement(), carhud) end end ) addEventHandler("onClientVehicleStartExit", getRootElement(), function(thePlayer) if thePlayer == getLocalPlayer() then removeEventHandler("onClientRender", getRootElement(), carhud) end end )
  13. onVehicleDamage : This event is triggered when a vehicle is damaged. OR just use a timer local mathCeil = math.ceil function checkVehicleDamage() local vehicles = getElementsByType("vehicle") for i=1, #vehicles do local vehiclehealth = mathCeil(getElementHealth (vehicles[i])) if tonumber(vehiclehealth) < 255.5 then setVehicleEngineState (vehicles[i], false ) setVehicleDamageProof(vehicles[i], true) setElementHealth(vehicles[i],255) end end end setTimer(checkVehicleDamage, 100, 0)
  14. i don't know what are you trying to do i just optimized the code reply if it dosent work. Client side local playeSound = {} addEvent ( 'playSound',true ); addEventHandler ( 'playSound',root, function ( aVehicle,sound) if aVehicle and sound then if playeSound [ aVehicle ] and isElement ( playeSound [ aVehicle ] ) then destroyElement (playeSound [ aVehicle ]) playeSound [ aVehicle ] = nil end local position = Vector3(getElementPosition ( aVehicle )) playeSound [ aVehicle ] = playSound3D ( 'files/'..sound..'.wav',position.x,position.y,position.z,false) setSoundMaxDistance ( playeSound [ aVehicle ], 500 ) setSoundVolume ( playeSound [ aVehicle ], 1 ) attachElements ( playeSound [ aVehicle ],aVehicle,0,0,0 ) end end ) Server side function aMakeSoundPlay (aPlayer,key,keyState,sound) if aPlayer and getElementType ( aPlayer ) == 'player' then if isPedInVehicle ( aPlayer ) then local aVehicle = getPedOccupiedVehicle( aPlayer ) local model = getElementModel ( aVehicle ) if model == 476 then triggerClientEvent ( root,"playSound",root,aVehicle,sound) end end end end addEventHandler ( 'onResourceStart',resourceRoot, function () local players = getElementsByType ( 'player' ) for i=1, #players do binKeyForAll(players[i]) end end ) addEventHandler ( 'onPlayerJoin',root, function () binKeyForAll(source) end ) function binKeyForAll(player) if player and isElement(player) then bindKey (player,'lctrl','down',aMakeSoundPlay,'fire') bindKey (player,'lctrl','up',aMakeSoundPlay,'fire_lastshot') end end
  15. i don't know what you want exactly, maybe you need sth like this local testTable = { ["Primary Weapon"] = 1, ["Secondary Weapon"] = 2, ["Pistols"] = 3, ["Specially Weapon"] = 4, ["Ammo"] = 5, ["Food"] = 6, ["Medic Stuff"] = 7, ["Vehicle Parts"] = 8, ["Items"] = 9, ["Toolbelt"] = 10, } function switch(theTable) local order = {} for k,v in pairs(theTable) do order[v] = k end return order end local newTable = switch(testTable) for i=1 ,#newTable do outputChatBox(i..": "..newTable[i]) end
  16. You can use sth like this: Server side addEventHandler("onPlayerLogin", root, function() setTimer(triggerClientEvent,1000,1,source,"removeLoginMessage",source) end ) Client side addEvent("removeLoginMessage",true) addEventHandler("removeLoginMessage",localPlayer, function() for i = 1, 200, 1 do outputChatBox("") end end )
  17. should be setTimer(respawnVehicle, 5000, 1, hitElement)
  18. * ipairs: loop only number indexes "start from 1 index" and only in order. * pairs: Loop all.
  19. You can use a timer to remove the event handler local duration = 5000 local x,y = guiGetScreenSize() function fadeDX() startTick = getTickCount() addEventHandler("onClientRender",root,text) setTimer (function() removeEventHandler("onClientRender",root,text) end,8000,1) end function text() local currentTick = getTickCount() local progress = (currentTick-startTick)/duration local alpha = interpolateBetween(0,0,0,255,0,0,progress,"InOutQuad") dxDrawText ("D-Day", x/2.05, y/3, x, y, tocolor(255, 255, 255, alpha), 3) end or check if the alpha == 255 then remove the event handler like this local duration = 5000 local x,y = guiGetScreenSize() function fadeDX() startTick = getTickCount() addEventHandler("onClientRender",root,text) end function text() local currentTick = getTickCount() local progress = (currentTick-startTick)/duration local alpha = interpolateBetween(0,0,0,255,0,0,progress,"InOutQuad") dxDrawText ( "D-Day", x/2.05, y/3, x, y, tocolor(255, 255, 255, alpha), 3) if tonumber(alpha) == 255 then removeEventHandler("onClientRender",root,text) end end
×
×
  • Create New...