Mabashi Posted April 28, 2013 Share Posted April 28, 2013 (edited) Hi, I have problem with userpanel by NeXTreme (edit by X!ti). (My lua language isn't perfect...) I don't earn money and points for 1st place, but I get it for other places (2nd +). Script: function earnMoney() local thePlayer = source local position = (getAliveRacePlayers() + 1) local account = getPlayerAccount(thePlayer) if not (isGuestAccount(account)) then if getPlayerCount() >= 3 then if not earnFix[thePlayer] then if position ~= 1 then earnFix[thePlayer] = true local pAlive = getAliveRacePlayers() local pDead = getDeadRacePlayers() local finalCash = 0 if pAlive == 0 then pAlive = 1 end local finalCash = math.floor(((pDead+pAlive/position)*pDead)*2) -- Calculate the final money value. local points = math.floor(((pAlive + pDead)*pDead)/pAlive) local playerCash = getAccountData(account,"cash") local playerPoints = getAccountData(account,"points") setAccountData(account,"points",playerPoints+points) setAccountData(account,"cash",playerCash+finalCash) local playerCash = getAccountData(account,"cash") local playerPoints = getAccountData(account,"points") addStat(account,"totalDeaths",1) if playerPoints >= 10000 then unlockAch(thePlayer,6) end if playerCash >= 1000000 then unlockAch(thePlayer,7) end unlockAch(thePlayer,3) unlockAch(thePlayer,6) outputChatBox("#0fc0fc* #FFFFFFYou have recieved $#0fc0fc" .. finalCash .. " #ffffff and #0fc0fc"..points.."#ffffff points for#0fc0fc "..position.." #ffffffplace!",thePlayer,255,255,255,true) end end else outputChatBox("#0fc0fc* #FFFFFFNot enough players to earn money - #ABCDEF3 #FFFFFFrequired.",thePlayer,255,255,255,true) return end scoreboardRefresh(thePlayer) end end addEventHandler("onPlayerWasted",getRootElement(),earnMoney) What is wrong with it. Add something to acl? I don't know what happens. Sorry for my hopeless English cause' I'm from Poland. Please speak in poor English, thanks bro's. And small ask. What is command for upgrade car (nos) or if this is it @Edit I have problem also with buying a ..... maps. When players purchase a map this don't want to set as nextmap. function buyMap(thePlayer,mapName,command) local account = getPlayerAccount(thePlayer) if not (isGuestAccount(account)) then local playerCash = tonumber(getAccountData(account,"cash")) if mapIsAlreadySet == false then if not (mapName == "") then if playerCash >= mapCost then if command then mapName = getMapName(mapName) else mapName = tostring(mapName) end if not mapTimer[mapName] then executeCommandHandler("0x000954", thePlayer, mapName) outputChatBox("#FFFFFFNextmap: "..getPlayerName(thePlayer).."#FFFFFF has bought a next map!",getRootElement(),255,255,255,true) outputChatBox("#FFFFFFNextmap: #0fc0fc"..tostring(mapName),getRootElement(),255,255,255,true) mapIsAlreadySet = true mapBlock = tostring(mapName) unlockAch(thePlayer,9) setAccountData(account,"cash",playerCash - mapCost) scoreboardRefresh(thePlayer) mapTimer[mapName] = true setTimer(resetMapTimer,900000,1,mapName) else outputChatBox("#0fc0fc* #FFFFFFYou can't set this map now, wait some time to set!",thePlayer,255,255,255,true) end else outputChatBox("#0fc0fc* #FFFFFFYou don't have enough money to set a map!",thePlayer,255,255,255,true) end else outputChatBox("#0fc0fc* #FFFFFFPlease select a map from the list first!",thePlayer,255,255,255,true) end else outputChatBox("#0fc0fc* #FFFFFFA map is already set at the moment! Please try again later.",thePlayer,255,255,255,true) end end end function resetMapSetStatus(g_MapInfo) if mapIsAlreadySet then if mapBlock == g_MapInfo.name then mapIsAlreadySet = false mapName = "" mapBlock = "" end end messegeSent = false messegeSentR = false earnFix = {} hunterFix = {} end addEvent("onMapStarting") addEventHandler("onMapStarting",getRootElement(),resetMapSetStatus) hunterFix = {} function resetMapTimer(mapName) if mapTimer[mapName] then mapTimer[mapName] = nil outputChatBox( "#0fc0fc* #0fc0fc"..mapName.." #ffffffcan be bought again!", getRootElement(), 255,255,255,true) end end function buyMapCommand(player,command,mapString) local map, errormsg = findMap( mapString ) if not map then outputChatBox( "#0fc0fc* #ffffff"..errormsg, player, 255,255,255,true) return end buyMap(player,map,true) end addCommandHandler("bm",buyMapCommand) This User Panel it bothers me... Edited May 2, 2013 by Guest Link to comment
panos144 Posted April 29, 2013 Share Posted April 29, 2013 To fix vehicles: fixVehicle i'm not sure but try this: function earnMoney() local thePlayer = source local position = (getAliveRacePlayers() + 1) local account = getPlayerAccount(thePlayer) if not (isGuestAccount(account)) then if getPlayerCount() >= 3 then if not earnFix[thePlayer] then if position ~= 1 then earnFix[thePlayer] = true local pAlive = getAliveRacePlayers() local pDead = getDeadRacePlayers() local finalCash = 0 if pAlive == 0 then pAlive = 1 end local finalCash = math.floor(((pDead+pAlive/position)*pDead)*2) -- Calculate the final money value. local points = math.floor(((pAlive + pDead)*pDead)/pAlive) local playerCash = getAccountData(account,"cash") local playerPoints = getAccountData(account,"points") setAccountData(account,"points",playerPoints+points) setAccountData(account,"cash",playerCash+finalCash) local playerCash = getAccountData(account,"cash") local playerPoints = getAccountData(account,"points") addStat(account,"totalDeaths",1) if playerPoints >= 10000 then unlockAch(thePlayer,6) end if playerCash >= 1000000 then unlockAch(thePlayer,7) end unlockAch(thePlayer,3) unlockAch(thePlayer,6) outputChatBox("#0fc0fc* #FFFFFFYou have recieved $#0fc0fc" .. finalCash .. " #ffffff and #0fc0fc"..points.."#ffffff points for#0fc0fc "..position.." #ffffffplace!",thePlayer,255,255,255,true) else outputChatBox("#0fc0fc* #FFFFFFNot enough players to earn money - #ABCDEF3 #FFFFFFrequired.",thePlayer,255,255,255,true) return end scoreboardRefresh(thePlayer) end end addEventHandler("onPlayerWasted",getRootElement(),earnMoney) Link to comment
Mabashi Posted May 2, 2013 Author Share Posted May 2, 2013 Hi, this change does not contribute is as before ;/ Thanks for trying. I look forward to new proposals. 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