Jump to content

Win cash in race .. help me


UAEpro

Recommended Posts

hello .. i tried to give the winner in my sever cash when he win

but it's not working

and also when i set money in admin panel the money don't save

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

Link to comment
function DMWin(mapInfo) 
local alivePlayers = getAlivePlayers() 
info = mapInfo.modename 
if info == "Destruction derby" then 
if #alivePlayers == 1 then  
local playername = getPlayerName(alivePlayers[1]) 
givePlayerMoney(source,2500) 
outputChatBox(playername.." took $2500 for last player alive!",getRootElement(),255,255,0)  
      end  
   end 
end 
addEventHandler("onPlayerWasted", getRootElement(), DMWin) 
  

hope it works it used to work on my race userpanel i made for a friend :P

Link to comment
and if the money didn't save

cus when i set money in admin panel the money don't save after re login

well this part you got to script it, you need this events,

onPlayerQuit

onPlayerLogin

and functions easiest way should be using account data so..

setAccountData

getAccountData

getPlayerMoney

givePlayerMoney

Link to comment
and if the money didn't save

cus when i set money in admin panel the money don't save after re login

well this part you got to script it, you need this events,

onPlayerQuit

onPlayerLogin

and functions easiest way should be using account data so..

setAccountData

getAccountData

getPlayerMoney

givePlayerMoney

can u help me more

cus iam noob

and new to this language

do you mean like that

    function playerQ1 ( ) 
      local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) then 
            local playermoney = getPlayerMoney ( source ) 
            setAccountData ( playeraccount, "money", playermoney ) 
      end 
end 
  
function playerJ1 ( ) 
      local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) then 
            local playermoney = getAccountData ( playeraccount, "money" ) 
            if ( playermoney ) then 
                  setPlayerMoney ( source, playermoney ) 
            end 
      end 
end 
  
addEventHandler ( "onPlayerQuit", getRootElement ( ), playerQ1 ) 
addEventHandler ( "onPlayerJoin", getRootElement ( ), playerJ1 ) 
  

but this not working

Link to comment
  • 10 years later...
On 09/09/2010 at 04:29, Castillo said:

function DMWin(mapInfo) 
local alivePlayers = getAlivePlayers() 
info = mapInfo.modename 
if info == "Destruction derby" then 
if #alivePlayers == 1 then  
local playername = getPlayerName(alivePlayers[1]) 
givePlayerMoney(source,2500) 
outputChatBox(playername.." took $2500 for last player alive!",getRootElement(),255,255,0)  
      end  
   end 
end 
addEventHandler("onPlayerWasted", getRootElement(), DMWin) 
  
 

 

hope it works it used to work on my race userpanel i made for a friend :P

This is not working on new player join while race stared!

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