Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. Kenix

    Question

    I test it and it working! In chat: /bomb SomeGuy
  2. I tested it now you need make higher marker 2 ~ units if marker below you can't hit. Done code server: local theMarker = createMarker ( 2467.8647460938, -1648.7094726563, 12.49255897522, "cylinder", 1, 255, 255, 0, 170 ) function mission1MarkerHit( element,matchingDimension ) if matchingDimension and getElementType( element ) == "player" then triggerClientEvent ( element, "showMission1", element ) end end addEventHandler("onMarkerHit",theMarker,mission1MarkerHit ) -- maybe you this too needed if not remove function mission1MarkerLeave( element,matchingDimension ) if matchingDimension and getElementType( element ) == "player" then triggerClientEvent ( element, "unshowMission1", element ) end end addEventHandler("onMarkerLeave",theMarker,mission1MarkerLeave ) addEvent("rejectTheMission", true) addEventHandler("rejectTheMission", root, function () triggerClientEvent ( source, "unshowMission1", source ) end ) addEvent("acceptTheMission", true) addEventHandler("acceptTheMission", root, function() triggerClientEvent ( source, "unshowMission1", source ) end )
  3. При компилировании мта пишет ошибку с d3dx9.h. Но я установил DirectX SDK. Возможно надо как то в ручную подключать к проекту? Помогите пожалуйста.
  4. No problem Santa coder help you
  5. You can use settings for your resource( Can be used for anything map,gamemode etc ) P.S I update code.
  6. lol? Example how use it: Your meta map for example: <meta> <info gamemodes="some" type="map" name="some" author="...." version="1.0.1" description="..."></info> <map src="some.map" dimension="0"></map> <settings> <setting name="#test" value="[ 1 ]"></setting> <setting name="#minplayers" value="[ 0 ]"></setting> <setting name="#maxplayers" value="[ 128 ]"></setting> <setting name="#gravity" value="[ 0.008000 ]"></setting> <setting name="#weather" value="[ 0 ]"></setting> <setting name="#time" value="0:0"></setting> <setting name="#locked_time" value="[ false ]"></setting> <setting name="#waveheight" value="[ 0 ]"></setting> <setting name="#gamespeed" value="[ 1 ]"></setting> </settings> </meta> addEventHandler( "onGamemodeMapStart",root, function( resourceStart ) outputChatBox( tostring( get( getResourceName ( resourceStart )..".test" ) ) ) -- output 1 end ) p.s This is example I update code
  7. Yeah my error This should work: local soundtable = { "images/mmmp.mp3", "images/cv.mp3", "images/rr.wav", "images/mn.mp3", "images/wwd.mp3" } function musicpod( ) local x, y, z = getElementPosition( source ) local m3d = playSound3D( soundtable[ math.random( 1,#soundtable ) ], x, y, z, false ) setSoundVolume( m3d, 0.5) setSoundMaxDistance( m3d, 50 ) attachElements( m3d, source ) end addEvent("onPodClick", true) addEventHandler("onPodClick", root, musicpod)
  8. Give me full code i fix it
  9. This is not a bug just why send 2 times if you pass, and so. Read https://wiki.multitheftauto.com/wiki/TriggerClientEvent where theElement How i fixed problem if idk how you trigger event.
  10. Full code please how you trigger P.S why you trigger source to argument function ? source is variable in event and not need add to argument to function Correct triggerClientEvent("onPodClick", source) https://wiki.multitheftauto.com/wiki/Event
  11. https://wiki.multitheftauto.com/index.ph ... troduction
  12. addEventHandler("onClientPlayerSpawn", root, function ( ) local ammo = getPedTotalAmmo ( source ) local wtype = getPedWeapon ( source ) outputChatBox( "Weapon "..tostring( wtype ).." id, ammo "..tostring( ammo ) ) end ) Why you need check root?
  13. Client side: addCommandHandler( "weapon", function( ) local weapon = getPedWeapon( localPlayer ) outputChatBox( "You have weapon"..tostring( weapon ).." id, ammo "..tostring( getPedTotalAmmo( localPlayer,getPedWeaponSlot( localPlayer ) ) ) ) end ) Code updated
  14. Event onPlayerJoin only server side not client side.
  15. Try: -- Made By XX3, from scratch with MS Notepad. Purpose: To make a new exotic compact HUD. -- You may edit this resource, but please credit me if you wanted to post an edited / extended version. -- PS: I was in MTA SA to show what Indonesia is really made of! <!-- s:D --><img src=\"{SMILIES_PATH}/icon_biggrin.gif\" alt=\":D\" title=\"Very Happy\" /><!-- s:D --> -- Weapon tables for ammo. local noreloadweapons = {} --Weapons that doesn't reload (including the flamethrower, minigun, which doesn't have reload anim). noreloadweapons[16] = true noreloadweapons[17] = true noreloadweapons[18] = true noreloadweapons[19] = true noreloadweapons[25] = true noreloadweapons[33] = true noreloadweapons[34] = true noreloadweapons[35] = true noreloadweapons[36] = true noreloadweapons[37] = true noreloadweapons[38] = true noreloadweapons[39] = true noreloadweapons[41] = true noreloadweapons[42] = true noreloadweapons[43] = true local meleespecialweapons = {} --Weapons that don't shoot, and special weapons. meleespecialweapons[0] = true meleespecialweapons[1] = true meleespecialweapons[2] = true meleespecialweapons[3] = true meleespecialweapons[4] = true meleespecialweapons[5] = true meleespecialweapons[6] = true meleespecialweapons[7] = true meleespecialweapons[8] = true meleespecialweapons[9] = true meleespecialweapons[10] = true meleespecialweapons[11] = true meleespecialweapons[12] = true meleespecialweapons[13] = true meleespecialweapons[14] = true meleespecialweapons[15] = true meleespecialweapons[40] = true meleespecialweapons[44] = true meleespecialweapons[45] = true meleespecialweapons[46] = true function DXdraw() --Variables sWidth, sHeight = guiGetScreenSize() -- Getting the screen size health = getElementHealth( getLocalPlayer() ) lineLength1 = 114 * ( health / 100 ) -- Health bar armor = getPedArmor( getLocalPlayer() ) lineLength2 = 114 * ( armor / 100 ) -- Armor bar ammoinclip = getPedAmmoInClip (getLocalPlayer()) -- The ammo inside the clip totalammo = getPedTotalAmmo(getLocalPlayer())-getPedAmmoInClip(getLocalPlayer()) -- The total ammo minus ammo inside clip totalammo2 = getPedTotalAmmo(getLocalPlayer()) showammo1 = ammoinclip showammo2 = totalammo showammo3 = totalammo2 moneycount=getPlayerMoney(getLocalPlayer()) money= '$' ..moneycount -- Money local hour, mins = getTime () time = hour .. ":" .. (((mins < 10) and "0"..mins) or mins) -- Time. This one makes the minutes always show by 2 digits (3:05 instead of 3:5) local wantedlevel = getPlayerWantedLevel (getLocalPlayer()) --Getting the player's wanted level. -------- Dynamic health colour thanks to 50p ---------- tick = getTickCount () -- For active health bar local maxHealth = 100; -- get max health stat local colourPercent = ( health / maxHealth ) * 200; local red, green; -- we don't need blue because we don't use it, it'll be 0 if health < ( maxHealth / 2 ) then red = 200; green = ( health / 50 ) * ( colourPercent * 2 ); else green = 200; red = 200 - ( ( health - 50 ) / 50 ) * 200; end -- For inactive health bar local maxHealth = 75; -- get max health stat local colourPercent1 = ( health / maxHealth ) * 75; local red1, green1; -- we don't need blue because we don't use it, it'll be 0 if health < ( maxHealth / 2 ) then red1 = 75; green1 = ( health / 50 ) * ( colourPercent1 * 2 ); else green1 = 75; red1 = 75 - ( ( health - 50 ) / 50 ) * 75; end local color1 = tocolor( red1, green1, 0, 150 ) local color2 = tocolor( red, green, 0, 200 ) -- For the health bar if getTickCount () %1500 < 500 and health <= 20 and armor <=0 then -- If health is less than 20%, armor is 0%, the health bar will blink by hiding the health bar every 1.5 seconds. else dxDrawRectangle(sWidth-206,sHeight-29,114.0,14.0,color1, false) -- Health inactive bar dxDrawRectangle(sWidth-206,sHeight-29,lineLength1,14.0,color2,false) --Health active bar end if armor <= 0 then else dxDrawRectangle(sWidth-206,sHeight-43,lineLength2,14.0,tocolor(200,200,200,200),false) -- Armor active bar dxDrawRectangle(sWidth-206,sHeight-43,114.0,14.0,tocolor(50,50,50,150),false) -- Armor inactive bar end ------ DX drawing that are visible at all times dxDrawRectangle(sWidth-84,sHeight-48,78.0,33.0,tocolor(0,0,0,150),false) -- GTA Time DX Rectangle dxDrawText(tostring (money),sWidth-200,sHeight-78,sWidth-5,sHeight-54,tocolor(0,0,0,200),1.0,"pricedown","right","top",false,false,false) -- Money DX text (shadow) dxDrawText(tostring (money),sWidth-202,sHeight-81,sWidth-7,sHeight-57,tocolor(0,100,0,220),1.0,"pricedown","right","top",false,false,false) -- Money DX text dxDrawText(tostring (time),sWidth-81,sHeight-46,sWidth-10,sHeight-16,tocolor(250,250,250,200),1.0,"diploma","center","top",false,false,false) -- GTA Time DX text ------- Weapon icons & Ammo DX drawings local weaponID = getPedWeapon (getLocalPlayer()); -- Get weapon ID dxDrawImage(sWidth-266,sHeight-60,48.0,52.0,"icons/".. tostring( weaponID ) .. ".png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Weapon icons image. Check the icons file if you want to take and replace weapon icons. -- now decide if the optional stuff should be drawn if noreloadweapons [getPedWeapon(getLocalPlayer())] then dxDrawText(tostring (showammo3),sWidth-400,sHeight-47,sWidth-288,sHeight-12,tocolor(0,255,255,200),1.0,"bankgothic","right","top",false,false,false) -- No reload weapons (for shotgun, grenades, etc) elseif meleespecialweapons [getPedWeapon(getLocalPlayer())] then -- Draw Nothing for melee and special weapons. else --Weapons that reloads. dxDrawText(tostring (showammo2),sWidth-414,sHeight-47,sWidth-369,sHeight-18,tocolor(0,255,255,200),1.0,"bankgothic","right","top",false,false,false) dxDrawText("|",sWidth-361,sHeight-48,sWidth-385,sHeight-8,tocolor(255,200,0,200),1.0,"bankgothic","left","top",false,false,false) dxDrawText(tostring (showammo1),sWidth-345,sHeight-47,sWidth-272,sHeight-12,tocolor(0,255,255,200),1.0,"bankgothic","left","top",false,false,false) end if wantedlevel == 0 then -- Draw nothing (Wanted level 0) elseif wantedlevel == 1 then dxDrawImage(sWidth-21,sHeight-212,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(sWidth-21,sHeight-190,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(sWidth-21,sHeight-168,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(sWidth-21,sHeight-148,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(sWidth-21,sHeight-126,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(sWidth-21,sHeight-105,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) -- Wanted level 1 elseif wantedlevel == 2 then dxDrawImage(sWidth-21,sHeight-212,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(sWidth-21,sHeight-190,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(sWidth-21,sHeight-168,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(sWidth-21,sHeight-148,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(sWidth-21,sHeight-126,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) -- Wanted level 2 dxDrawImage(sWidth-21,sHeight-105,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) elseif wantedlevel == 3 then dxDrawImage(sWidth-21,sHeight-212,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(sWidth-21,sHeight-190,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(sWidth-21,sHeight-168,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(sWidth-21,sHeight-148,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) -- Wanted level 3 dxDrawImage(sWidth-21,sHeight-126,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) dxDrawImage(sWidth-21,sHeight-105,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) elseif wantedlevel == 4 then dxDrawImage(sWidth-21,sHeight-212,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(sWidth-21,sHeight-190,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(sWidth-21,sHeight-168,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) -- Wanted level 4 dxDrawImage(sWidth-21,sHeight-148,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) dxDrawImage(sWidth-21,sHeight-126,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) dxDrawImage(sWidth-21,sHeight-105,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) elseif wantedlevel == 5 then dxDrawImage(sWidth-21,sHeight-212,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(0,0,0,100),false) dxDrawImage(sWidth-21,sHeight-190,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) -- Wanted level 5 dxDrawImage(sWidth-21,sHeight-168,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) dxDrawImage(sWidth-21,sHeight-148,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) dxDrawImage(sWidth-21,sHeight-126,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) dxDrawImage(sWidth-21,sHeight-105,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) else dxDrawImage(sWidth-21,sHeight-212,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) -- Wanted level 6 dxDrawImage(sWidth-21,sHeight-190,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) dxDrawImage(sWidth-21,sHeight-168,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) dxDrawImage(sWidth-21,sHeight-148,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) dxDrawImage(sWidth-21,sHeight-126,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) dxDrawImage(sWidth-21,sHeight-105,16.0,19.0,"images/star.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end end -- End of the DX Drawing function -------- HUD toogle command functions. function hudChanger () addEventHandler("onClientRender", getRootElement(), DXdraw) showPlayerHudComponent ( "armour", false ) showPlayerHudComponent ( "health", false ) showPlayerHudComponent ( "money", false ) showPlayerHudComponent ( "clock", false ) showPlayerHudComponent ( "weapon", false ) showPlayerHudComponent ("ammo", false) showPlayerHudComponent ( "money", false ) showPlayerHudComponent ( "wanted", false ) end addCommandHandler ( "showhud", hudChanger ) -- Shows the Alternate HUD addCommandHandler ( "hidegtahud", hudChanger ) -- Hides the GTA HUD addEventHandler( "onClientResourceStart", resourceRoot, hudChanger ) function hudChanger2 () removeEventHandler("onClientRender", getRootElement(), DXdraw) showPlayerHudComponent ( "armour", true ) showPlayerHudComponent ( "health", true ) showPlayerHudComponent ( "money", true ) showPlayerHudComponent ( "clock", true ) showPlayerHudComponent ( "weapon", true ) showPlayerHudComponent ("ammo", true) showPlayerHudComponent ( "money", true) showPlayerHudComponent ( "wanted", true ) end addCommandHandler ( "hidehud", hudChanger2) -- Removes the HUD, and shows the GTA HUD. addCommandHandler ( "showgtahud", hudChanger2) addEventHandler("onClientResourceStop", resourceRoot, hudChanger2) -- When you stop the resource, executes. function hudChanger3 () removeEventHandler("onClientRender", getRootElement(), DXdraw) showPlayerHudComponent ("all", false) end addCommandHandler ( "hideall", hudChanger3 ) -- Shows the Alternate HUD function radarcommand1 () showPlayerHudComponent ("radar", true) end addCommandHandler( "showradar", radarcommand1 ) function radarcommand2 () showPlayerHudComponent ("radar", false) end addCommandHandler( "hideradar", radarcommand2 ) Code updated
  16. Try local soundtable = { "images/mmmp.mp3", "images/cv.mp3", "images/rr.wav", "images/mn.mp3", "images/wwd.mp3" } function musicpod( ) local x, y, z = getElementPosition( source ) local m3d = playSound3D( math.random( 1,#soundtable ), x, y, z, false ) setSoundVolume( m3d, 0.5) setSoundMaxDistance( m3d, 50 ) attachElements( m3d, source ) end addEvent("onPodClick", true) addEventHandler("onPodClick", root, musicpod) If it not work please show how you trigger event "onPodClick"
  17. Try addEventHandler ( "onClientResourceStart",resourceRoot, function() exports.customblips:createCustomBlip ( 2236.345703125,2458.1728515625, 20, 20, "icon.png" ) end ) if it not working show meta.xml
  18. Kenix

    Question

    Check this: function predBomb( player, _,name, meters ) local target = getPlayerFromPartialName ( name,player ) if not isElement ( target ) then return outputChatBox( "can't find player" ) end local meters = tonumber( meters ) if not meters then meters = 3 end local posX , posY , posZ = getElementPosition ( target ) local rotation = getPedRotation( target ) posX = posX - math.sin ( math.rad ( rotation ) ) * meters posY = posY + math.cos ( math.rad ( rotation ) ) * meters local bomb = createObject( 1337,posX+1,posY,posZ ) outputChatBox( "Bomb return: "..tostring( bomb ) ) setTimer( setElementPosition,50,1,bomb,posX+1,posY,posZ ) setTimer( setElementPosition,150,1,bomb,posX+3,posY,posZ ) setTimer( setElementPosition,250,1,bomb,posX+6,posY,posZ ) setTimer( setElementPosition,350,1,bomb,posX+9,posY,posZ ) local xo,yo,zo = getElementPosition( bomb ) setTimer( createExplosion,2000,1,xo,yo,zo, 0 ) end addCommandHandler("bomb", predBomb) function getPlayerFromPartialName ( name , player ) if name then local matches = { } for index , _player in ipairs ( getElementsByType ( "player" ) ) do if getPlayerName ( _player ) == name then return _player end if getPlayerName ( _player ) : gsub ( "#%x%x%x%x%x%x" , "" ) : lower ( ) : find ( name : lower ( ) ) then table.insert ( matches , _player ) end end if #matches == 1 then return matches [ 1 ] else if player then outputChatBox ( "Found " .. #matches .. " matches" , player , 255 , 0 , 0 ) end end end end
×
×
  • Create New...