Jump to content

DD/DM WIN


loler

Recommended Posts

Hey , i found a dd/dm win but it didnt works

addEvent("onPlayerDestructionDerbyWin",true)
addEventHandler("onPlayerDestructionDerbyWin",getRootElement(),
function (winner)
givePlayerMoney(winner, 700)
outputChatBox(getPlayerName ( winner ) .. " has won $700 as last player alive",getRootElement(),0,255,0)
end
)

I dont know why it didnt works can anyone help me?

Link to comment

That event is not being triggered (I presume) so the function won't ever do anything. onPlayerWasted you could check how many players remain alive, if 1, then triggerEvent("onPlayerDestructionDerbyWin",winner,winner) (or the client-side equivalent).

Link to comment
Hey , i found a dd/dm win but it didnt works
addEvent("onPlayerDestructionDerbyWin",true)
addEventHandler("onPlayerDestructionDerbyWin",getRootElement(),
function (winner)
givePlayerMoney(winner, 700)
outputChatBox(getPlayerName ( winner ) .. " has won $700 as last player alive",getRootElement(),0,255,0)
end
)

I dont know why it didnt works can anyone help me?

add this line on the top:

AddEventOnClientTriggered

I THINK

Link to comment
addEvent("onPlayerDestructionDerbyWin",true)
addEventHandler("onPlayerDestructionDerbyWin",getRootElement(),
function (winner)
givePlayerMoney(winner, 1200)
outputChatBox(getPlayerName ( winner ) .. " has won $1200  as last player alive",getRootElement(),0,255,0)
end)

Link to comment
Nah , i dont know how to make the client :oops:

server.lua

addEvent("onPlayerDestructionDerbyWin",true)
addEventHandler("onPlayerDestructionDerbyWin",getRootElement(),
function (winner)
givePlayerMoney(winner, 1200)
outputChatBox(getPlayerName ( winner ) .. " has won $1200  as last player alive",getRootElement(),0,255,0)
end)

meta.xml

<meta>
<info author="Castillo" description="Price for winning a race" type="script" version="1.0" />
<script src="server.lua" type="server"/>
meta>

i guess u understand a litle more now :)

Link to comment
function check()
local alive = getAlivePlayers()
if (#alive == 1) then
local player = alive[1]
givePlayerMoney(player,1200)
outputChatBox(getPlayerName(player).." has earned $1200 for being the last player alive",getRootElement(),0,255,0)
end
end
addEventHandler("onVehicleExplode",getRootElement(),check)

Something like that will work? I'm not sure if race uses peds or players.

Link to comment

afaik the only thing he need is to update race resource. if not:

open destructionderby.lua from race resource and add:

addEvent("onPlayerDestructionDerbyWin")

on the first line

and:

-- under this line:
showMessage(getPlayerName(activePlayers[1]) .. ' is the final survivor!', 0, 255, 0)
-- add this line:
triggerEvent("onPlayerDestructionDerbyWin", getRootElement(), activePlayers[1])

Link to comment

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...