-
Posts
367 -
Joined
-
Last visited
Posts posted by AJXB
-
-
You can just make a function rather than making an event since they're both on the server side.
function onZombieWasted (attacker) if (isElement( attacker )) then givePlayerMoney(attacker,math.random(75,150)) -- default 50$ end end function deanimated( ammo, attacker, weapon, bodypart ) if (attacker) then if (getElementType ( attacker ) == "player") and (getElementType ( source ) == "ped") then if (getElementData (source, "zombie") == true) then local oldZcount = getElementData ( attacker, "Zombie kills" ) if oldZcount ~= false then setElementData ( attacker, "Zombie kills", oldZcount+1 ) else setElementData ( attacker, "Zombie kills", 1 ) end onZombieWasted ( attacker ) end end end end addEventHandler("onPedWasted", resourceRoot, deanimated)
You might wanna add a check to the weapon used, to avoid abuse
-
-
-
Line 4 is checking for data related to the player, It's there because the script is taken from another game mode, or considered connected to other scripts.
Replace line 4 with this line and post any errors you have
if (isElement( thePlayer )) then
Next time, please write your own code
-
How about you show us how are you triggering that event?
-
createMarker() math.random() createVehicle() warpPedIntoVehicle() -- You can find examples on community.multitheftauto.com
-
Did you verify all that
getElementData()
you're doing on line 4 ?
-
16 hours ago, Khadeer143 said:
What's the use of this ? Its just a forum nothing else
It's even more useless than a forum, it's just a theme
12 hours ago, iSubvibe said:Its Invision Power Suit IPS.
And how much are you thinking this is worth?
-
Off-topic: Activate Windows
On-topic: You might wanna elaborate, at least tell us what forum software that is.
-
-
the pistol fires 1 projectile (bullet) and the sawed-off fires many? Not sure, but it will depend on where are you shooting the ped too. maybe someone else can be more of a help
- 1
-
35 minutes ago, Topperx said:
responseData = image ( "http://servertestdownload.unaux.com/download/data/database/login/ScreenLoading1.png" )
the problem is not in the function but in the connection to the site "http://servertestdownload.unaux.com/download/data/database/login/ScreenLoading1.png"
Try to fetchRemote another type of file, maybe a .lua, what does it return?
-
2 minutes ago, Topperx said:
is not downloading > [Output] : ERRO 1006
helpp
is not downloading [Output] : ERRO 1006outputConsole(responseData)
What does this return in your console?
-
in your "myCallback" function, try to output "responseData ", what is it?
I'm sorry, I might not be much of a help
-
1 minute ago, Khadeer143 said:
Run debug script and check the errors
He did, that's how he found the errors above.
I think he removed `addCommandHandler` and changed the player instance
-
1 hour ago, SSKE said:
I use it on Server Side
Post your full code if it's different in any way than the code above.
-
First of all, you need to put a plan on how the script works. then go on the Wiki and plan the functions you will use.
Then start making the code using Wiki & the community.
-
Code?
- 1
-
Try this:
-- Server Side damageTimers = {} function handlePlayerDamage ( attacker, weapon, bodypart, loss ) if (attacker) then -- Check if an attacker exists, you might wanna add a check to see if it's a valid player, also check the attacked player (source) if isTimer(damageTimers[source]) then -- Check if there is already a timer to reset the state of that player, happens when the player is damaged again before the 20 seconds are over killTimer(damageTimers[source]) -- Kill the old timer and continue to make a new one end setElementData(source,'damaged',true) -- Mark the player as damaged within the last 20 seconds damageTimers[source] = setTimer( -- Make a timer, we used a table damageTimers[] function() setElementData(source,'damaged',false) -- Mark the player as not damaged within the last 20 seconds AFTER the timer expires (20 seconds) end, 20*1000, 0 ) end end addEventHandler ( "onPlayerDamage", getRootElement (), handlePlayerDamage ) -- addEventHandler to all players
-
Try this:
-- Client window1 = guiCreateWindow(455, 178, 710, 532, "", false) editUsername = guiCreateEdit(167, 108, 361, 40, "", false, window1) editPassword = guiCreateEdit(170, 197, 358, 36, "", false, window1) btnLogin = guiCreateButton(9, 434, 691, 43, "Login", false, window1) btnClose = guiCreateButton(14, 486, 686, 36, "Close", false, window1) guiSetVisible(window1, true) showCursor(true) guiWindowSetSizable(window1, false) function closeGui() if btnClose == source then guiSetVisible(window1, false) showCursor(false) end end addEventHandler("onClientGUIClick", root, closeGui) -- changed "root" function logToServer() if (source == btnLogin) then -- Check button clicked local account = guiGetText(editUsername) local password = guiGetText(editPassword) local name = getPlayerName(getLocalPlayer()) triggerServerEvent("test", localPlayer, account, password, name) end end addEventHandler("onClientGUIClick", root, logToServer) -- changed "root" -- Server function myMoney(account, password, name) outputChatBox(name); logIn (source, account, password) end addEvent("test", true) addEventHandler("test", root, myMoney)
-
4 minutes ago, DeadthStrock said:
Quoted :- https://wiki.multitheftauto.com/wiki/GuiCreateButton
--create our button button = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "Output!", true ) --Create an edit box and define it as "editBox". editBox = guiCreateEdit( 0.3, 0.1, 0.4, 0.1, "Type your message here!", true ) -- and attach our button to the outputEditBox function addEventHandler ( "onClientGUIClick", editBox, outputEditBox ) guiEditSetMaxLength ( editBox, 128 ) --the max chatbox length is 128, so force this --setup our function to output the message to the chatbox function outputEditBox () local text = guiGetText ( editBox )--get the text from the edit box outputChatBox ( text ) --output that text end addEventHandler ( "onClientGUIClick", button, outputEditBox )
MTA:Wiki also guide that...!! Well Well as you said Compatibility may issues if we put the GUI element in the event handler.
Yep, and I still stand by word.
the GUI sometimes calculates the actual button element a bit larger than the actual displayed unit, or since it's attached to the GUI window, it sometimes confuses that as well. So that means when you click outside of a button, it triggers the button.
Feel free to use any method you like, but what I use to avoid any type of issue is the first solution.
-
7 hours ago, DeadthStrock said:
What is the reason ??
Compatibility issues if you put the GUI element in the event handler
-
1 minute ago, SSKE said:
Mate I wanted to change from false to true in warp_event but I fix it anyway thanks
You made a topic to ask someone to fix "your" script, which would be fixed if you changed false to true?
-
if (hour > 12) then hour = hour-12 end
Isn't it this simple?
From 00:00 to 12:00 that's morning, so it's AM, after 12:00 it's all PM
mute problem
in Scripting
Posted
Many ways to do that, but you can just go on the wiki and look for an ACL function that checks that.
I can tell you what function that is but you should spend some time