Klesh Posted January 8, 2012 Posted January 8, 2012 I need to ask how i can get the player rank, for example if the player is 1, define that function: Example script function(source) local pRank = getPlayerRank(source) if (pRank == "1") then setPlayerMoney(source, 1000)----Its only an example, i need how to call the player rank when its 1. end end That's the correct way? or it have another one more effective? My resources : playerpartFromName: Exported function.
Castillo Posted January 8, 2012 Posted January 8, 2012 function(player) local pRank = exports["race"]:getPlayerRank(player) if (pRank == "1" or pRank == 1) then setPlayerMoney(player, 1000)----Its only an example, i need how to call the player rank when its 1. end end San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Klesh Posted January 9, 2012 Author Posted January 9, 2012 I want to add that to scoreboard, but does not work. ------------------- ----DEFINITION---- ------------------- local root = getRootElement() call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Wins", getRootElement(), 3, .08 )-----| ------------ ---WINNER--- ------------ function winHandler(player) local pRank = exports["race"]:getPlayerRank(player) if (pRank == "1" or pRank == 1) then setElementData ( pRank, "Wins", ( getElementData ( pRank, "Wins" ) ) + 1 ) end end addEventHandler("onClientResourceStart", getRootElement(), winHandler) My resources : playerpartFromName: Exported function.
Castillo Posted January 9, 2012 Posted January 9, 2012 That's just a mess. You want to set +1 win point to the player with rank #1? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Klesh Posted January 9, 2012 Author Posted January 9, 2012 I want to set +1 win then add to scoreboard, the save system i will do by myself. My resources : playerpartFromName: Exported function.
Castillo Posted January 9, 2012 Posted January 9, 2012 Well, I suggest you to think when you're scripting, because you're just trying to set/get element data into a string, number value. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Klesh Posted January 9, 2012 Author Posted January 9, 2012 Thanks, now i do scripts and fixing them by myself, takes time, but i do it, and helping others i learn more. My resources : playerpartFromName: Exported function.
Kenix Posted January 9, 2012 Posted January 9, 2012 Should work Server side ------------------- ----DEFINITION---- ------------------- call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Wins", root, 3, .08 )-----| ------------ ---WINNER--- ------------ function winHandler( rank,_ ) if rank == 1 then setElementData ( source, "Wins", tonumber( getElementData ( source, "Wins" ) or 0 ) + 1 ) end end addEventHandler( "onPlayerFinish",root,winHandler ) http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
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