-
Posts
1,058 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Saml1er
-
It doesn't works in clientside? What exactly doesn't work? and when you added the code then it worked but it stopped working? It worked and stopped working? How? the function healPlayerOnHit doesn't work in clientside, I have changed up the stuff like you told me and it doesn't work, and when i added this code to the function healPlayerOnHit, then the function stopped working properly if not targetCurrentHealth >= 100 then Post your script.
-
It doesn't works in clientside? What exactly doesn't work? and when you added the code then it worked but it stopped working? It worked and stopped working? How?
-
Use: guards = { } function gweaponPed() for k,v in ipairs (guards) do giveWeapon (v,30, 200, true) end end function followPed (thePlayer) local x, y, z = getElementPosition(thePlayer) guard = createPed (240, x + 2, y, z + 1) triggerClientEvent(thePlayer, 'moveGuard', guard) guards[thePlayer] = guard end addCommandHandler ("guard", followPed) function giveGun (source) if not isElement(guards[source]) then outputChatBox ("You have no Guard") else gweaponPed () end end addCommandHandler ("weapon", giveGun) and triggerServerEvent will just trigger the server event it will return no data for client aide in other words it just sends data it doesn't send data back to client side.
-
We understood what you wrote but just think how will newbies understand? They'll use it as if skin == "0" then
-
Try debugging it btw I once experienced the same problem. I don't remember exactly how I got it fixed but MAYBE try replacing line 2 with this: return theTable[math.random (1, #theTable )] and line 24 with this: triggerClientEvent(thePlayer,"Spawned", thePlayer)
-
What this mission timer thing does? set a time for map ? Oh so now I get it, you mean it should start another map after 10 mins. This "custom map" confused me lol.
-
What this mission timer thing does?
-
You made a typo and better use >= just to be sure: local targetCurrentHealth = getElementData () if not targetCurrentHealth >= 100 then I kinda thought of using it but since ped/player health is between 100 so I thought its not needed but anyway still using >= is useful because more checks less chances for script to fail. EDIT: The actual typo was "getElementData" because I wrote it instead of getElementHealth. Fixed it now.
-
I think this is how you get something random from table. local valRandom = DanceTable[ math.random( 1,#DanceTable ) ] setPedAnimation( localPlayer,"DANCING", valRandom ) -- optional ( timers etc )
-
._. Not everyone can be some 'experienced professional' at scripting, besides, I barely even script anyways, I usually play DM Racing and make maps I never said that every one can be professional or experienced. Wiki provides you the most info that's why I suggested you to read wiki. Nothing is hard here, just remove source since we're defining it in event handler and addEventHandler("onPlayerDamage", getRootElement(), healPlayerOnHit_Handler) to addEventHandler("onClientPlayerDamage", getLocalPlayer(), healPlayerOnHit_Handler ) and about the health you asked, just use bonsai's code and add a new line local targetCurrentHealth = getElementHealth() if not == 100 then this script is client side.
-
Please read wiki before you start using functions and events. Wiki says:
-
You need to use XML functions to load a map ( inserting all the functions into table) and unload it ( Deleting elements in table one by one) You probably need to make your own game mode for that or arena I'd say. I made a lobby ( multi game mode ), its not that easy if you're new. The most hard part is loading map scripts and unloading them and I'm pretty sure that you're new so for now you need to learn basics.
-
1# When you use else statement then you can't use if statement again unless you add an "end" statement. 2# its not playerXYZ but in fact its local x,y,z = getElementPosition ( source ) 3# How do you trigger "IfNewPlayerJoin" event? You must use triggerEvent if the player is new 4# This code is a mess, too many errors. I'm on mobile can't help you but I hope someone helps you to fix it.
-
First make some scripts like login panels, user panels etc and post some screens so people can see your work and if they like it then they themself will ask you to work for them but since you don't show anything creative, I'd Say 1000 in your dreams. First prove your scripting skills.
-
Oh come on... Seriously, share the whole function. Just think how am I suppose to tell you what's wrong since I don't know if you're using it with an event handler or command handler? Anyways try /debugscript 3
-
Show the part where you're defining it maybe we can correct you.
-
Its done like this: local mySkin = skins[ math.random( 1,#skins ) ] setElementModel (playerElement, tonumber (mySkin)) onClientRender calls the dx function( can be other function as well) every second or more. To convert 80000 ms into seconds, just divide it by 10000 and it will be converted into seconds. a = 80000/1000 print (a.."s") -- -> 80s
-
Go to MTA> mods > deathmathes. > delete the resources folder. If still no luck then uninstall MTA and delete the root folder. Now reinstall it. This should work since it has helped many people (including me). I also had that screen freeze problem but it got it fixed like that.
-
function DimensionP (player, dimension) if isPedInVehicle (player) then local veh = getPedOccupiedVehicle (player) setElementDimension ( player, dimension ) setElementDimension ( veh, dimension ) else setElementDimension ( player, dimension ) end return true end function checkAFKPlayers() for index, thePlayer in ipairs(getElementsByType("player"))do -- Loop all online players if (getPlayerIdleTime(thePlayer) > 300000) then -- Player hasn't moved for 300,000ms (5 minutes) DimensionP ( thePlayer, 1 ) outputChatBox("AFk Check") end end end setTimer(checkAFKPlayers, 30000, 0)
-
function pCountC() local theTable = { } local players = getElementsByType("player") for i,v in pairs(players) do theTable[#theTable+1]=v end return theTable end function test1( ) local Tplayers = tonumber ( pCountC() ) or 0 if Tplayers > 0 then for _, v in ipairs(getElementsByType("player") do local pData = getElementData ( v, "job") if not pData == "seadelivery" then triggerEvent ( "destroyonleave", localPlayer ) removeEventHandler ( "onClientRender", root, test1 ) end end end end addEventHandler ("onClientResourceStart", resourceRoot, function () addEventHandler ( "onClientRender", root, test1 ) end ) EDIT: Just saw DNL's post btw don't you think a timer would be more good instead calling the function every second or more?
-
thanks You might get the speed in decimal so use this. local kmh = math.ceil (actualspeed * 180 )
-
local speedx, speedy, speedz = getElementVelocity (getPedOccupiedVehicle( localPlayer )) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) local kmh = actualspeed * 180
-
You mean make them invisible? Anyways about the god mode, try this. -- server side addCommandHandler( "afk", function ( thePlayer ) setElementPosition( thePlayer, 1904.8403320313, 717.12438964844, 49.214366912842 ) setElementFrozen ( thePlayer , false ) outputChatBox( "You are now in Afk zone", thePlayer, 0, 255, 0 ) takeAllWeapons ( thePlayer ) setElementData ( thePlayer, "GodO.Health", true ) end ) addCommandHandler( "back", function ( thePlayer ) if isElementFrozen (thePlayer ) then setElementPosition( thePlayer, -2026.7408447266, 156.45680236816, 29.0390625 ) setElementFrozen ( thePlayer , true ) outputChatBox( "You are now Out Afk zone", thePlayer, 255, 0, 0 ) setElementData ( thePlayer, "GodO.Health", nil ) setElementFrozen (thePlayer, false ) end end ) -- client side addEventHandler ("onClientPlayerDamage", getRootElement(), function () if getElementData ( source, "GodO.Health" ) then cancelEvent() end end ) EDIT: I just read wiki and found this. EDIT2: Copy the code again.