Jump to content

[REQ]Create a LVL System


Recommended Posts

hi i start working in a Lvl system based in kills example:

5 kills lvl 1

12 kills lvl 2

26 kills lvl 3

53 kills lvl 4

etc...

but i have multiply errors and i start this tread for all intered people in create this system.

here go a little code.

if ( killer ) then 
  
        kills[source] = 0 
  
        -- Checking if the player suicided 
        if (source == killer) then 
            playerid = "himself" 
        else 
            kills[killer] = kills[killer] + 1 
        end 
        if getElementData( killer, "score" (source) == 5) then 
        if (kills[killer] == 5) then 
            textDisplayAddObserver ( monsterkill, root ) -- Monsterkill! 
            setTimer ( "textDisplayRemoveObserver", 3000, 1, monsterkill, root ) 
        end 
  
        if (kills[killer] == 10) then 
            textDisplayAddObserver ( dominating, root ) -- Dominating! 
            setTimer ( "textDisplayRemoveObserver", 3000, 1, dominating, root ) 
        end 
  
        if (kills[killer] == 15) then 
            textDisplayAddObserver ( godlike, root ) -- GodLike! O_O 
            setTimer ( "textDisplayRemoveObserver", 3000, 1, godlike, root ) 
        end 

is a part of code of Deagle wars of Francesco but have a lot of bugs.

this is the base of create a lvl system if you have a code snippet or something apport to this post

plz post ;D.

bye and sorry for my english

Link to comment

Your combination of no error messages, and barely intelligible English makes this one hard case. First, please try to write more clearly, second, highlight the error lines in your code, and give us the error messages.

Link to comment

-- Desert Eagle Wars[quote][quote][/quote][/quote] 
-- Coded by Franc[e]sco 
  
  
kills = {} 
  
  
addEventHandler ( "onPlayerWasted", getRootElement(), "OnPlayerDied" ) -- Defining OnPlayerDied 
  
function OnPlayerDied ( totalammo, killer, killerweapon, bodypart ) -- Calling OnPlayerDied 
  
    -- Obtaining nick and color of the killed player 
    local playerid = getClientName ( source ) 
  
    if ( killer ) then 
  
        kills[source] = 0 
  
        -- Checking if the player suicided 
        if (source == killer) then 
            playerid = "himself" 
        else 
            kills[killer] = kills[killer] + 1 
        end 
     
        if (kills[killer] == 5) then 
        outputChatBox("doble kill.", player, 0, 138, 138)    
        end 
  
        if (kills[killer] == 10) then 
        outputChatBox("triple kill", player, 0, 138, 138)    
        end 
  
        if (kills[killer] == 15) then 
            outputChatBox("amega kill.", player, 0, 138, 138) 
        end 
  
end 
  
end 
  
-- ################################################################################################################## 
function PlayerJoin(source) 
fadeCamera ( v, true ) 
setTimer( spawnPlayer , 6000 , 1 , source , -2329.7912597656, -1623.5703125, 483.70831298828 ) 
giveWeapon ( source, 30, 999 ) 
end 
addEventHandler("onPlayerJoin", getRootElement(),PlayerJoin) 
-- ################################################################################################################## 

i have this error

[01:02:18] WARNING: deagle.lua: Bad argument @ 'addEventHandler' - Line: 8 

if remove a 1 end o event onplayerwasted i have this error:

[01:02:10] SCRIPT ERROR: ...grama/MTA San Andreas/server/mods/deathmatch/resources/deagle/deagle.lua:47: 'end' expected (to close 'if' at line 15) near '<eof>' 
[01:02:10] INFO: Loading script failed: ...grama/MTA San Andreas/server/mods/deathmatch/resources/deagle/deagle.lua:47: 'end' expected (to close 'if' at line 15) near '<eof>' 

Link to comment

addEventHandler takes the function itself as an argument, not its name. So;

  
addEventHandler("onPlayerJoin",getRootElement(),"funcPlayerJoin"); 
  

is wrong, and

  
addEventHandler("onPlayerJoin",getRootElement(),funcPlayerJoin); 
  

is correct.

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