Sande Posted April 25, 2014 Share Posted April 25, 2014 Hello, i ´m trying to make anti troll system what have to work like this: If same player kills someplayer many times like 10 times. It puts gui to the killed player screen and he have´s option punish or forgive these kills. Now the problem is the functions not working and i am not good with these things. So if someone can help me little i will be so happy. Server: function player_Wasted ( ammo, attacker, weapon, bodypart ) if ( attacker ) then if getElementData(attacker, "anti-troll-kills") then local kills = getElementData(attacker, "anti-troll-kills") setElementData(attacker, "anti-troll-kills", getElementData(attacker, "anti-troll-kills")+1) if kills >= 1 and kills <= 2 then triggerClientEvent ( "antitroll", getRootElement(), attacker ) else setElementData(attacker, "anti-troll-kills", 1) end end end end addEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted ) function Forgive(attacker) setElementData(attacker, "anti-troll-kills", 0) end addEvent( "antiforgive", true ) addEventHandler( "antiforgive", root, Forgive ) function Punish(attacker) setElementInterior ( attacker, 6 ) setElementPosition (attacker, 265.21185302734, 77.63591003418, 1001.0390625) setElementPosition ( 300000, 1, attacker, 268.03460693359, 77.43824005127, 1001.03906) setElementData(attacker, "anti-troll-kills", 0) setTimer(unjail, 65000, 1) end addEvent( "antipunish", true ) addEventHandler( "antipunish", root, Punish ) function unjail(attacker) setElementInterior ( attacker, 0) setElementPosition ( attacker, 268.03460693359, 77.43824005127, 1001.03906) end Client: function createGUI() Antipanel = { button = {}, window = {}, label = {} } Antipanel.window[1] = guiCreateWindow(808, 482, 321, 170, "Suomisisu - Anti troll", false) guiWindowSetSizable(Antipanel.window[1], false) Antipanel.button[1] = guiCreateButton(10, 84, 138, 72, "Forgive", false, Antipanel.window[1]) guiSetProperty(Antipanel.button[1], "NormalTextColour", "FF11FD00") Antipanel.button[2] = guiCreateButton(154, 85, 157, 71, "Punish", false, Antipanel.window[1]) guiSetProperty(Antipanel.button[2], "NormalTextColour", "FFFE0000") Antipanel.label[1] = guiCreateLabel(10, 25, 301, 50, "You have been killed many times by: ... \nYou have now option to choice what do you want to do to that troll.", false, Antipanel.window[1]) guiLabelSetColor(Antipanel.label[1], 252, 244, 0) guiLabelSetHorizontalAlign(Antipanel.label[1], "left", true) addEventHandler ( "onClientGUIClick", Antipanel.button[1], Forgive, false ) addEventHandler ( "onClientGUIClick", Antipanel.button[2], Punish, false ) guiSetVisible(Antipanel.window[1], false) end addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), createGUI) function Forgive(attacker) triggerServerEvent ( "antiforgive", localPlayer, attacker ) windowcloseopen(localPlayer) end function Punish(attacker) triggerServerEvent ( "antipunish", localPlayer, attacker ) windowcloseopen(localPlayer) end function windowcloseopen () if (guiGetVisible (Antipanel.window[1]) == true) then guiSetVisible (Antipanel.window[1], false) guiSetInputEnabled (false) showCursor (false) elseif (guiGetVisible (Antipanel.window[1]) == false) then guiSetVisible (Antipanel.window[1], true) showCursor (true) end end addEvent( "antitroll", true ) addEventHandler( "antitroll", getLocalPlayer(), windowcloseopen ) Link to comment
justn Posted April 27, 2014 Share Posted April 27, 2014 This script needs alot of stuff to change Link to comment
Noki Posted April 27, 2014 Share Posted April 27, 2014 For people to help you, you might want to fix your indentation. Link to comment
Sande Posted April 27, 2014 Author Share Posted April 27, 2014 Thanks for replies. I have been stopped scripting because i am too bad in lua. Thread closed. 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