-
Posts
1,058 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Saml1er
-
You must check if the source is the specified vehicle. local myVeh = createVehicle ( 470, -490.39999389648, -486.60000610352, 25.60000038147 ) function respawnExplodedVehicle() if source == myVeh then -- make sure its the vehicle that you want toggle respawn toggleVehicleRespawn( myVeh, true ) setVehicleRespawnDelay( myVeh, 5000 ) end end addEventHandler("onVehicleExplode", getRootElement(), respawnExplodedVehicle)
-
Make an edit box and use guiSetAlpha and render your dx rectangle there or you've already tried it?
-
Are you selling or buying? If you're buying then I can script it for you. I'm already working on a project and I'm going to finish it by tomorrow and so on I can work on other project. Contact me.
-
You'll need to use onClientPreRender for smooth working and use findRotation () to point at an element.
-
local weaponID = getWeaponIDFromName(weapon) for i=1,46 do local a = Cart.weapons[i] if a == weaponID then Cart.weapons[i] = nil -- This will become nil and when it becomes nil then it will be replaced by the row or value next to it. end end
-
You'll probably need to loop for that since the data aren't keyed. Once you loop and compare the value and so if they match then set them to nil.
-
Server side : function finished(objective) if (objective.id ~= "radar") then return end triggerClientEvent(root,"onAssaultObjectiveReached",root) end addEventHandler("onAssaultObjectiveReached",getRootElement(),finished) Client side: function finished(objective) if (objective.id ~= "radar") then return end sound() end function sound() local sound = playSound("win.wav") --Play wasted.mp3 from the sounds folder setRadioChannel(0) setSoundVolume(sound, 1) -- set the sound volume to 50% end addEvent("onAssaultObjectiveReached",true) addEventHandler("onAssaultObjectiveReached",getRootElement(),finished)
-
Cart.weapons[w_count] = { weaponID, bulletsAmount } -- but now you'll need to use local weaponID = Cart.weapons[1][1] local bulletsAmount = Cart.weapons[1][2]
-
playSound is a client side function.
-
Well I've never done a loop like that but anyway for the time being use: for i=1,46 do local a = Cart.weapons[i] if a ~= nil then outputChatBox (a) end end
-
It won't. Use this: The script should be client side. local w_count = 1 local w_count = w_count + 1 -- whenever you insert anything again in weapons then add +1 Cart.weapons[w_count] = weaponID
-
Then why don't you do it like this? local Cart = { weapons = { }, prices = { } } local weaponID = 22 Cart.weapons[1] = weaponID ---- This will insert the weapon id into the table and the table will become like this: local Cart = { weapons = {22 }, prices = { } } But if you want to insert more into the same weapons then. Cart.weapons[2] = weaponID -- just keep adding +1 to the Cart.weapons[value]
-
Thats weird. I tested it just now and it outputs. ROW: value1: 1, value2: 2 ROW: value1: 6666, value2: 21312 ROW: value1: 1231, value2: 423542
-
A table with Three rows. local weapons = { { 1, 2}, {6666, 21312}, {1231, 423542}, } for _,v in pairs (weapons) do -- by looping through the table local value1 = v[1] local value2 = v[2] outputChatBox ("ROW: value1: ".. value1..", value2: "..value2) end
-
local ID = 30 local weapons = { } weapons[#weapons+1] = ID -- this will insert 30 in it. It doesn't matter if the table has some value, you can insert tons of data into a table Are you trying to say that you want to check if 22 value exists in the table?
-
Its really easy. Use mysql to save your website data in a db file and mta also provide mysql functions like dbConnect so you can use those functions to get the username and pass from that db file and voila thats how its done.
-
local weapons = { } local ID = getWeaponIDFromName(weapon) if #weapons == 0 then -- means if the table is empty -- do your stuff else -- if the table is not empty weapons[#weapons+1] = {weaponName, ID } -- insert it into table ( row ), you can use this same method to insert more end P.S I play on your server sometimes. Keep up the good work. EDIT: Use #TABLENAME to get the table length and you can also get the weapon by: local weaponName = weapons[1][1] local weaponID = weapons[1][2] ----- for random local r = math.random (1,#weapons) local weaponName = weapons[r][1] local weaponID = weapons[r][2]
-
Just add this line at the top of the code local createdBag = true Its not even needed but maybe this variable doesn't exist as global.
-
function createBag() local random = math.random ( #mbag ) local x, y, z = mbag[random][1], mbag[random][2], mbag[random][3] bag = createPickup( x, y, z, 3, 1274 ) if bag then createdBag = true setElementCollisionsEnabled( bag, false ) outputChatBox( "A Maze-pack is available!, Search it! at Maze ", root, 101, 250, 0 ) end return true end addEventHandler("onResourceStart", resourceRoot,createBag) addEventHandler("onPickupHit",root, function ( player ) if ( source ~= bag ) then return end if ( isPedInVehicle( player ) ) then return end createdBag = nil destroyElement( bag ) destroyElement( bl ) randomMoney = math.random ( 3000, 5000 ) randomArmor = math.random( 10, 20 ) name = getPlayerName(player) givePlayerMoney(player,randomMoney) setPedArmor ( player, getPedArmor(player) + randomArmor ) outputChatBox(name.." found the packs, got $" .. tostring(randomMoney) .." and ".. tostring(randomArmor) .."% Armor", root, 101, 250, 0) outputChatBox("New Maze-pack will be available after 10 mins", root, 200, 250, 0) setTimer( function () createBag () end, 240000, 1 ) end) function mazeCommand(player, cmd) if createdBag then outputChatBox("*Maze is availabe now!",player,255,255,0) elseif not createdBag then outputChatBox("There's no package available now!",player,50,255,25) end end addCommandHandler("maze", mazeCommand)
-
Well you must know at least basics about sql to understand tutorial so check this out: http://www.w3schools.com/sql/sql_select.asp NOTE: Just don't use that ";" sign in mta.
-
Yes, you're right. I totally forgot about that since the objects will be created for client so there's no need to send players to other dimensions. That function doesn't work the way you want it. You'll need to create everything manually. Check the code again.
-
Well getAlivePlayers( ) sometimes gets the players who have just recently joined so if you use race resource then do something like this: function getAlivePlayers2() local pp = { } for _,v in pairs (getElementsByType("player") ) do local state = getElementData (v, "state") if state and state == "alive" then pp [#pp + 1] = v end end return pp end function DestructionWin( ) local alivePlayers = getAlivePlayers2() if #alivePlayers == 1 then local account = getPlayerAccount( alivePlayers[1] ) if account then if isGuestAccount( account ) then return end setAccountData( account,"Wins",(tostring( getAccountData( account,"Wins" )) or 0) +1 setAccountData( account,"Cash",(tostring( getAccountData( account,"Cash" )) or 0 )+ 250 local randVal = math.random(2,3) setAccountData( account,"EXP",(tostring( getAccountData( account,"EXP" ) ) or 0 )+ randVal outputChatBox("#FF0000={#FFFFFFWin#FF0000}= #FFFFFFYou have earned #FF0000250 #FFFFFF$ and some EXP!", source, 255, 255, 255, true) end end end