Jump to content

KariiiM

Members
  • Posts

    1,312
  • Joined

  • Last visited

Everything posted by KariiiM

  1. ok, it should be like that function mybase(source) local number = 5 setTimer(function() number = number-1 local myLabel = guiCreateLabel(0, 0, 1, 1,"",true) guiSetText(myLabel, "For "..number.." seconds") if number < 1 then setElementPosition(source, x,y,z) end end, 5000, 1) end addCommandHandler("test", mybase)
  2. x,y,z cordinations aren't defined
  3. Hey fist, Im going to give you an example it's part of my code window = guiCreateWindow( 416, 285, 416, 285, "My Window", false) --creating window we defined it with "window". guiSetVisible (window, false) --making it invisible in case the resource started. guiWindowSetSizable(window,false) --making the window not sizable grid = guiCreateGridList(9, 21, 398, 223, false, window) --creating the gridlist and we define it with "grid" name column1 = guiGridListAddColumn(grid,"Name:",0.35) --creating column item name in gridlist named "grid". column2 = guiGridListAddColumn(grid,"Price:",0.7) --creating column item name in gridlist named "grid". Btn1 = guiCreateButton(10, 248, 154, 28, "Accept", false, window) Btn2 = guiCreateButton(249, 248, 154, 28, "Cancel", false, window)
  4. I checked the link it's a leaked script with leaked pictures already JR10 locked your preview topic and now you creating it again --Old topic https://forum.multitheftauto.com/viewtopic.php?f=91&t=92449
  5. The owner of this gamemode didn't add any data about what you're asking for, he just created a GUI with comboBoxs filled with these names. We Can't add it ?? When i get a free time i can do that
  6. The owner of this gamemode didn't add any data about what you're asking for, he just created a GUI with comboBoxs filled with these names.
  7. What do you mean? You want only gangs take the turfs or what?
  8. It should work, copy the code carefully ! -- Group payout timer function sendTurfPayout ( ) local groupTurfs = { } for i, v in pairs ( turfLocs ) do if ( not groupTurfs [ v.owner ] ) then groupTurfs [ v.owner ] = 0 end if ( not v.attackers ) then groupTurfs [ v.owner ] = groupTurfs [ v.owner ] + 1 end end for i, v in pairs ( getElementsByType ( 'player' ) ) do local g = exports.SAEGGroups:getPlayerGroup ( v ) if ( g and groupTurfs [ g ] and groupTurfs [ g ] > 0 ) then local c = groupTurfs [ g ] * tonumber ( get ( "*PAYOUT_CASH" ) ) exports.SAEGGroups:setGroupBank ( group, exports.SAEGGroups:getGroupBank ( group ) + tostring(c) ) exports.SAEGMessages:sendClientMessage ( "Turfing: Here is $"..tostring(c).." for having "..tostring ( groupTurfs [ g ] ).." turfs ($700/turf)", v, 0, 255, 0 ) end end end setTimer ( sendTurfPayout, (60*tonumber(get("*PAYOUT_TIME")))*1000, 0 )
  9. Where's the turf payment part?
  10. Does this UCP resource have access in the ACL.xml? And please type /debugscript 3 , in game to check errors maybe there's an error that you have no idea about it
  11. You're welcome, About your other problem,I have no idea about your clan bank system so you have to post the code where the issue is exist.
  12. What's your issue or problem that you have to let us know about which example / tutorial would fit you
  13. Copy this code it will works only for Staff team --client.lua in the superman resource where the Command exist. -- Copyright (c) 2008, Alberto Alonso -- -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without modification, -- are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, this -- list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright notice, this -- list of conditions and the following disclaimer in the documentation and/or other -- materials provided with the distribution. -- * Neither the name of the superman script nor the names of its contributors may be used -- to endorse or promote products derived from this software without specific prior -- written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. local Superman = {} -- Settings local ZERO_TOLERANCE = 0.00001 local MAX_ANGLE_SPEED = 6 -- In degrees per frame local MAX_SPEED = 1.0 local EXTRA_SPEED_FACTOR = 1.85 local LOW_SPEED_FACTOR = 0.40 local ACCELERATION = 0.025 local EXTRA_ACCELERATION_FACTOR = 1.8 local LOW_ACCELERATION_FACTOR = 0.85 local TAKEOFF_VELOCITY = 1.75 local TAKEOFF_FLIGHT_DELAY = 750 local SMOKING_SPEED = 1.25 local GROUND_ZERO_TOLERANCE = 0.18 local LANDING_DISTANCE = 3.2 local FLIGHT_ANIMLIB = "swim" local FLIGHT_ANIMATION = "Swim_Dive_Under" local FLIGHT_ANIM_LOOP = false local IDLE_ANIMLIB = "cop_ambient" local IDLE_ANIMATION = "Coplook_loop" local IDLE_ANIM_LOOP = true local MAX_Y_ROTATION = 55 local ROTATION_Y_SPEED = 3.8 -- Static global variables local thisResource = getThisResource() local rootElement = getRootElement() local localPlayer = getLocalPlayer() local serverGravity = getGravity() -- -- Utility functions -- local function isPlayerFlying(player) local data = getElementData(player, "superman:flying") if not data or data == false then return false else return true end end local function setPlayerFlying(player, state) if state == true then state = true else state = false end setElementData(player, "superman:flying", state) end local function iterateFlyingPlayers() local current = 1 local allPlayers = getElementsByType("player") return function() local player repeat player = allPlayers[current] current = current + 1 until not player or (isPlayerFlying(player) and isElementStreamedIn(player)) return player end end function Superman:restorePlayer(player) setPlayerFlying(player, false) setPedAnimation(player, false) setElementVelocity(player, 0, 0, 0) setElementRotation(player, 0, 0, 0) --setPedRotation(player, getPedRotation(player)) setElementCollisionsEnabled(player, true) self:destroySmokeGenerators(player) self.rotations[player] = nil self.previousVelocity[player] = nil end function Superman:createSmokeGenerator(player) local generator = createObject(2780, getElementPosition(player)) setElementCollisionsEnabled(generator, false) setObjectScale(generator, 0) return generator end function Superman:createSmokeGenerators(player) if not self.smokeGenerators[player] then local smokeGenerators = {} smokeGenerators[1] = self:createSmokeGenerator(player) attachElements(smokeGenerators[1], player, 0.75, -0.2, -0.4, -40, 0, 60) smokeGenerators[2] = self:createSmokeGenerator(player) attachElements(smokeGenerators[2], player, -0.75, -0.2, -0.4, -40, 0, -60) self.smokeGenerators[player] = smokeGenerators end end function Superman:destroySmokeGenerators(player) if self.smokeGenerators[player] then for k, v in ipairs(self.smokeGenerators[player]) do destroyElement(v) end self.smokeGenerators[player] = nil end end function angleDiff(angle1, angle2) angle1, angle2 = angle1 % 360, angle2 % 360 local diff = (angle1 - angle2) % 360 if diff <= 180 then return diff else return -(360 - diff) end end local function isElementInWater(ped) local pedPosition = Vector3D:new(getElementPosition(ped)) if pedPosition.z <= 0 then return true end local waterLevel = getWaterLevel(pedPosition.x, pedPosition.y, pedPosition.z) if not isElementStreamedIn(ped) or not waterLevel or waterLevel < pedPosition.z then return false else return true end end local function isnan(x) math.inf = 1/0 if x == math.inf or x == -math.inf or x ~= x then return true end return false end local function getVector2DAngle(vec) if vec.x == 0 and vec.y == 0 then return 0 end local angle = math.deg(math.atan(vec.x / vec.y)) + 90 if vec.y < 0 then angle = angle + 180 end return angle end -- -- Initialization and shutdown functions -- function Superman.Start() local self = Superman -- Register events addEventHandler("onClientResourceStop", getResourceRootElement(thisResource), Superman.Stop, false) addEventHandler("onPlayerJoin", rootElement, Superman.onJoin) addEventHandler("onPlayerQuit", rootElement, Superman.onQuit) addEventHandler("onClientRender", rootElement, Superman.processControls) addEventHandler("onClientRender", rootElement, Superman.processFlight) addEventHandler("onClientPlayerDamage", localPlayer, Superman.onDamage, false) addEventHandler("onClientElementDataChange", rootElement, Superman.onDataChange) addEventHandler("onClientElementStreamIn", rootElement, Superman.onStreamIn) addEventHandler("onClientElementStreamOut", rootElement, Superman.onStreamOut) -- Bind keys bindKey("jump", "down", Superman.onJump) -- Register commands addCommandHandler("superman", Superman.cmdSuperman) -- Initializate attributes self.smokeGenerators = {} self.rotations = {} self.previousVelocity = {} end addEventHandler("onClientResourceStart", getResourceRootElement(thisResource), Superman.Start, false) function Superman.Stop() local self = Superman setGravity(serverGravity) -- Restore all players animations, collisions, etc for player in iterateFlyingPlayers() do self:restorePlayer(player) end end -- -- Join/Quit -- function Superman.onJoin(player) local self = Superman local player = player or source setPlayerFlying(player, false) end function Superman.onQuit(reason, player) local self = Superman local player = player or source if isPlayerFlying(player) then self:restorePlayer(player) end end -- -- onDamage: superman is invulnerable -- function Superman.onDamage() local self = Superman if isPlayerFlying(localPlayer) then cancelEvent() end end -- -- onStreamIn: Reset rotation attribute for player -- function Superman.onStreamIn()
  14. there's no function named isPlayerInTeamTurfing you have to get player team and check it if equal to Criminal team or any team name you want Now only criminal team is able to turf ,copy the code carefully. local _setElementData = setElementData function setElementData ( element, group, value ) return _setElementData ( element, group, value, true ) end local turfLocs = { } function createTurf ( x, y, z, width, height, owner, forcedId ) local owner = tostring ( owner or "server" ) local r, g, b = exports.SAEGGroups:getGroupColor ( owner ) if not r then r = 255 end if not g then g = 255 end if not b then b = 255 end if ( owner == "server" ) then r, g, b = 255, 255, 255 end local rad = createRadarArea ( x, y, width, height, r, g, b, 170, getRootElement ( ) ) local col = createColCuboid ( x, y, z-5, width, height, 35) if ( not forcedId or turfLocs [ id ] ) then id = 0 while ( turfLocs [ id ] ) do id = id + 1 end else id = forcedId end turfLocs[id] = { } turfLocs[id].col = col turfLocs[id].radar = rad turfLocs[id].owner = owner or "server" turfLocs[id].attackers = nil turfLocs[id].attackProg = 0 turfLocs[id].prepProg = 0 setElementData ( turfLocs[id].col, "SAEGTurf:TurfId", id ) setElementData ( turfLocs[id].col, "SAEGTurf:TurffingTable", turfLocs [ id ] ) addEventHandler ( "onColShapeHit", turfLocs[id].col, onColShapeHit ) addEventHandler ( "onColShapeLeave", turfLocs[id].col, onColShapeLeave ) return turfLocs[id]; end function updateTurfGroupColor ( group ) local r, g, b = exports.saeggroups:getGroupColor ( group ) for i, v in pairs ( turfLocs ) do if ( v.owner == group ) then setRadarAreaColor ( v.radar, r, g, b, 120 ) end end end function onColShapeHit ( player ) if ( player and isElement ( player ) and getElementType ( player ) == "player" and not isPedInVehicle ( player ) ) then local gang = exports.saeggroups:getPlayerGroup ( player ) if getTeamName(getPlayerTeam(player)) ~= "Criminal" then outputChatBox("You must be criminal.",255,0,0) return end triggerClientEvent ( player, "SAEGTurfs:onClientEnterTurfArea", player, turfLocs [ id ] ) if ( not gang ) then return exports.SAEGMessages:sendClientMessage ( "You're not in a gang, you cannot turf.", player, 255, 255, 0 ) end local id = tonumber ( getElementData ( source, "SAEGTurf:TurfId" ) ) if ( turfLocs[id].owner == gang ) then return end if ( turfLocs[id].attackers and turfLocs[id].attackers ~= gang ) then return exports.SAEGMessages:sendClientMessage ( "The "..tostring(turfLocs[id].attackers).." gang is already trying to take this turf. Try again later.", player, 255, 0, 0 ) end if ( not turfLocs[id].attackers ) then exports.SAEGMessages:sendClientMessage ( "You have started to prepare a turf war. Find cover, call backup, and wait for it to begin.", player, 255, 255, 0 ) local x, y, z = getElementPosition ( source ) exports.SAEGGroups:outputGroupMessage ( getPlayerName ( player ).." is preparing a turf war with "..tostring(turfLocs[id].owner).." in "..getZoneName(x,y,z)..", "..getZoneName(x,y,z,false).."! Get there to help him, the war will start in 2 minutes!", gang, 255, 255, 0 ) setRadarAreaFlashing ( turfLocs[id].radar, true ) turfLocs[id].attackers = gang turfLocs[id].attackProg = 0 turfLocs[id].prepProg = 0 setElementData ( turfLocs[id].col, "SAEGTurf:TurffingTable", turfLocs [ id ] ) end end end function onColShapeLeave ( player ) if ( player and getElementType ( player ) == "player" ) then triggerClientEvent ( player, "SAEGTurfs:onClientExitTurfArea", player, turfLocs [ getElementData ( source, "SAEGTurf:TurfId" ) ] ) end end setTimer ( function ( ) for id, data in pairs ( turfLocs ) do if ( data.attackers ) then local players = { attackers = { }, owners = { } } local isGangInTurf = false local isOwnerInTurf = false for i, v in pairs ( getElementsWithinColShape ( data.col, "player" ) ) do local g = exports.SAEGGroups:getPlayerGroup ( v ) if ( g == data.attackers ) then isGangInTurf = true table.insert ( players.attackers, v ) elseif ( g == data.owner ) then isOwnerInTurf = true table.insert ( players.owners, v ) end end local x, y, z = getElementPosition ( data.col ) if ( isOwnerInTurf and isGangInTurf ) then exports.SAEGGroups:outputGroupMessage ( "The turf war in "..getZoneName ( x,y,z )..", "..getZoneName ( x,y,z, false ).." is paused due to both gangs in the turf", turfLocs[id].attackers, 255, 255, 255 ) exports.SAEGGroups:outputGroupMessage ( "The turf war in "..getZoneName ( x,y,z )..", "..getZoneName ( x,y,z, false ).." is paused due to both gangs in the turf", turfLocs[id].owner, 255, 255, 255 ) else -- Add Points To Attackers if ( isGangInTurf ) then -- Prep the war if ( turfLocs[id].attackProg == 0 ) then turfLocs[id].prepProg = data.prepProg + 2 if ( turfLocs[id].prepProg >= 100 ) then turfLocs[id].prepProg = 0 turfLocs[id].attackProg = 1 beginTurfWarOnTurf ( id ) end -- Attack War else turfLocs[id].attackProg = turfLocs[id].attackProg + 1 if ( turfLocs[id].attackProg == 100 ) then exports.SAEGGroups:outputGroupMessage ( "Your gang has captured a turf in "..getZoneName ( x,y,z )..", "..getZoneName ( x,y,z, false ).." from the "..turfLocs[id].owner.." gang! Great job!", turfLocs[id].attackers, 0, 255, 0) exports.SAEGGroups:outputGroupMessage ( "Your gang lost a turf in "..getZoneName ( x,y,z )..", "..getZoneName ( x,y,z, false ).." to the "..turfLocs[id].attackers.." gang.", turfLocs[id].owner, 255, 0, 0) setTurfOwner ( id, turfLocs[id].attackers ) end end -- Take points from attackers else -- Prepare war if ( turfLocs[id].attackProg == 0 ) then turfLocs[id].prepProg = data.prepProg - 2 if ( turfLocs[id].prepProg <= 0 ) then exports.SAEGGroups:outputGroupMessage ( "Your gang lost the turf preparation war in "..getZoneName(x,y,z)..", "..getZoneName ( x,y,z, false ).." to the "..turfLocs[id].owner.." gang!", turfLocs[id].attackers, 255, 0, 0 ) exports.SAEGGroups:outputGroupMessage ( "Your gang has defended the turf in "..getZoneName(x,y,z)..", "..getZoneName(x,y,z,false).."!", turfLocs[id].owner..", from the "..turfLocs[id].attackers.." gang, when it was being preped for a war", 0, 255, 0 ) setTurfOwner ( id, turfLocs[id].owner ) end -- Attacking war else turfLocs[id].attackProg = data.attackProg - 1 if ( turfLocs[id].attackProg <= 0 ) then exports.SAEGGroups:outputGroupMessage ( "Your gang lost the turf war in "..getZoneName(x,y,z)..", "..getZoneName ( x,y,z, false ).." to the "..turfLocs[id].owner.." gang!", turfLocs[id].attackers, 255, 0, 0 ) exports.SAEGGroups:outputGroupMessage ( "Your gang has defended the turf in "..getZoneName(x,y,z)..", "..getZoneName(x,y,z,false).." from the "..turfLocs[id].attackers.." gang", turfLocs[id].owner, 0, 255, 0 ) setTurfOwner ( id, turfLocs[id].owner ) end end end end for i, v in pairs ( players ) do for k, p in pairs ( v ) do triggerClientEvent ( p, "SAEGTurfs:upadateClientInfo", p, turfLocs [ id ] ) end end end end end, 800, 0 ) addEvent ( "SAEGTurfs:onTurfProgressChange", true ) --[[ addCommandHandler ( "attackprog", function ( p ) local gangAttacks = { } local g = exports.SAEGGroups:getPlayerGroup ( p ) if ( not g ) then return exports.SAEGMessages:sendclientMessage ( "You're not in a gang", p, 255, 255, 0) end for i, v in pairs ( turfLocs ) do if ( v.attackers and v.attackers == g ) then gangAttacks [ i ] = true end end if ( table.len ( gangAttacks ) == 0 ) then return exports.SAEGMessages:sendClientMessage ( "Your gang isn't involved in any gang wars right now.", p, 255, 255, 0 ) end for id, _ in pairs ( gangAttacks ) do local x ,y, z = getElementPosition ( turfLocs[id].col ) outputChatBox ( "----Turf War Status---", p, 255, 255, 255, false ) outputChatBox ( "Current owner: "..turfLocs[id].owner, p, 255, 255, 255, false ) outputChatBox ( "Attacker: "..turfLocs[id].attackers, p, 255, 255, 255, false ) outputChatBox ( "Prep Progress: "..turfLocs[id].prepProg.."%", p, 255, 255, 255, false ) outputChatBox ( "Attack Progress: "..turfLocs[id].attackProg.."%", p, 255, 255, 255, false ) outputChatBox ( "Turf Location: "..getZoneName ( x, y, z )..", "..getZoneName ( x, y, z, true ), p, 255, 255, 255, false ) outputChatBox ( "Turf Server-ID: "..id, p, 255, 255, 255, false ) end end )]] function table.len ( tb ) local c = 0 for i, v in pairs ( tb ) do c = c + 1 end return c end function beginTurfWarOnTurf ( id ) local d = turfLocs [ id ] local x, y, z = getElementPosition ( d.col ) exports.SAEGGroups:outputGroupMessage ( "Your gang has begun a turf war in "..getZoneName ( x, y, z)..", "..getZoneName ( x, y, z, true ).." against the "..d.owner.." gang! Get there an help!", d.attackers, 255, 255, 0 ) exports.SAEGGroups:outputGroupMessage ( "One of your turfs in "..getZoneName ( x, y, z)..", "..getZoneName ( x, y, z, true ).." is being attacked by the "..d.attackers.." gang!", d.owners, 255, 0, 0 ) setRadarAreaColor ( d.radar, 255, 255, 255, 170 ) end function setTurfOwner ( id, owner ) setRadarAreaFlashing ( turfLocs[id].radar, false ) turfLocs[id].owner = owner turfLocs[id].attackers = nil turfLocs[id].attackProg = 0 local r, g, b = exports.SAEGGroups:getGroupColor ( owner ) setRadarAreaColor ( turfLocs[id].radar, r, g, b, 120 ) saveTurfs ( ) end function getTurfs ( ) return turfLocs end function saveTurfs ( ) for id, data in pairs ( turfLocs ) do exports.NGSQL:db_exec ( "UPDATE turfs SET owner=? WHERE id=?", data.owner, id ) end return true end addEventHandler( "onResourceStart", resourceRoot, function ( ) exports.NGSQL:db_exec ( "CREATE TABLE IF NOT EXISTS turfs ( id INT, owner VARCHAR(50), x FLOAT, y FLOAT, z FLOAT, width INT, height INT )" ) local query = exports.NGSQL:db_query ( "SELECT * FROM turfs" ) if ( #query == 0 ) then local data = { { -1867.8, -107.43, 15.1, 58, 65 }, { -1866.5, -26.36, 15.29, 49, 200 }, { -1811.33, 743.43, 20, 85, 85 }, { -1991.5, 862.62, 34, 79, 42 }, { -2799.25, -200.6, 7.19, 83, 120 }, { -2136.84, 120.12, 30, 120, 190 }, { -2516.52, 718.16, 27.97, 118, 80 }, { -2516.41, 578.19, 16.62, 100, 100 }, { -2596.49, 818.05, 49.98, 59, 80 }, { -2453.17, 947.58, 45.43, 54, 80 }, { -2740.6, 344.59, 4.41, 68, 61 }, { -2696.24, 227.35, 4.33, 39.5, 50.5 },
  15. mtaserver.conf do that too but good job
  16. Do you know why it showing five red points on your screen?,because you didn't make it like an crosshair. Here is a list of crosshairs http://crosshairs.cali-kartell.de But oks, i have another way maybe it fit your problem i just made it for you local width, height = guiGetScreenSize() -- getting the screensize local x, y = width/1360, height/768 --it's my MTA Resolutions addEventHandler("onClientRender", root, function () if getControlState("aim_weapon") then -- checking if the player is aiming dxDrawImage (width-(27*x),height-(27*y),56*x,56*y,"crosshair.png") --it will draw the image in middle of the screen at the crosshair place. end end) --This function for hiding the default crosshair addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), function () setPlayerHudComponentVisible ("crosshair", false ) end) ~Regards KariM
  17. Glad to hear that, you're welcome by the way, what do you mean by this 3rd question, How to make a button that take specifec amount of ammo of X weapon? Which weapon?
  18. You have to script your own topbar system or search for it in the community,then exports it to the math script. I Have My Own TopBar But idk How To exports it ahaha (Karim + JR10 Helpful me Thanx Guys <3 ) Okay then, go to meta.xml of this topbar resource and add the function name who send or put the message. something like that: function="functionname" type="client"/> function="functionname" type="server"/> add the function name to the meta of your topbar resource and be sure your function is in client / server sides after defining the functions in the meta, the question would be ,how to exports the function to other resources? you have two ways to do that exports.resourcename:functionname ("your text",root,200,0,0) or exports['resourcename']:functionname("your text",root,200,0,0) You can also use this way for exporting the functions,by calling the resourcename but it's not usable like these two ways and they do the same job ,it stay your personal choice. call ( getResourceFromName ( "resourcename" ), "functionname", "You were selected!", root, 200,0,0) ~Have fun scripting Regards, KariM
  19. You have to script your own topbar system or search for it in the community,then exports it to the math script.
  20. Just name your picture to crosshair.png and do what i did exactly it's tested and working fine
  21. Glad to hear that next time be carefull !
  22. Lmao,What JR10 wrote for you isn't wrong, you can't wait 2 minutes untill the message output? do you know how to read the codes or just copying / posting? Here's the full code edit the timer with your mili seconds setTimer(function() reward = math.random ( 2000, 5000 ) qn1 = math.random ( 10, 100 ) qn2 = math.random ( 10, 100 ) qn3 = math.random ( 10, 100 ) theQuestion = qn1 + qn2 - qn3 answerTime = setTimer ( noAnswer, 30* 1000, 1 ) outputChatBox ( "Math: First one to answer " .. qn1 .. " + " .. qn2 .. " - " .. qn3 .. " will win $" .. reward, root, 0, 255, 0 ) end, 1000, 0) -- it's 1000 mili seconds, mean each 1second it will output a message , edite it with your choice. function noAnswer ( ) outputChatBox ( "Math: Nobody won the answer was " .. theQuestion, root, 0, 255, 0 ) theQuestion = nil end addEventHandler ( "onPlayerChat", root, function ( answer ) if ( theQuestion and tonumber ( answer ) == theQuestion ) then theQuestion = nil outputChatBox ( "Math: " .. getPlayerName ( source ) .. " #00FF00answered " .. answer .. " and won $" .. reward, root, 0, 255, 0, true ) givePlayerMoney ( source, reward ) if ( isTimer ( answerTime ) ) then killTimer ( answerTime ) end end end )
  23. --Server side: local myTable = { --Creating our table we named it "myTable",now we'll stores on it the datas. --skinID, x, y, z, rotation, weapons {113, -2151.9, -136.9, 36.5, 280, 31}, } addEventHandler("onResourceStart", resourceRoot, function () --No need to define any source in this function since we are using onResourceStart event. for index, v in pairs(myTable) do --Now, we have to loop the datas from "myTable" in this situation we need to use ipairs but no matter if we used pairs in this case too local ped = createPed (v[1], v[2], v[3], v[4], v[5]) local blip = createBlip( v[2], v[3], v[4], 34, 2, 0, 0, 255 ) setElementVisibleTo(blip, root, true) --we make the blip visible for all players setElementData(ped, "myped", true) --we stock the ped with the key "myped" for getting it later giveWeapon( ped, v[6], 9999, true ) setElementFrozen ( ped, true ) setTimer(setPedAnimation, 3000, 0, ped,"ped", "WOMAN_walknorm") --we set the animation to the defined Ped "ped", adding unlimited time each 3secs the animation will be refreshed. end end) --Client side: addEventHandler("onClientPedDamage",getRootElement(), --This event is for when the ped get damages function () if getElementData(source,"myped") then --Now we recovering the ped from the data cancelEvent() --we cancel the event to cancel any damages hit our ped end end) ~Have fun scripting Regards, KariM
×
×
  • Create New...