UAEpro Posted September 8, 2010 Share Posted September 8, 2010 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
BinSlayer1 Posted September 8, 2010 Share Posted September 8, 2010 could it be because of the event? I'm guessing you're running DM maps in the race gamemode.. In such maps, most of the time the vehicles do not explode, but the driver just drowns. If this is the case then I think you should use https://wiki.multitheftauto.com/wiki/OnPlayerWasted Link to comment
Castillo Posted September 8, 2010 Share Posted September 8, 2010 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 Link to comment
UAEpro Posted September 8, 2010 Author Share Posted September 8, 2010 and if the money didn't save cus when i set money in admin panel the money don't save after re login Link to comment
Castillo Posted September 9, 2010 Share Posted September 9, 2010 and if the money didn't savecus 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
UAEpro Posted September 9, 2010 Author Share Posted September 9, 2010 and if the money didn't savecus 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
UAEpro Posted September 9, 2010 Author Share Posted September 9, 2010 Fixed .. ty SolidSnake14 Link to comment
Miyuru Posted October 28, 2020 Share Posted October 28, 2020 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 This is not working on new player join while race stared! 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