-
Posts
4,121 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Kenix
-
function CreateZombie () local allzombies = getElementsByType ( "ped" ) if newZombieLimit ~= false then if (table.getn( allzombies ) < newZombieLimit ) and (zombies_activated == 1) then local zombiespawns = { } local possiblezombies = getElementsByType ( "Zombie_spawn" ) local allplayers = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(allplayers) do local Px, Py, Pz = getElementPosition( thePlayer ) for ZombKey,theZomb in ipairs(possiblezombies) do local Zx, Zy, Zz = getElementPosition( theZomb ) local distance = (getDistanceBetweenPoints3D( Px, Py, Pz, Zx, Zy, Zz )) if (distance < 8) then table.remove( possiblezombies, ZombKey) --IF SPAWN IS TOO CLOSE TO ANY PLAYER end end end for theKey,thePlayer in ipairs(allplayers) do local Px, Py, Pz = getElementPosition( thePlayer ) for ZombKey2,theZomb2 in ipairs(possiblezombies) do local Zx, Zy, Zz = getElementPosition( theZomb2 ) local distance = (getDistanceBetweenPoints3D( Px, Py, Pz, Zx, Zy, Zz )) if (distance < 60) then --AS LONG AS THE SPAWN IS CLOSE ENOUGH TO A PLAYER table.insert( zombiespawns, theZomb2 ) end end end if (table.getn( zombiespawns ) >1 ) then local random = math.random ( 1, table.getn ( zombiespawns ) ) local posX = getElementData(zombiespawns[random], "posX") local posY = getElementData(zombiespawns[random], "posY") local posZ = getElementData(zombiespawns[random], "posZ") local rot = getElementData(zombiespawns[random], "rotZ") local randomZskin = math.random ( 1, table.getn ( ZombiePedSkins ) ) local zomb = createPed( tonumber( ZombiePedSkins[randomZskin] ), posX, posY, posZ ) setElementInterior( zomb,4 ) -- 4 for example setElementData(zomb, "zombie", true) setTimer ( function (zomb) if ( isElement ( zomb ) ) then setElementData ( zomb, "zombie", true ) end end, 200, 1, zomb ) setTimer ( function (zomb, rot) if ( isElement ( zomb ) ) then setPedRotation ( zomb, rot ) end end, 500, 1, zomb, rot ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then setPedAnimation ( zomb, "ped", "run_old", -1, true, true, true ) end end, 1000, 1, zomb ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then setElementData ( zomb, "status", "idle" ) end end, 3000, 1, zomb ) triggerClientEvent ( "Zomb_STFU", getRootElement(), zomb ) else if AllowRandSpawn == true then local xcoord = 0 local ycoord = 0 local xdirection = math.random(1,2) if xdirection == 1 then xcoord = math.random(15,40) else xcoord = math.random(-40,-15) end local ydirection = math.random(1,2) if ydirection == 1 then ycoord = math.random(15,40) else ycoord = math.random(-40,-15) end if (table.getn( allplayers ) > 0 ) then local prandom = math.random ( 1, table.getn ( allplayers ) ) local tplayer = allplayers[prandom] if isElement(tplayer) then triggerClientEvent ( "Spawn_Placement", tplayer, ycoord, xcoord ) end else setTimer ( CreateZombie, 3000, 1 ) --IF NO SPAWNS AVAILABLE, TRY AGAIN IN 3 SECONDS end end end end end end or you can modified edf
-
exports.scoreboard:addScoreboardColumn("JOB",root,1,1.05) Solidsnake14:Read https://wiki.multitheftauto.com/wiki/Scoreboard
-
I mean if skin does not fit the player call function removePedFromVehicle And i tested my last script and it working why rublisk19 you say it not working?
-
Charlie_Jefferson,You can also replace with timer: function replacevehs () dustertxd = engineLoadTXD ( "txd/rancher.txd" ) engineImportTXD ( dustertx, 489 ) dusterdff = engineLoadDFF ( "dff/rancher.dff", 489 ) engineReplaceModel ( dusterdff, 489 ) d1310txd = engineLoadTXD( "txd/admiral.txd" ) engineImportXD ( d1310txd, 445 ) d1310dff = engineLoadDFF ( "dff/admiral.dff", 445 ) engineReplaceModel ( d1310dff, 445 ) bmwm5e34txd = engineLoadTXD ( "txd/sentinel.txd" ) engineImportTXD ( bmwm5e34txd, 405 ) bmwm5e34dff = engineLoadDFF ( "dff/sentinel.dff", 405 ) engineReplaceModel ( bmwm5e34dff, 405 ) trabant601txd = engineLoadTXD ( "txd/stallion.txd" ) engineImportTXD ( trabant601txd, 439 ) trabant601dff = engineLoadDFF ( "dff/stallion.dff", 439 ) engineReplaceModel ( trabant601dff, 439 ) rangerovertxd = engineLoadTXD ( "txd/huntley.txd" ) engineImportTXD ( rangerovertxd, 579 ) rangeroverdff = engineLoadDFF ( "dff/huntley.dff", 579 ) engineReplaceModel ( rangeroverdff, 579 ) reginatxd = engineLoadTXD ( "txd/regina.txd" ) engineImportTXD ( reginatxd, 479 ) reginadff = engineLoadDFF ( "dff/regina.dff", 479 ) engineReplaceModel ( reginadff, 479 ) perentxd = engineLoadTXD ( "txd/peren.txd" ) engineImportTXD ( perentxd, 404 ) perendff = engineLoadDFF ( "dff/peren.dff", 404 ) engineReplaceModel ( perendff, 404 ) comettxd = engineLoadTXD ( "txd/comet.txd" ) engineImportTXD ( comettxd, 480 ) cometdff = engineLoadDFF ( "dff/comet.dff", 480 ) engineReplaceModel ( cometdff, 480 ) clubtxd = engineLoadTXD ( "txd/club.txd" ) engineImportTXD ( clubtxd, 589 ) clubdff = engineLoadDFF ( "dff/club.dff", 589 ) engineReplaceModel ( clubdff, 589 ) buffalotxd = engineLoadTXD ( "txd/buffalo.txd" ) engineImportTXD ( buffalotxd, 402 ) buffalodff = engineLoadDFF ( "dff/buffalo.dff", 402 ) engineReplaceModel ( buffalodff, 402 ) end setTimer( replacevehs,1000,1 )
-
I tested it too and have same effect.
-
You tested it now?
-
Try and write what output. local timers = { } local policeSkins = { [280] = true, [281] = true, [282] = true, [283] = true, [284] = true, [285] = true, [286] = true } local FireSkins = { [277] = true, [278] = true, [279] = true } local medicSkins = { [274] = true, [275] = true, [276] = true } local policeVehicles = { [598] = true, [596] = true, [597] = true, [599] = true } local FireCars = { [407] = true, [544] = true } local medicCars = { [416] = true } function enterVehicle ( theVehicle, seat, jacked ) if ( not policeVehicles[ getElementModel ( theVehicle ) ] and not FireCars[ getElementModel ( theVehicle ) ] and not medicCars[ getElementModel ( theVehicle ) ] ) then removePedFromVehicle ( source ) return end if ( policeVehicles[ getElementModel ( theVehicle ) ] ) and ( policeSkins[ getElementModel ( source ) ] ) then timers[source] = setTimer( payThePlayer,60000,0,source ) elseif ( FireCars[ getElementModel ( theVehicle ) ] ) and ( FireSkins[ getElementModel ( source ) ] ) then timers[source] = setTimer( payThePlayer1,60000,0,source ) elseif ( medicCars [getElementModel ( theVehicle ) ] ) and ( medicSkins[ getElementModel ( source ) ] ) then timers[source] = setTimer( payThePlayer2,60000,0,source ) else removePedFromVehicle ( source ) -- force the player out of the vehicle outputChatBox("You're not allowed to use this vehicle", source) end end addEventHandler ( "onPlayerVehicleEnter", root, enterVehicle ) addEventHandler("onPlayerQuit",root, function( ) if isTimer( timers[source] ) then killTimer( timers[source] ) end timers[source] = nil end ) function exitVehicle() if isTimer( timers[source] ) then killTimer( timers[source] ) end timers[source] = nil end addEventHandler ( "onPlayerVehicleExit", root, exitVehicle ) function payThePlayer( thePlayer ) if not isElement( thePlayer ) then if isTimer( timers[thePlayer] ) then killTimer( timers[thePlayer] ) end return end setElementData( thePlayer,"MONEY",tonumber( getElementData(thePlayer, "MONEY" ) )+180 ) outputChatBox ( "Jus gavote alga 180Lt!", thePlayer ) end function payThePlayer1( thePlayer ) if not isElement( thePlayer ) then if isTimer( timers[thePlayer] ) then killTimer( timers[thePlayer] ) end return end setElementData( thePlayer,"MONEY",tonumber( getElementData( thePlayer, "MONEY" ) )+380 ) outputChatBox ( "Jus gavote alga 380Lt!", thePlayer ) end function payThePlayer2( thePlayer ) if not isElement( thePlayer ) then if isTimer( timers[thePlayer] ) then killTimer( timers[thePlayer] ) end return end setElementData( thePlayer,"MONEY",tonumber( getElementData( thePlayer, "MONEY" ) )+580 ) outputChatBox ( "Jus gavote alga 580Lt!", thePlayer ) end p.s idk why it not work for you..
-
Try local theMarker = createMarker ( 2467.8647460938, -1648.7094726563, 12.47255897522, "cylinder", 1, 255, 255, 0, 170 ) function mission1MarkerHit( element,matchingDimension ) if matchingDimension and getElementType( element ) == "player" then triggerClientEvent ( element, "showMission1", element ) end end addEventHandler("onMarkerHit",theMarker,mission1MarkerHit ) -- maybe you this too needed if not remove function mission1MarkerLeave( element,matchingDimension ) if matchingDimension and getElementType( element ) == "player" then triggerClientEvent ( element, "unshowMission1", element ) end end addEventHandler("onMarkerLeave",theMarker,mission1MarkerLeave ) addEvent("rejectTheMission", true) addEventHandler("rejectTheMission", root, function () triggerClientEvent ( source, "unshowMission1", source ) end ) addEvent("acceptTheMission", true) addEventHandler("acceptTheMission", root, function() triggerClientEvent ( source, "unshowMission1", source ) end )
-
No problem dude!
-
i update post read.
-
So you trigger all in root https://wiki.multitheftauto.com/wiki/Element_tree triggerClientEvent("onSpawn2", getRootElement()) replace with: triggerClientEvent( thePlayer,"onSpawn2",thePlayer ) or if thePlayer nil ( idk thePlayer is empty not used argument in your function i not see how you trigger event "evenTeams" and what is source in your event( player,ped or something ) ) triggerClientEvent( source,"onSpawn2",source ) and replace function spawnHerePlayer(source) fadeCamera(source, true) spawnPlayer(source, 0,0,5) setCameraTarget(source) setElementModel(source, 22) end addEvent("spawnHerePlayer", true) addEventHandler("spawnHerePlayer", getRootElement(), spawnHerePlayer) with this function spawnHerePlayer( ) fadeCamera( source, true ) spawnPlayer( source, 0,0,5 ) setCameraTarget( source ) setElementModel( source, 22 ) end addEvent( "spawnHerePlayer", true ) addEventHandler( "spawnHerePlayer",root, spawnHerePlayer ) if it not working show how you trigger event "evenTeams" or send me in pm your resource.
-
Please show full your client side.
-
Try function bomb( ) fadeCamera(source, true) spawnPlayer(source, 0,0,5) setCameraTarget(source) setElementModel(source, 1) end addEvent("bomb", true) addEventHandler("bomb", getRootElement(), bomb)
-
https://wiki.multitheftauto.com/index.ph ... sues_-_FAQ
-
https://wiki.multitheftauto.com/wiki/SetCameraMatrix + https://wiki.multitheftauto.com/wiki/OnClientPreRender
-
GanJaRuleZ,Please show your server side script.
-
Full code server: local timers = { } local policeSkins = { [280] = true, [281] = true, [282] = true, [283] = true, [284] = true, [285] = true, [286] = true } local FireSkins = { [277] = true, [278] = true, [279] = true } local medicSkins = { [274] = true, [275] = true, [276] = true } local policeVehicles = { [598] = true, [596] = true, [597] = true, [599] = true } local FireCars = { [407] = true, [544] = true } local medicCars = { [416] = true } function enterVehicle ( theVehicle, seat, jacked ) if ( policeVehicles[ getElementModel ( theVehicle ) ] ) and ( policeSkins[ getElementModel ( source ) ] ) then timers[source] = setTimer( payThePlayer,60000,0,source ) elseif ( FireCars[ getElementModel ( theVehicle ) ] ) and ( FireSkins[ getElementModel ( source ) ] ) then timers[source] = setTimer( payThePlayer1,60000,0,source ) elseif ( medicCars [getElementModel ( theVehicle ) ] ) and ( medicSkins[ getElementModel ( source ) ] ) then timers[source] = setTimer( payThePlayer2,60000,0,source ) else removePedFromVehicle ( source ) -- force the player out of the vehicle outputChatBox("You're not allowed to use this vehicle", source) end end addEventHandler ( "onPlayerVehicleEnter", root, enterVehicle ) addEventHandler("onPlayerQuit",root, function( ) if isTimer( timers[source] ) then killTimer( timers[source] ) end timers[source] = nil end ) function payThePlayer( thePlayer ) if not thePlayer then if isTimer( timers[thePlayer] ) then killTimer( timers[thePlayer] ) end return end setElementData( thePlayer,"MONEY",tonumber( getElementData(thePlayer, "MONEY" ) )+180 ) outputChatBox ( "Jus gavote alga 180Lt!", thePlayer ) end function payThePlayer1( thePlayer ) if not thePlayer then if isTimer( timers[thePlayer] ) then killTimer( timers[thePlayer] ) end return end setElementData( thePlayer,"MONEY",tonumber( getElementData( thePlayer, "MONEY" ) )+380 ) outputChatBox ( "Jus gavote alga 380Lt!", thePlayer ) end function payThePlayer2( thePlayer ) if not thePlayer then if isTimer( timers[thePlayer] ) then killTimer( timers[thePlayer] ) end return end setElementData( thePlayer,"MONEY",tonumber( getElementData( thePlayer, "MONEY" ) )+580 ) outputChatBox ( "Jus gavote alga 580Lt!", thePlayer ) end
-
Read https://wiki.multitheftauto.com/wiki/Scr ... troduction
-
Client side: function Markerhit ( hitPlayer, matchingDimension ) outputChatBox ( getPlayerName( hitPlayer ) .. "Get a Combat Shotgun!! RUN!!" ) triggerServerEvent( "giveWeapon",hitPlayer ) setPedDoingGangDriveby ( hitPlayer, true ) end addEventHandler ( "onClientMarkerHit", root, MarkerHit ) Server side: addEvent( "giveWeapon",true) addEventHandler( "giveWeapon",root, function( ) giveWeapon ( source, 27, 21 ) end ) giveWeapon is server side function. https://wiki.multitheftauto.com/wiki/Scr ... troduction
-
isTransferBoxActive not working if you downloading. But if you restart resource isTransferBoxActive needed or write warning with textDisplayRemoveObserver ( serverDisplay is nil ) . This is better: local timer = setTimer( function( ) if not isTransferBoxActive( ) then triggerServerEvent( "onClientSend",localPlayer ) killTimer( timer ) end end, 1000, 2 ) Remember operator "not" is if function return nil or false. This is better than to check the value.
-
http://lua-users.org/wiki/LuaCompilerInLua