Jump to content

Scoreboard


dranton17

Recommended Posts

I wish to make a mode to count zombie kills . I have the ZDay mode . I want to make a script that counts the kills . Lets say for every kill the player receives 10 dollars . And also when the player has a number of kills 300 is spawned as an more advanced class with more weapons . Example : 0 kills - Civilian - SD Pistol : 300 - Kills - Police man - Deagle + MP5 etc . These features will be only avalivible to registered players . Thanks . I have the idea how to make it but i don't know very well how to write it into code (im new to scripiting ) . Thanks for help .

*Also there is any host that host for free a mta server ? With my pc i can be uptime only like 9/24 hours per day so ...

Link to comment

This topic is in the wrong section, it should go in the "Scripting" section instead.

Answer to your question(1): We don't accept requests here, I can give you a start but nothing else, you have to learn by yourself like we all did.

addEvent("onZombieWasted",true) 
addEventHandler("onZombieWasted",root, 
function (killer) 
givePlayerMoney(killer,100) 
end) 

Wiki page: https://wiki.multitheftauto.com/wiki/Scr ... troduction

Answer to your question(2): There aren't much free hosts, you can take a look in here: viewforum.php?f=116, but I would suggest buying one.

Link to comment

Server side script:

addEvent("onZombieWasted",true) 
addEventHandler("onZombieWasted",root, 
function (killer) 
    givePlayerMoney(killer,100) 
    addPlayerZombieKills(killer) 
end) 
  
function addPlayerZombieKills(killer) 
    local account = getPlayerAccount(killer) 
    if isGuestAccount(account) then return end 
    local zombieKills = getAccountData(account,"Zombie kills") 
    if not zombieKills then setAccountData(account,"Zombie kills",0) end 
    setAccountData(account,"Zombie kills",tonumber(zombieKills)+1) 
end 
  
addEventHandler("onPlayerLogin",root, 
function () 
    local account = getPlayerAccount(source) 
    if isGuestAccount(account) then return end 
    local zombieKills = getAccountData(account,"Zombie kills") 
    if zombieKills then 
        setElementData(source,"Zombie kills",tostring(zombieKills)) 
    else 
        setElementData(source,"Zombie kills",0) 
    end 
end) 

Zombies resource already has a column in the scoreboard called "Zombie kills", this script should save the kills when they kill a zombie and then load on login.

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