-
Posts
2,947 -
Joined
-
Last visited
Everything posted by JR10
-
Example: for i, mine in ipairs(getElementsByType("mine")) do local posX, posY, posZ = getElementData(mine, "posX"), getElementData(mine, "posY"), getElementData(mine, "posZ") local rotX, rotY, rotZ = getElementData(mine, "rotX"), getElementData(mine, "rotY"), getElementData(mine, "rotZ") --createObject(model, posX, posY, posZ, rotX, rotY, rotZ) end
-
addEventHandler ("onClientPlayerDamage",getRootElement(), function (attacker,weapon,bodypart) if bodypart == 9 then if weapon == 24 or weapon == 31 or weapon == 34 then local x,y,z = getElementPosition(source) local sound = playSound ("sounds/headshot.mp3",false) setSoundVolume (sound,4) setGameSpeed (0.25) fxAddBlood (x,y,z+0.8,0,0,0,500) setPedHeadless (source,true) end end end) function giveBackHead() setPedHeadless(getLocalPlayer(), false) setElementHealth (getLocalPlayer(),0) setTimer (setGameSpeed,2000,1,1) end addCommandHandler("headmeup", giveBackHead)
-
Add new groups to the ACL, and make a new acl, add it to the group. Make a new right, like "general.canSpawnCar", and in script check if object have permission to that right.
-
function onResourceStart() door = createObject(3095,1279.9134521484,-2054.0205078125,62.628402709961,0,271.07666015625,0) x,y,z = getElementPosition(door) end addEventHandler("onResourceStart", resourceRoot, onResourceStart) function move(thePlayer,cmd) if ( z == 62.628402709961 ) then moveObject ( door, 10000, x, y, z + 10 ) else outputChatBox("Door is already open",thePlayer,0,255,0,true) end end addCommandHandler ( "dooropen", move) function movez(thePlayer,cmd) if ( z == 72.628402709961 ) then moveObject ( door, 10000, x, y, z - 10 ) outputChatBox("Door is already closed",thePlayer,0,255,0,true) else end end addCommandHandler ( "doorclose", movez)
-
This article needs checking for the following reason: Numberplates only seem to work for some vehicles, and then only for the front or rear plate only That's on createVehicle wiki page.
-
if (getPlayerTeam == 0) then This is wrong. getPlayerTeam will return a team element, so it must be compared with a team element. example: local Members = getTeamFromName("Members") if getPlayerTeam == Members Or: if getTeamName(getPlayerTeam) == "Members" then Same but in another way.
-
That's because he ADDED it. addEvent ( "onCustomPlayerJoin" )
-
I don't understand, you want to make a new teams system? Then make your own functions. here: MTA teams system functions: countPlayersInTeam createTeam getPlayersInTeam getPlayerTeam getTeamColor getTeamFriendlyFire getTeamFromName getTeamName setPlayerTeam setTeamColor setTeamFriendlyFire setTeamName
-
local makes the variable exist only in it's block. So in this case object1 will exist only in: addEventHandler("onClientResourceStart", resourceRoot, function() local st3reotxd1 = engineLoadTXD("st3reo3458.txd") engineImportTXD( st3reotxd1, 3458 ) local st3reotxd2 = engineLoadTXD("st3reo8838.txd") engineImportTXD( st3reotxd2, 8838 ) local st3reotxd3 = engineLoadTXD("st3reo5848.txd") engineImportTXD( st3reotxd3, 5848 ) Marker[1] = createMarker(5137.5, -57.07, 1.2, "corona", 5, 0, 0, 0) local object1 = createObject ( 3458, 5137.5068359375, -54.855049133301, -1.2999992370605, 0, 0, 90 ) setWeather(0) setSkyGradient() setCloudsEnabled ( false ) end ) So you must make it global to use it anywhere outside the code above.
-
Try this: local Profile_Window local Profile_Cancel local Profile_Search local Profile_Label local Profile_image local Profile_SearchB local Profile_ShowProfile local Profile_ShowProfile_Label local Profile_ShowProfile_Avatar local Profile_ShowProfile_Like local Profile_ShowProfile_Cancel local Profile_Data = { } -- code function returnProfileInformation( name, value ) outputChatBox( name ) outputChatBox( value ) Profile_Data[ name ] = value outputChatBox( "I have been called!" ) end
-
Then post the whole code.
-
Did u add the txd's and dff's to the meta like this: meta.xml: <file src="newModels/sign.txd" /> <file src="newModels/sign1.dff" /> <file src="newModels/sign2.dff" />
-
It's being cancelled(Stops because of an error) Because you didn't declare Profile_Data as a table like this: function returnProfileInformation( name, value ) outputChatBox( name ) outputChatBox( value ) Profile_Data = {} Profile_Data[ name ] = value outputChatBox( "I have been called!" ) end If you want to define a table use this: theTable = {}
-
viewtopic.php?f=13&t=29363
-
Not a bug. local variables exists only inside the block (function or w/e it's in) So here: local root = getRootElement() local this = getThisResource() local resourceRoot = getResourceRootElement(this) local localPlayer = getLocalPlayer() local Marker = {} addEventHandler("onClientResourceStart", resourceRoot, function() local st3reotxd1 = engineLoadTXD("st3reo3458.txd") engineImportTXD( st3reotxd1, 3458 ) local st3reotxd2 = engineLoadTXD("st3reo8838.txd") engineImportTXD( st3reotxd2, 8838 ) local st3reotxd3 = engineLoadTXD("st3reo5848.txd") engineImportTXD( st3reotxd3, 5848 ) Marker[1] = createMarker(5137.5, -57.07, 1.2, "corona", 5, 0, 0, 0) object1 = createObject ( 3458, 5137.5068359375, -54.855049133301, -1.2999992370605, 0, 0, 90 ) setWeather(0) setSkyGradient() setCloudsEnabled ( false ) end ) addEventHandler("onClientResourceStop", resourceRoot, function(res) setWeather (0) setWaveHeight ( 0 ) setSkyGradient( 0, 0, 0, 0, 0, 0) setCloudsEnabled ( false ) end end ) addEventHandler("onClientMarkerHit", root, function(player, matchingDimension) if not matchingDimension then return end if player == localPlayer and isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) if source == Marker[1] then moveObject ( object1, 3000, 5137.5068359375, 146.6568145752, -1.2999992370605) end end end )
-
You are right, i forgot the 360.
-
Hmm, -- CLIENT SIDE local sX, sY = guiGetScreenSize() local locplayer = getLocalPlayer() addEventHandler("onClientPreRender", root, function() local x, y, z = getWorldFromScreenPosition(sX/2, sY/2, 10) local px, py, pz = getElementPosition(locplayer) setElementRotation(locplayer, 0, 0, findRotation(px, py, x, y)) 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
-
You are right, my bad.
-
server: function randomize() alive = getAlivePlayers() if (#alive > 0) then random = math.random(#alive) random = alive[random] g_V = getPedOccupiedVehicle(random) if g_V then triggerClientEvent ( "onBomb", getRootElement(), random, g_V) outputChatBox("Airstrike is coming to"..getPlayerName(random), getRootElement(), 0, 255, 0, false) end end setTimer(randomize, 30000, 0) client function bomb(target, g_V) x, y, z = getElementPosition(g_V) rotX,rotY,rotZ = getElementRotation(g_V) createProjectile(target, 21, x,y,z + 3, 200,target,rotX,rotY,rotZ) end addEvent("onBomb",true) addEventHandler("onBomb",getRootElement(),bomb) Both can achieve what he wants.
-
g_V is only defined server side, Try this: Server side function randomize() alive = getAlivePlayers() if (#alive > 0) then random = math.random(#alive) random = alive[random] g_V = getPedOccupiedVehicle(random) if g_V then setElementID(g_V, "bombedVehicle") triggerClientEvent ( "onBomb", getRootElement()) outputChatBox("Airstrike is coming to"..getPlayerName(random), getRootElement(), 0, 255, 0, false) end end setTimer(randomize, 30000, 0) Client side: function bomb() local g_V = getElementByID("bombedVehicle") x, y, z = getElementPosition(g_V) rotX,rotY,rotZ = getElementRotation(g_V) target = random createProjectile(target, 21, x,y,z + 3, 200,target,rotX,rotY,rotZ) end addEvent("onBomb",true) addEventHandler("onBomb",getRootElement(),bomb)