Jump to content

Get rank in DD/DM


maarten123

Recommended Posts

Posted

hi, i have a question.

i wanna make a stats script and i wanna get the rank if your die

so i try this but isn't work :P

Lua:

function saveondie(rank,source) 
    outputChatBox(getPlayerName(source).." Rank: "..tostring(rank),getRootElement(),0,255,0) 
end 
addEventHandler("onPlayerWasted",getRootElement(),saveondie) 

Error

ERROR (filename).lua:2 : attempt to concatenate a boolean value 

greeting maarten123

Posted

wtf?

this is just random words.

You are another guy that thinks if you put some random parts from wiki together - it will be working like you want o_O.

Get back to Scripting tutorial - spend a week on trying to understand it all..

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
wtf?

this is just random words.

You are another guy that thinks if you put some random parts from wiki together - it will be working like you want o_O.

Get back to Scripting tutorial - spend a week on trying to understand it all..

sorry guy, but i try anything :P

this is now the only one that i not understand :P

Posted

sure, you can use onPlayerWasted, but .. this script is just totally wrong!

  
function saveondie(rank,source) -- [b]wtf is this? check arguments list: [url=https://wiki.multitheftauto.com/wiki/OnPlayerWasted]https://wiki.multitheftauto.com/wiki/OnPlayerWasted[/url] | also DONT EVEN THINK OF NAMING ANYTHING "source". source is internal variable, and you should only read it![/b] 
    outputChatBox(getPlayerName(source).." Rank: "..tostring(rank),getRootElement(),0,255,0) -- [b]and few totall randomness. where you got that rank? you never set it, well, you script do NOTHING[/b] 
end 
addEventHandler("onPlayerWasted",getRootElement(),saveondie) 
  

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
sure, you can use onPlayerWasted, but .. this script is just totally wrong!
  
function saveondie(rank,source) -- [b]wtf is this? check arguments list: [url=https://wiki.multitheftauto.com/wiki/OnPlayerWasted]https://wiki.multitheftauto.com/wiki/OnPlayerWasted[/url] | also DONT EVEN THINK OF NAMING ANYTHING "source". source is internal variable, and you should only read it![/b] 
    outputChatBox(getPlayerName(source).." Rank: "..tostring(rank),getRootElement(),0,255,0) -- [b]and few totall randomness. where you got that rank? you never set it, well, you script do NOTHING[/b] 
end 
addEventHandler("onPlayerWasted",getRootElement(),saveondie) 
  

Oh, yes your right sorry i'm not very smart with LUA

function saveondie(ammo, attacker, weapon, bodypart) 
    outputChatBox(getPlayerName(source).." Rank: "..tostring(rank),getRootElement(),0,255,0) -- If you're lost then there will be shown what your rank (first, second, etc.) for the test, later i wanna save it on account data 
end 
addEventHandler("onPlayerWasted",getRootElement(),saveondie) 

i hope this is better :)

oh yes what is nou de source?

Posted

source is player that died (wiki page says it).

its better, but rank is not existing

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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