Jump to content

Why isn't this working?


Spanish4Life

Recommended Posts

Posted

(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) 

Posted

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)

Posted

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.

Posted
Must be because getLocalPlayer() is only CLIENT SIDE and onPlayerWasted is a server side event.

Yea, good job solidsnake :D Always you are right.

Well you have to do that server sided and don't use getLocalPlayer() func.

Posted (edited)
Must be because getLocalPlayer() is only CLIENT SIDE and onPlayerWasted is a server side event.

Yea, good job solidsnake :D 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 by Guest
Posted
Must be because getLocalPlayer() is only CLIENT SIDE and onPlayerWasted is a server side event.

Yea, good job solidsnake :D Always you are right.

Well you have to do that server sided and don't use getLocalPlayer() func.

or triggerServerEvent, right?

triggerClientEvent*

Posted
Must be because getLocalPlayer() is only CLIENT SIDE and onPlayerWasted is a server side event.

Yea, good job solidsnake :D 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 -.-

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...