-
Posts
2,947 -
Joined
-
Last visited
Everything posted by JR10
-
If you mean the syntax then yes.
-
There's a postGUI parameter that you can use to draw on top of GUI elements. https://wiki.multitheftauto.com/wiki/DxDrawText
-
You can use the ALTER statement. http://www.w3schools.com/sql/sql_alter.asp
-
You're missing a 'then' at line 5, as the error suggests. addEvent ( "onZombieWasted", true ) addEventHandler ( "onZombieWasted", root, function ( theKiller ) local h = getTime() if h > 20 or h < 6 if theKiller then addPlayerEXP( theKiller, math.random(120, 200 )) else addPlayerEXP( theKiller, math.random(30, 60 )) end end end )
-
Stop posting multiple times asking for help, it will get you banned. Try this: local guards = {} function moveGuard() table.insert(guards, source) addEventHandler('onClientPedDamage', source, function(attacker) if attacker == localPlayer then cancelEvent() end end) end addEvent("moveGuard",true) addEventHandler ("moveGuard", getRootElement(), moveGuard) function followPlayer() for index, guard in pairs(guards) do if (not isElement(guard) or isPedDead(guard)) then table.remove(guards, index) else local int, dim = getElementInterior(localPlayer), getElementDimension(localPlayer) local tint, tdim = getElementInterior(guard), getElementDimension(guard) if (int ~= tint) then setElementInterior(guard, int) end if (dim ~= tdim) then setElementDimension(guard, dim) end local x, y, z = getElementPosition(localPlayer) local tx, ty, tz = getElementPosition(guard) local dis = getDistanceBetweenPoints2D (x, y, tx, ty) setPedRotation(guard, findRotation(tx, ty, x, y)) if (dis > 2) then setPedControlState(guard, 'forwards', true) else setPedControlState(guard, 'forwards', false) end if (dis > 4) then setPedControlState(guard, 'sprint', true) else setPedControlState(guard, 'sprint', false) end end end end addEventHandler('onClientPreRender', root, followPlayer) 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 local target addEventHandler ("onClientPlayerDamage", localPlayer, function(attacker) if (isElement(attacker) and getElementType(attacker) == 'ped' and getElementData(attacker, 'zombie') and #guards > 0) then -- He's a zombie target = attacker removeEventHandler('onClientPreRender', root, followPlayer) addEventHandler('onClientRender', root, aimForTarget) end end) function aimForTarget() if (#guards == 0) then removeEventHandler('onClientRender', root, aimForTarget) addEventHandler('onClientPreRender', root, followPlayer) return end if (not isElement(target) or isPedDead(target)) then for index, guard in pairs(guards) do if (isElement(guard)) then setPedControlState(guard, 'fire', false) end end removeEventHandler('onClientRender', root, aimForTarget) addEventHandler('onClientPreRender', root, followPlayer) return end local ax, ay, az = getElementPosition(target) local x, y, z = getElementPosition(localPlayer) local bx, by, bz = getPedBonePosition(target, 1) for index, guard in pairs(guards) do local tx, ty, tz = getElementPosition(guard) local targetDis = getDistanceBetweenPoints3D (tx, ty, tz, ax, ay, az) local weapon = getPedWeaponSlot (guard) if (targetDis > 20) and (weapon == 30) then if (not isElement(guard) or isPedDead(guard)) then table.remove(guards, guard) return end setPedRotation(guard, findRotation(tx, ty, x, y)) setPedAimTarget(guard, bx, by, bz) setPedControlState(guard, 'fire', true) else setPedRotation (guard, findRotation(ax, ay, az)) setPedAimTarget(guard, bx, by, bz, false) setPedControlState(guard, 'fire', false) end if (targetDis > 15) and (weapon == 22) then if (not isElement(guard) or isPedDead(guard)) then table.remove(guards, guard) return end setPedRotation(guard, findRotation(tx, ty, x, y)) setPedAimTarget(guard, bx, by, bz) setPedControlState(guard, 'fire', true) else setPedRotation (guard, findRotation(ax, ay, az)) setPedAimTarget(guard, bx, by, bz, false) setPedControlState(guard, 'fire', false) end end end
-
Where is g_Settings.GaugePosition defined?
-
His code is different. He changed the event name to what it should be. Also remove the true from addEvent; it doesn't need remote trigger. Here's the line that triggers the event in race_server.lua from the race gamemode: triggerEvent('onPlayerPickUpRacePickup', source, pickupID, pickup.type, pickup.vehicle) If you haven't tried WhoAmI's code then try it, but remove the true from addEvent. Like this: addEvent ( "onPlayerPickUpRacePickup" ) addEventHandler ( "onPlayerPickUpRacePickup", getRootElement(), function ( pickupID, pickupType, vehicleModel ) if ( pickupType == "vehiclechange" ) then loadVehicleColor ( source ) outputChatBox ( "loadVehicleColor for ".. tostring ( getPlayerName ( source ) ) ) end end
-
The script will only work when a zombie damages you, so blocking the zombie will not trigger the event. You easily describe your issues, but you don't put any effort in trying to fix them. You need the guard to stop hitting the zombie if he moves too far, don't you know about getDistanceBetweenPoints3D? You don't try to solve your issues, why should we?
-
The export is only server-side. You can still use the synchronized element data to check if the ped is a zombie. local guards = {} function moveGuard() table.insert(guards, source) addEventHandler('onClientPedDamage', source, function(attacker) if attacker == localPlayer then cancelEvent() end end) end addEvent("moveGuard",true) addEventHandler ("moveGuard", getRootElement(), moveGuard) function followPlayer() for index, guard in pairs(guards) do if (not isElement(guard) or isPedDead(guard)) then table.remove(guards, index) else local int, dim = getElementInterior(localPlayer), getElementDimension(localPlayer) local tint, tdim = getElementInterior(guard), getElementDimension(guard) if (int ~= tint) then setElementInterior(guard, int) end if (dim ~= tdim) then setElementDimension(guard, dim) end local x, y, z = getElementPosition(localPlayer) local tx, ty, tz = getElementPosition(guard) local dis = getDistanceBetweenPoints2D (x, y, tx, ty) setPedRotation(guard, findRotation(tx, ty, x, y)) if (dis > 2) then setPedControlState(guard, 'forwards', true) else setPedControlState(guard, 'forwards', false) end if (dis > 4) then setPedControlState(guard, 'sprint', true) else setPedControlState(guard, 'sprint', false) end end end end addEventHandler('onClientPreRender', root, followPlayer) 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 local target addEventHandler ("onClientPlayerDamage", localPlayer, function(attacker) if (isElement(attacker) and getElementType(attacker) == 'ped' and getElementData(attacker, 'zombie') and #guards > 0) then -- He's a zombie target = attacker removeEventHandler('onClientPreRender', root, followPlayer) addEventHandler('onClientRender', root, aimForTarget) end end) function aimForTarget() if (#guards == 0) then removeEventHandler('onClientRender', root, aimForTarget) addEventHandler('onClientPreRender', root, followPlayer) return end if (not isElement(target) or isPedDead(target)) then for index, guard in pairs(guards) do if (isElement(guard)) then setPedControlState(guard, 'fire', false) end end removeEventHandler('onClientRender', root, aimForTarget) addEventHandler('onClientPreRender', root, followPlayer) return end local x, y, z = getElementPosition(target) local bx, by, bz = getPedBonePosition(target, 1) for index, guard in pairs(guards) do if (not isElement(guard) or isPedDead(guard)) then table.remove(guards, guard) return end local tx, ty, tz = getElementPosition(guard) setPedRotation(guard, findRotation(tx, ty, x, y)) setPedAimTarget(guard, bx, by, bz) setPedControlState(guard, 'fire', true) end end
-
You didn't explain anything, we can't help if we don't even know the problem. Explain what happens, if anything is output in /debugscript 3, post it.
-
I've changed it to onClientPedDamage, I missed the fact that you need it for zombies. I also added the exported isPedZombie in the check. Try this: local guards = {} function moveGuard() table.insert(guards, source) addEventHandler('onClientPedDamage', source, function(attacker) if attacker == localPlayer then cancelEvent() end end) end addEvent("moveGuard",true) addEventHandler ("moveGuard", getRootElement(), moveGuard) function followPlayer() for index, guard in pairs(guards) do if (not isElement(guard) or isPedDead(guard)) then table.remove(guards, index) else local int, dim = getElementInterior(localPlayer), getElementDimension(localPlayer) local tint, tdim = getElementInterior(guard), getElementDimension(guard) if (int ~= tint) then setElementInterior(guard, int) end if (dim ~= tdim) then setElementDimension(guard, dim) end local x, y, z = getElementPosition(localPlayer) local tx, ty, tz = getElementPosition(guard) local dis = getDistanceBetweenPoints2D (x, y, tx, ty) setPedRotation(guard, findRotation(tx, ty, x, y)) if (dis > 2) then setPedControlState(guard, 'forwards', true) else setPedControlState(guard, 'forwards', false) end if (dis > 4) then setPedControlState(guard, 'sprint', true) else setPedControlState(guard, 'sprint', false) end end end end addEventHandler('onClientPreRender', root, followPlayer) 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 local target addEventHandler ("onClientPlayerDamage", localPlayer, function(attacker) if (isElement(attacker) and getElementType(attacker) == 'ped' and exports.zombies:isPedZombie(attacker) and #guards > 0) then -- He's a zombie target = attacker removeEventHandler('onClientPreRender', root, followPlayer) addEventHandler('onClientRender', root, aimForTarget) end end) function aimForTarget() if (#guards == 0) then removeEventHandler('onClientRender', root, aimForTarget) addEventHandler('onClientPreRender', root, followPlayer) return end if (not isElement(target) or isPedDead(target)) then for index, guard in pairs(guards) do if (isElement(guard)) then setPedControlState(guard, 'fire', false) end end removeEventHandler('onClientRender', root, aimForTarget) addEventHandler('onClientPreRender', root, followPlayer) return end local x, y, z = getElementPosition(target) local bx, by, bz = getPedBonePosition(target, 1) for index, guard in pairs(guards) do if (not isElement(guard) or isPedDead(guard)) then table.remove(guards, guard) return end local tx, ty, tz = getElementPosition(guard) setPedRotation(guard, findRotation(tx, ty, x, y)) setPedAimTarget(guard, bx, by, bz) setPedControlState(guard, 'fire', true) end end
-
There are several ways, you can use an xml file to list the teams with their colors, and then load it onResourceStart. You can use a database too.
-
Here, tested and worked: local guards = {} function moveGuard() table.insert(guards, source) addEventHandler('onClientPedDamage', source, function(attacker) if attacker == localPlayer then cancelEvent() end end) end addEvent("moveGuard",true) addEventHandler ("moveGuard", getRootElement(), moveGuard) function followPlayer() for index, guard in pairs(guards) do if (not isElement(guard) or isPedDead(guard)) then table.remove(guards, index) else local int, dim = getElementInterior(localPlayer), getElementDimension(localPlayer) local tint, tdim = getElementInterior(guard), getElementDimension(guard) if (int ~= tint) then setElementInterior(guard, int) end if (dim ~= tdim) then setElementDimension(guard, dim) end local x, y, z = getElementPosition(localPlayer) local tx, ty, tz = getElementPosition(guard) local dis = getDistanceBetweenPoints2D (x, y, tx, ty) setPedRotation(guard, findRotation(tx, ty, x, y)) if (dis > 2) then setPedControlState(guard, 'forwards', true) else setPedControlState(guard, 'forwards', false) end if (dis > 4) then setPedControlState(guard, 'sprint', true) else setPedControlState(guard, 'sprint', false) end end end end addEventHandler('onClientPreRender', root, followPlayer) 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 local target addEventHandler ("onClientPlayerDamage", localPlayer, function(attacker) if (isElement(attacker) and getElementType(attacker) == 'player' and #guards > 0) then -- He's a player target = attacker removeEventHandler('onClientPreRender', root, followPlayer) addEventHandler('onClientRender', root, aimForTarget) end end) function aimForTarget() if (#guards == 0) then removeEventHandler('onClientRender', root, aimForTarget) addEventHandler('onClientPreRender', root, followPlayer) return end if (not isElement(target) or isPedDead(target)) then for index, guard in pairs(guards) do if (isElement(guard)) then setPedControlState(guard, 'fire', false) end end removeEventHandler('onClientRender', root, aimForTarget) addEventHandler('onClientPreRender', root, followPlayer) return end local x, y, z = getElementPosition(target) local bx, by, bz = getPedBonePosition(target, 1) for index, guard in pairs(guards) do if (not isElement(guard) or isPedDead(guard)) then table.remove(guards, guard) return end local tx, ty, tz = getElementPosition(guard) setPedRotation(guard, findRotation(tx, ty, x, y)) setPedAimTarget(guard, bx, by, bz) setPedControlState(guard, 'fire', true) end end
-
You should learn the new db* functions. viewtopic.php?f=148&t=38203#p393074
-
What are you talking about? pla is the first argument which is the hitElement.
-
You can use try to position it relative to the resolution: local screenWidth, screenHeight = guiGetScreenSize() local relativeWidth, relativeHeight = screenWidth / 1366, screenHeight / 768 dxDrawText ( hexColorHome..homeName..":"..displayHome, relativeWidth * 1283, relativeHeight * 378, screenWidth, screenHeight, tocolor ( 255, 102, 1, 255 ), relativeWidth * 1.0, "default" , nil, nil, nil, nil, nil, true) dxDrawText ( hexColorVisit..visitName..":"..displayVisit, relativeWidth * 1283, relativeHeight * 398, screenWidth, screenHeight, tocolor ( 255, 0, 0, 255 ), relativeWidth * 1.0, "default", nil, nil, nil, nil, nil, true )
-
Looks very good and unique. Good luck with it!
-
dxDrawText ( hexColorHome..homeName..":"..displayHome, (screenWidth/2)+600, screenHeight-390, screenWidth, screenHeight, tocolor ( 255, 102, 1, 255 ), 1.1, "default-bold" , nil, nil, nil, nil, nil, true) These 2 bolded arguments are the ones you shall edit to get the result you want. Changing the scale to 1.0 and the font to default might help. Try this: dxDrawText ( hexColorHome..homeName..":"..displayHome, (screenWidth/2)+600, screenHeight-390, screenWidth, screenHeight, tocolor ( 255, 102, 1, 255 ), 1.0, "default" , nil, nil, nil, nil, nil, true) dxDrawText ( hexColorVisit..visitName..":"..displayVisit, (screenWidth/2)+600, screenHeight-370, screenWidth, screenHeight, tocolor ( 255, 0, 0, 255 ), 1.0, "default", nil, nil, nil, nil, nil, true )
-
You can use accounts data to save each account's job. onPlayerQuit save his job to his account, onPlayerLogin load the job. setAccountData getAccountData
-
Yes, if you can find the lines that draw that, you can change the scale and the font.
-
There are two arguments in dxDrawText, one specifies the scale and the other specifies the font. dxDrawText
-
This is a quickly written example, it's not tested and may not work, if it outputs any errors then post them. local target addEventHandler ("onClientPlayerDamage", localPlayer, function(attacker) if (isElement(attacker) and getElementType(attacker) == 'player' and #guards > 0) then -- He's a player target = attacker addEventHandler('onClientRender', root, aimForTarget) end end) function aimForTarget() if (#guards == 0) then removeEventHandler('onClientRender', root, aimForTarget) return end if (not isElement(target) or isPedDead(target)) then for index, guard in pairs(guards) do if (isElement(guard)) then setPedControlState(guard, 'fire', false) end removeEventHandler('onClientRender', root, aimForTarget) return end local x, y, z = getPedBonePosition(target, 6) for index, guard in pairs(guards) do if (not isElement(guard)) then table.remove(guards, guard) return end setPedAimTarget(guard, x, y, z) setPedControlState(guard, 'fire', true) end end
-
You forgot about the baseElement in addEventHandler. --Server addEventHandler( "onPlayerLogin", root, function() triggerClientEvent(source, "doEnablePanel", source) end ) addEventHandler( "onPlayerLogout", root, function() triggerClientEvent(source, "doDisablePanel", source) end )
-
I'm not entirely sure what causes the error, but you can use isElement. Try this: local basekapi1 = createObject ( 980, 135.89999389648, 1941.6999511719, 21.10000038147, 0, 0, 0 ) local basekapi2 = createObject ( 980, 134.5, 1941.6999511719, 21.10000038147, 0, 0, 0 ) local marker1 = createMarker( 135.10000610352, 1941.3000488281, 18.39999961853, "cylinder", 10, 255, 255, 255, 0) function kapiac(pla) if isElement(pla) and getElementType ( pla ) == "player" then moveObject(basekapi1, 2000, 135.89999389648, 1941.6999511719, 26.60000038147, 0, 0, 0) moveObject(basekapi2, 2000, 134.5, 1941.6999511719, 26.60000038147, 0, 0, 0) end end addEventHandler( "onMarkerHit", marker1, kapiac )
-
I appreciate the fact that you've tried and posted this tutorial, but, the wiki teaches you the exact same thing. This section needs tutorials that doesn't already exist. But of course, this is only my opinion.