Mat101 Posted September 7, 2010 Share Posted September 7, 2010 Hello, I'm Wondering if this will send to all players or to the player. addEventHandler("onPlayerWasted", root, function() outputChatBox("You Got Wasted!!",true) end ) Does that send it to the player or to all? And i have another question... onPlayerWasted is there any way to... Example : Mat101 Has Just killed you. (mat101 example mean the player name) Thanks for help! Link to comment
Discord Moderators Zango Posted September 7, 2010 Discord Moderators Share Posted September 7, 2010 Yes that will output to all players, because you haven't specified anything else and it's by default the root element. int totalAmmo, element killer, int killerWeapon, int bodypart [, bool stealth ] The source of this event is the player that died or got killed. So we can carry out your example: addEventHandler("onPlayerWasted", getRootElement(), function(ammo, killer) if getElementType(killer) == "player" then outputChatBox(getPlayerName(killer)).." has just killed you!", source, 0, 255, 0) end end ) Link to comment
Mat101 Posted September 7, 2010 Author Share Posted September 7, 2010 Nice man, what does 255 mean? Link to comment
Discord Moderators Zango Posted September 7, 2010 Discord Moderators Share Posted September 7, 2010 Nice man, what does 255 mean? https://wiki.multitheftauto.com/wiki/OutputChatBox outputChatBox ( string text [, element visibleTo=getRootElement(), [b]int r=255, int g=255, int b=255[/b], bool colorCoded=false ] ) These last optional highlighted arguments can specify what colour the message should be in, defined in RGB (Red Green Blue). 255 0 0 0 255 0 0 0 255 255 is the max value, you mix these to produce different colours. Link to comment
Mat101 Posted September 7, 2010 Author Share Posted September 7, 2010 Ok.. Maybe i'm really going off topic now, because i don't want to make lots of topics since im a noob scripter here 1: How to set player postion? 2:How to set player world? 3: How to set player Interior Thanks!! Sorry if im being (....) Link to comment
12p Posted September 7, 2010 Share Posted September 7, 2010 Position: https://wiki.multitheftauto.com/wiki/SetElementPosition World (i guess it's dimension): https://wiki.multitheftauto.com/wiki/SetElementDimension Interior: https://wiki.multitheftauto.com/wiki/SetElementInterior Next time, just modify scripts. I learned to script doing that. Link to comment
Mat101 Posted September 7, 2010 Author Share Posted September 7, 2010 @Zango, The script is crashing with this code addEventHandler("onPlayerWasted", getRootElement(), function(ammo, killer) if getElementType(killer) == "player" then outputChatBox(getPlayerName(killer)).." has just killed you!", source, 0, 255, 0) end end ) Link to comment
eAi Posted September 7, 2010 Share Posted September 7, 2010 Crashing or producing an error? If it's producing an error, what is it? Link to comment
dzek (varez) Posted September 7, 2010 Share Posted September 7, 2010 Maybe do a little search? https://wiki.multitheftauto.com/ There are tutorials, functions and event lists, examples, everything you need to learn, and everything you need for everyday use Link to comment
Mat101 Posted September 8, 2010 Author Share Posted September 8, 2010 The whole script doesn't work, Here is a picture.. http://img442.imageshack.us/img442/9148/90058203.jpg Link to comment
Castillo Posted September 8, 2010 Share Posted September 8, 2010 The whole script doesn't work, Here is a picture.. http://img442.imageshack.us/img442/9148/90058203.jpg try this, addEventHandler("onPlayerWasted", getRootElement(), function(ammo, killer) if getElementType(killer) == "player" then outputChatBox(getPlayerName(killer).." has just killed you!", source, 0, 255, 0) end end ) Link to comment
dzek (varez) Posted September 8, 2010 Share Posted September 8, 2010 looks like you set is as gamemode, and there is no script to spawn you then.. Link to comment
Discord Moderators Zango Posted September 8, 2010 Discord Moderators Share Posted September 8, 2010 The whole script doesn't work, Here is a picture.. http://img442.imageshack.us/img442/9148/90058203.jpg try this, addEventHandler("onPlayerWasted", getRootElement(), function(ammo, killer) if getElementType(killer) == "player" then outputChatBox(getPlayerName(killer).." has just killed you!", source, 0, 255, 0) end end ) Yeah syntax was knackered, outputChatBox(getPlayerName(killer[b]))..[/b]" has just killed you!", source, 0, 255, 0) should be: outputChatBox(getPlayerName(killer[b]).[/b]." has just killed you!", source, 0, 255, 0) as said above, I apologise. And as varez mentioned, this isn't a gamemode, just run this serverside script along with freeroam for example. meta.xml if you were in doubt: <meta> <script src="server.lua" /> </meta> Link to comment
Castillo Posted September 8, 2010 Share Posted September 8, 2010 The whole script doesn't work, Here is a picture.. http://img442.imageshack.us/img442/9148/90058203.jpg try this, addEventHandler("onPlayerWasted", getRootElement(), function(ammo, killer) if getElementType(killer) == "player" then outputChatBox(getPlayerName(killer).." has just killed you!", source, 0, 255, 0) end end ) Yeah syntax was knackered, outputChatBox(getPlayerName(killer[b]))..[/b]" has just killed you!", source, 0, 255, 0) should be: outputChatBox(getPlayerName(killer[b]).[/b]." has just killed you!", source, 0, 255, 0) as said above, I apologise. And as varez mentioned, this isn't a gamemode, just run this serverside script along with freeroam for example. meta.xml if you were in doubt: <meta> <script src="server.lua" /> </meta> Please check the post he did b4 thats what i actually fixed, i removed one of the ")" cause it was making an error. Link to comment
dzek (varez) Posted September 8, 2010 Share Posted September 8, 2010 This Unofficial MTA Script Editor is checking syntax in real time, try it: viewtopic.php?f=91&t=24834&start=0 Link to comment
Castillo Posted September 8, 2010 Share Posted September 8, 2010 This Unofficial MTA Script Editor is checking syntax in real time, try it:viewtopic.php?f=91&t=24834&start=0 I use in-game debug script and notepad++ when i'm scripting. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now