-.Paradox.- Posted June 7, 2014 Posted June 7, 2014 Hello guys, i have a little problem, when i kill a zombie, It appears a text showing how much i earned, but it appear for all players, and it suppose to appear only for who killed the zombie, here is my code: Server addEvent( "onZombieWasted" , true) addEventHandler( "onZombieWasted", getRootElement(), function( killer ) local money = 500 givePlayerMoney( killer, tonumber(money)) triggerClientEvent("onClientZombieWasted", killer, money) end) Client local x,y = guiGetScreenSize() function onTest() dxDrawText("+"..tostring(money), x*1211/1366, y*51/768, x*1351/1366, y*77/768, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, false, false) dxDrawText("+"..tostring(money), x*1211/1366, y*49/768, x*1351/1366, y*75/768, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, false, false) dxDrawText("+"..tostring(money), x*1209/1366, y*51/768, x*1349/1366, y*77/768, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, false, false) dxDrawText("+"..tostring(money), x*1209/1366, y*49/768, x*1349/1366, y*75/768, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, false, false) dxDrawText("+"..tostring(money), x*1210/1366, y*50/768, x*1350/1366, y*76/768, tocolor(22, 131, 38, 255), 1.00, "pricedown", "left", "top", false, false, true, false, false) --for i=1, 18 do --dxDrawText("A zombie got killed ".. i, x*0.2, 0 - y*0.03 + (y*0.05 * i),x,y,tocolor(255,255,255,255)) --end end addEvent("onClientZombieWasted", true) addEventHandler( "onClientZombieWasted", root, function(mon) if not isTimer(moneyTimer) then moneyTimer = setTimer(function() removeEventHandler("onClientRender", root, onTest) end, 2000, 1) money = mon addEventHandler("onClientRender", root, onTest) else money = (money + mon) resetTimer(moneyTimer) end end) If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Price. Posted June 7, 2014 Posted June 7, 2014 uhm try defining the "killer" Client: local attacker = getPlayerName( killer ) local playeraccount = getPlayerAccount ( killer ) ofc you can change local and add it to server side if you want YOU HAVE TO TRUST SOMEONE TO BE BETRAYED.I NEVER DID
-.Paradox.- Posted June 7, 2014 Author Posted June 7, 2014 I don't think so.. If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Price. Posted June 7, 2014 Posted June 7, 2014 just try it, its gonna be specified for the "account" I have a similar code of police and receiving money. YOU HAVE TO TRUST SOMEONE TO BE BETRAYED.I NEVER DID
MIKI785 Posted June 7, 2014 Posted June 7, 2014 The first argument in the triggerClientEvent is optional and is the element it will get sent to. Its root by default so just put killer before the name of the event and that should do it. Lua Scripter Owner of mshost.cz MTA portal.
Price. Posted June 7, 2014 Posted June 7, 2014 oh yes, didn't check the trigger client event correctly, as MIKI said should be like this triggerClientEvent( killer, "onClientZombieWasted", money) YOU HAVE TO TRUST SOMEONE TO BE BETRAYED.I NEVER DID
#DRAGON!FIRE Posted June 8, 2014 Posted June 8, 2014 in Argument 1 killer To Contact Me at Skype : [email protected]
Max+ Posted June 8, 2014 Posted June 8, 2014 -- no Need for local Money on Server . . ---ClinetSide , function onTest() local x,y = guiGetScreenSize() local money = getPlayerMoney (localPlayer) dxDrawText("+"..tostring(money), x*1211/1366, y*51/768, x*1351/1366, y*77/768, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, false, false) dxDrawText("+"..tostring(money), x*1211/1366, y*49/768, x*1351/1366, y*75/768, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, false, false) dxDrawText("+"..tostring(money), x*1209/1366, y*51/768, x*1349/1366, y*77/768, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, false, false) dxDrawText("+"..tostring(money), x*1209/1366, y*49/768, x*1349/1366, y*75/768, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, false, false) dxDrawText("+"..tostring(money), x*1210/1366, y*50/768, x*1350/1366, y*76/768, tocolor(22, 131, 38, 255), 1.00, "pricedown", "left", "top", false, false, true, false, false) for i=1, 18 do dxDrawText("A zombie got killed ".. i, x*0.2, 0 - y*0.03 + (y*0.05 * i),x,y,tocolor(255,255,255,255)) end end addEvent("onClientZombieWasted", true) addEventHandler( "onClientZombieWasted", root, function(mon) if not isTimer(moneyTimer) then moneyTimer = setTimer(function() removeEventHandler("onClientRender", root, onTest) end, 2000, 1) money = mon addEventHandler("onClientRender",root, onTest) else money = (money + mon) resetTimer(moneyTimer) end end) ---ServerSide , addEvent( "onZombieWasted" , true) addEventHandler( "onZombieWasted", getRootElement(), function( attacker ) if ( getElementType ( attacker ) == "player" ) and ( getElementType ( source ) == "ped" ) then givePlayerMoney(attacker, 500) triggerClientEvent(attacker, 'onClientZombieWasted', attacker) end end ) - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
-.Paradox.- Posted June 8, 2014 Author Posted June 8, 2014 The first argument in the triggerClientEvent is optional and is the element it will get sent to. Its root by default so just put killer before the name of the event and that should do it. MIKI785 Thank you. Max, I prefer doing it in my way. If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
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