Spanish4Life Posted November 7, 2011 Share Posted November 7, 2011 (text-removed; later releasing) Hi, i've do a little script to when someone's killed, a random message appears. But that don't work:ç --[[ ]]-- function randomMessageKill(killer, killerWeapon, bodypart) local player = getLocalPlayer() local R_N = math.random(7) -- we put 7 possibilities of message if R_N == 1 then --we start outputChatBox("n") elseif R_N == 2 then outputChatBox("n") elseif R_N == 3 then outputChatBox("n") elseif R_N == 4 then outputChatBox("n") elseif R_N == 5 then outputChatBox("n") elseif R_N == 6 then outputChatBox("n") elseif R_N == 7 then call(getResourceFromName("msgbox"), "guiShowMessageBox", "n", n, "n") end end addEventHandler("onPlayerWasted", getRootElement(), randomMessageKill) Link to comment
Chlorek Posted November 7, 2011 Share Posted November 7, 2011 But can you say what doesn't work? Outputting messages or what? For first look it looks ok. #Edit I am not sure but it should be math.random(1,7) Link to comment
Spanish4Life Posted November 7, 2011 Author Share Posted November 7, 2011 It won't output nothing. I'll gonna test it now; howewer run math.random(7) works Link to comment
Castillo Posted November 7, 2011 Share Posted November 7, 2011 Must be because getLocalPlayer() is only CLIENT SIDE and onPlayerWasted is a server side event. Oh and btw, the first argument of onPlayerWasted is the totalAmmo, the second is the killer. Link to comment
Chlorek Posted November 7, 2011 Share Posted November 7, 2011 Must be because getLocalPlayer() is only CLIENT SIDE and onPlayerWasted is a server side event. Yea, good job solidsnake Always you are right. Well you have to do that server sided and don't use getLocalPlayer() func. Link to comment
Spanish4Life Posted November 13, 2011 Author Share Posted November 13, 2011 (edited) Must be because getLocalPlayer() is only CLIENT SIDE and onPlayerWasted is a server side event. Yea, good job solidsnake Always you are right. Well you have to do that server sided and don't use getLocalPlayer() func. Haha, no: i only needed onClientPlayerWasted. I have strange behaviour, howewer: When I type kill, shows "63" from killer and "2089943303" for weapon. Also, when i drowned i got "53" from killer, why this strange behaviour? Edited November 13, 2011 by Guest Link to comment
CapY Posted November 13, 2011 Share Posted November 13, 2011 Must be because getLocalPlayer() is only CLIENT SIDE and onPlayerWasted is a server side event. Yea, good job solidsnake Always you are right. Well you have to do that server sided and don't use getLocalPlayer() func. or triggerServerEvent, right? triggerClientEvent* Link to comment
Spanish4Life Posted November 13, 2011 Author Share Posted November 13, 2011 Re-Check avobe post, please. Link to comment
CapY Posted November 13, 2011 Share Posted November 13, 2011 Then use onClientPlayerWasted -.- Link to comment
Spanish4Life Posted November 13, 2011 Author Share Posted November 13, 2011 Must be because getLocalPlayer() is only CLIENT SIDE and onPlayerWasted is a server side event. Yea, good job solidsnake Always you are right. Well you have to do that server sided and don't use getLocalPlayer() func. Haha, no: i only needed onClientPlayerWasted. I have strange behaviour, howewer: When I type kill, shows "63" from killer and "2089943303" for weapon. Also, when i drowned i got "53" from killer, why this strange behaviour? Then use onClientPlayerWasted -.- 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