Jump to content

winner money?


onlinegenc

Recommended Posts

function checkWinAndIfWinGiveWinCash (thePlayer) 
local cash = getPlayerCount()*100 
savePlayerData (thePlayer,"wins",loadPlayerData(thePlayer,"wins") + 1)  
savePlayerData (thePlayer,"cash",loadPlayerData(thePlayer,"cash") + cash) 
outputChatBox ("#ffffff"..getPlayerName(thePlayer) .." #0fc0fcbu haritada 1. olduğu için #ffffff"..tostring(cash).."#0fc0fc$ kazandı!",getRootElement(),24,79,12,true) 
end 
addEvent("birinci",true) 
addEventHandler ("birinci",getRootElement(),checkWinAndIfWinGiveWinCash) 

this is my code.But this is not work

  
function onplayerwasted () 
local racerank=tonumber(getElementData(source,"race rank")) 
if racerank== 1 then 
savePlayerData (thePlayer,"cash",loadPlayerData(thePlayer,"cash") + 1000) 
elseif racerank==2 then 
savePlayerData (thePlayer,"cash",loadPlayerData(thePlayer,"cash") + 500) 
elseif racerank==3 then 
savePlayerData (thePlayer,"cash",loadPlayerData(thePlayer,"cash") + 100) 
end 
end 
addEventHandler("onPlayerWasted",getRootElement(),onplayerwasted) 
  

this is mine code. Can you help me?

Link to comment
  • Other Languages Moderators
function checkWinAndIfWinGiveWinCash (thePlayer) 
local cash = getPlayerCount()*100 
savePlayerData (thePlayer,"wins",loadPlayerData(thePlayer,"wins") + 1)  
savePlayerData (thePlayer,"cash",loadPlayerData(thePlayer,"cash") + cash) 
outputChatBox ("#ffffff"..getPlayerName(thePlayer) .." #0fc0fcbu haritada 1. olduğu için #ffffff"..tostring(cash).."#0fc0fc$ kazandı!",getRootElement(),24,79,12,true) 
end 
addEvent("birinci",true) 
addEventHandler ("birinci",getRootElement(),checkWinAndIfWinGiveWinCash) 

this is my code.But this is not work

  
function onplayerwasted () 
local racerank=tonumber(getElementData(source,"race rank")) 
if racerank== 1 then 
savePlayerData (thePlayer,"cash",loadPlayerData(thePlayer,"cash") + 1000) 
elseif racerank==2 then 
savePlayerData (thePlayer,"cash",loadPlayerData(thePlayer,"cash") + 500) 
elseif racerank==3 then 
savePlayerData (thePlayer,"cash",loadPlayerData(thePlayer,"cash") + 100) 
end 
end 
addEventHandler("onPlayerWasted",getRootElement(),onplayerwasted) 
  

this is mine code. Can you help me?

thePlayer not definded

anyway i think you need to use event onPlayerFinish

check wiki

http://wiki.multitheftauto.com/wiki/Resource:Race

Link to comment
function checkWinAndIfWinGiveWinCash (thePlayer) 
local cash = getPlayerCount()*100 
savePlayerData (thePlayer,"wins",loadPlayerData(thePlayer,"wins") + 1)  
savePlayerData (thePlayer,"cash",loadPlayerData(thePlayer,"cash") + cash) 
outputChatBox ("#ffffff"..getPlayerName(thePlayer) .." #0fc0fcbu haritada 1. olduğu için #ffffff"..tostring(cash).."#0fc0fc$ kazandı!",getRootElement(),24,79,12,true) 
end 
addEvent("birinci",true) 
addEventHandler ("birinci",getRootElement(),checkWinAndIfWinGiveWinCash) 

this is my code.But this is not work

  
function onplayerwasted () 
local racerank=tonumber(getElementData(source,"race rank")) 
if racerank== 1 then 
savePlayerData (thePlayer,"cash",loadPlayerData(thePlayer,"cash") + 1000) 
elseif racerank==2 then 
savePlayerData (thePlayer,"cash",loadPlayerData(thePlayer,"cash") + 500) 
elseif racerank==3 then 
savePlayerData (thePlayer,"cash",loadPlayerData(thePlayer,"cash") + 100) 
end 
end 
addEventHandler("onPlayerWasted",getRootElement(),onplayerwasted) 
  

this is mine code. Can you help me?

function ebeninami() 
        local rank = exports.race:getPlayerRank( source ) + 1 
        if (rank == 2) then 
        savePlayerData (source,"cash",loadPlayerData(source,"cash") + 1000) 
        elseif(rank == 3) then 
        savePlayerData (source,"cash",loadPlayerData(source,"cash") + 1000) 
        elseif(rank == 4) then 
        savePlayerData (source,"cash",loadPlayerData(source,"cash") + 1000) 
        elseif(rank == 5) then 
        savePlayerData (source,"cash",loadPlayerData(source,"cash") + 1000) 
        end 
end 
addEventHandler("onPlayerWasted", getRootElement(), ebeninami) 

try that. // bunu dene.

////

ayrıca savePlayerData ve LoadPlayerData fonksyonlarını paylaşta yanlışlığın nerde olduğuna bakalım. fonksyonları Nextreme'den aldıysan yanlış kullanıyorsun..

Link to comment

kardeşim bu şekilde ben para verdirtebiliyorum.Problemim birinciye para verdirmek.bu şekilde ölenlere para verdirtebiliyoruz.

ama birinci ya ölmez ise?

Birde fonksiyonları ben düzenledim fonksiyonlarda arza yok. dediğim gibi problemim 1.ye para vermek.

Link to comment
kardeşim bu şekilde ben para verdirtebiliyorum.Problemim birinciye para verdirmek.bu şekilde ölenlere para verdirtebiliyoruz.

ama birinci ya ölmez ise?

Birde fonksiyonları ben düzenledim fonksiyonlarda arza yok. dediğim gibi problemim 1.ye para vermek.

addEvent("onPlayerDestructionDerbyWin",true) 
addEventHandler("onPlayerDestructionDerbyWin",getRootElement(), 
function (winner) 
        savePlayerData (winner,"cash",loadPlayerData(winner,"cash") + 1000)    
        outputChatBox ("* " ..getPlayerName (winner).." wins!", root, 255, 255, 255, true ) 
end) 

you should learn english first if you wanna write scripts.

///

biraz ingilizce öğren bence ne dediğin anlaşılmıyor. kodlamada ilerlemek istiyorsan ingilizcen çok iyi olmalı.

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