-
Posts
732 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Bean666
-
hello i downloaded a sniperNPC resource is it possible that there will be a teamname called "Military" that they won't attack? client.lua: function isMyPingTheLowest() local players = getElementsByType("player") local yes = true for i, player in ipairs(players) do if getPlayerPing(getLocalPlayer()) > getPlayerPing(player) then yes = false end end if yes == true then return true else return false end end function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end return t end addEventHandler("onClientPedDamage", getRootElement(), function(attacker) if getElementData(source, "type") == "ped.sniper.npc" and getElementData(attacker, "type") == "ped.sniper.npc" then cancelEvent() end end ) setTimer( function() if isMyPingTheLowest() then for i, peds in ipairs(getElementsByType("ped")) do if getElementData(peds, "type") == "ped.sniper.npc" and getElementHealth(peds) > 0 then local x, y, z = getElementPosition(peds) local lowest = nil local player = nil for i, players in ipairs(getElementsByType("player")) do local px, py, pz = getElementPosition(players) if getDistanceBetweenPoints3D(x, y, z, px, py, pz) < 100 then if lowest == nil then lowest = getDistanceBetweenPoints3D(x, y, z, px, py, pz) player = players else if getDistanceBetweenPoints3D(x, y, z, px, py, pz) < lowest then lowest = getDistanceBetweenPoints3D(x, y, z, px, py, pz) player = players end end end end if isElement(player) then triggerServerEvent("sniperTakeDecision", getRootElement(), peds, player) end end end end end , 1500, 0) addEvent("sniperTakeDecisionClient", true) addEventHandler("sniperTakeDecisionClient", getRootElement(), function(sniperPedID, aimPlayer) local x, y, z = getElementPosition(sniperPedID) local px, py, pz = getElementPosition(aimPlayer) setPedAimTarget(sniperPedID, px, py, pz) local rotZ = findRotation(x, y, px, py) setPedRotation(sniperPedID, rotZ) setPedControlState(sniperPedID, "aim_weapon", true) setPedControlState(sniperPedID, "fire", true) setTimer( function() if isElement(sniperPedID) then setPedControlState(sniperPedID, "fire", false) setPedControlState(sniperPedID, "aim_weapon", false) end end , 500, 1) end ) server.lua: addEvent("sniperTakeDecision", true) addCommandHandler("sniper", function(thePlayer, command) local x, y, z = getElementPosition(thePlayer) local int = getElementInterior(thePlayer) local ped = createSniperPed(x, y, z) setElementInterior(ped, int) end ) setTimer( function() for i, peds in ipairs(getElementsByType("ped")) do if getElementData(peds, "type") == "ped.sniper.npc" and getElementHealth(peds) > 0 then setPedWeaponSlot(peds, 6) giveWeapon(peds, 34, 10000, true) end end end , 50, 0) function createSniperPed(x, y, z) local ped = createPed(285, x, y, z) setTimer( function() if isElement(ped) then giveWeapon(ped, 34, 10000, true) setPedWeaponSlot(ped, 6) setElementData(ped, "type", "ped.sniper.npc") setElementFrozen(ped, true) end end , 5000, 1) return ped end addEventHandler("sniperTakeDecision", getRootElement(), function(sniperPedID, aimPlayer) setElementData(sniperPedID, "target", aimPlayer) triggerClientEvent("sniperTakeDecisionClient", getRootElement(), sniperPedID, aimPlayer) end )
-
does the weapon need to be an ID?
-
hello is it possible that only shotgun , sniper , combat shotgun can make the head go blow? addEvent( "headboom", true ) function Zheadhit ( ped,attacker, weapon, bodypart) if (getElementData (ped, "zombie") == true) then killPed ( ped, attacker, weapon, bodypart ) setPedHeadless ( ped, true ) end end addEventHandler( "headboom", getRootElement(), Zheadhit )
-
i know lua language , this code really works for me . i only need the marker to respawn and i have scripts posted in the community.
-
hey guys is it possible that i can get a guigetscreensize in this code help please: addEventHandler ("onClientResourceStart", resourceRoot, function () fade = 0 end) addEventHandler ("onClientResourceStop", resourceRoot, function () fadeCamera( true, 0 ) end) addEventHandler ("onClientPreRender", root, function () if (getPlayerTeam (localPlayer) and getTeamName (getPlayerTeam (localPlayer)) == "Zombies") then dxDrawImage(0, -1, 1280, 764, ":zombie/images/blood_1.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) setSkyGradient (35, 0, 0) else fadeCamera( true, 0) fade = 0 resetSkyGradient () end end )
-
all works dude , only doesn't work is the respawning marker.
-
full server.lua local players = {} local ticks = {} addEvent("stealstart",true) addEventHandler("stealstart",root, function() if players[ source ] and players[ source ][ 3 ] then return end players[ source ] = {} players[ source ][ 1 ] = setTimer ( outputChatBox, 30000, 1, "You have successfully stolen 50000$ in the bank",source, 255, 0, 0, false) players[ source ][ 2 ] = setTimer ( givePlayerMoney, 30000, 1, source, 50000 ) players[ source ][ 3 ] = setTimer( function( ) end, 100, 1 ) setTimer( function( source ) players[ source ][ 3 ] = nil end, 100, 1, source ) if ( getPlayerMoney (source) >= 0 ) then outputChatBox("You need to wait 30 seconds to get your 50000$ stay in the marker to get the money", source, 255, 0, 0) end end) addEvent("trespass",true) addEventHandler("trespass",root, function() if ticks[ source ] and getTickCount( ) - ticks[ source ] < 1000 then return end ticks[ source ] = getTickCount() if ( getPlayerMoney (source) >= 0 ) then outputChatBox ( "Radio: Someone is robbing the bank! , all police respond immediately!", getRootElement(), 100, 200, 0, true ) end end) function killPlayer( ) outputChatBox ( "Radio: the Robber(s) stopped stealing money!", getRootElement(), 100, 200, 0, true ) for i, v in ipairs( players[ source ] ) do if isTimer( v ) then killTimer( v ) players[ source ][ i ] = nil end end players[ source ] = nil end addEvent( "killplayer", true ) addEventHandler( "killplayer", root, killPlayer )
-
img of problem: here is the line of 30-41 in my server.lua 34 is the killtimer( V ) function killPlayer( ) outputChatBox ( "Radio: the robber stopped stealing money!", getRootElement(), 100, 200, 0, true ) for i, v in ipairs( players[ source ] ) do if isTimer( v ) then killTimer( v ) players[ source ][ i ] = nil end end players[ source ] = nil end addEvent( "killplayer", true ) addEventHandler( "killplayer", root, killPlayer )
-
do i just need to add that code in my client.lua?
-
EDIT: When it creates the marker again, the trigger doesn't work anymore when i step in the new created marker. when i step in the new created marker , nothing happens
-
loading script failed: prison/client.lua:45 unexpected symbol near ')' what should i do
-
this is clientside not server side.
-
any help?
-
tried this but marker doensn't create and marker doesn't appear even tho i restart the script addEventHandler("onElementDestroy", getRootElement(), function (player) if getElementType(source) == "marker" then setTimer ( createElement, 30000, 1, source, bankmarker ) end
-
in elements i'm not good , i really need help on this one.
-
hello i'm currently working on a bankrob script right now but, is it possible when the marker got destroyed by destroyelement , it can recover again? here's my code of client.lua local bankmarker = createMarker( -725.01849, 969.94299, 11.4, "cylinder", 1.5, 255, 0, 0, 255 ) addEventHandler ( "onClientMarkerHit", bankmarker, function ( hitElement ) if ( hitElement == localPlayer and getElementType ( hitElement ) == "player" ) then local playerTeam = getPlayerTeam ( hitElement ) if ( playerTeam and getTeamName ( playerTeam ) == "Criminals" ) then triggerServerEvent ("stealstart",getLocalPlayer(),stealstart) triggerServerEvent ("trespass",getLocalPlayer(),trespass) setTimer ( destroyElement, 30000, 1, source, bankmarker ) end end end )
-
any hand? here's an error i get the line 23 is after the moveobject , the end.
-
hello i need a hand , i kinda tried to lock gates for gang but it doesn't work , the gate doesn't move , here's a code i made that didn't work. function move_at_gate(hitPlayer, matchingDimension) local playerGang = getElementData(hitPlayer) if playerGang then local gangName = getElementData(source, "gang") if gangName == "Alpha Team" then moveObject(at_gate, 2000, -2862.0068359375, 468.7, 11.2, 0, 0, 0) end end end addEventHandler("onMarkerHit", at_marker, move_at_gate)
-
I'm in the Alpha Team gang and still doesnt work , only people in Alpha Team gang can't enter the vehicle but people not in the Alpha Team gang can enter it , e.e
-
BOTH DON'T WORK OMFG.
-
tried this but all can enter: function cars () c1 = createVehicle ( 520, 227.69921875, 1882.142578125, 17.640625, 0, 0, 90 ) end addEventHandler ( "onResourceStart", resourceRoot, cars ) function onEnter(thePlayer) if source == c1 and ( getElementData(source, "gang") == "Alpha Team" ) then outputChatBox("This Vehicle Is Locked for the Class:Admin", thePlayer, 0, 255, 0) cancelEvent() end end addEventHandler("onVehicleStartEnter", root, onEnter)
-
ah nevermind , is there anyway just locked them to a gang? it'll be easier that way.