stylo Posted March 14, 2007 Share Posted March 14, 2007 Does anybody know a rank script? *for MTA:SA* example: a new player joins, for first time so his rank is newbie. after 10 visits his rank is: blabla after 50 visits his rank is: blablallbnal etc.. Link to comment
lil Toady Posted March 14, 2007 Share Posted March 14, 2007 on *:SIGNAL:mta.join:{ !writeini " $+ $scriptdir $+ mta.rank.ini" RANKS $mta.nick($1,$2) $calc($readini($scriptdir $+ mta.rank.ini,RANKS,$mta.nick($1,$2)) + 1) mta.rank $1 $2 } on *:SIGNAL:mta.command:{ var %a = $iif($4,$iif($mta.nick($1,$4) != $null,$4,$iif($mta.getid($1,$4),$v1,-1)),$2) if ($3 == !rank) { if (%a == -1) mta.pm $1 $2 Error - Absent ID else mta.rank $1 %a } } alias mta.rank { var %rank = $readini($scriptdir $+ mta.rank.ini,RANKS,$mta.nick($1,$2)) if (%rank == 10) mta.text $1 $mta.nick($1,$2) $+ 's rank is: blablabla elseif (%rank == 20) mta.text $1 $mta.nick($1,$2) $+ 's rank is: blablablabla } Link to comment
stylo Posted March 14, 2007 Author Share Posted March 14, 2007 and how can i add ranks? Link to comment
Keslertje2005 Posted March 14, 2007 Share Posted March 14, 2007 Beautifull script! But you only get a rank if you have exactly 10 or 20 points, not when you have 13 or 21 points. Is there a way to get this fixed? You can add ranks by changing the blabla in something like Professional or something like that. You can also change the amount off points you need before you get that rank by changing the == 10 in == 2 or == 5. If you want more ranks you can add more elseifs like this: on *:SIGNAL:mta.join:{ !writeini " $+ $scriptdir $+ mta.rank.ini" RANKS $mta.nick($1,$2) $calc($readini($scriptdir $+ mta.rank.ini,RANKS,$mta.nick($1,$2)) + 1) mta.rank $1 $2 } on *:SIGNAL:mta.command:{ var %a = $iif($4,$iif($mta.nick($1,$4) != $null,$4,$iif($mta.getid($1,$4),$v1,-1)),$2) if ($3 == !rank) { if (%a == -1) mta.pm $1 $2 Error - Absent ID else mta.rank $1 %a } } alias mta.rank { var %rank = $readini($scriptdir $+ mta.rank.ini,RANKS,$mta.nick($1,$2)) if (%rank == 1) mta.text $1 $mta.nick($1,$2) $+ 's rank is: 1. Newbie elseif (%rank == 5) mta.text $1 $mta.nick($1,$2) $+ 's rank is: 2. Wannebe Amateur elseif (%rank == 10) mta.text $1 $mta.nick($1,$2) $+ 's rank is: 3. Amateur elseif (%rank == 15) mta.text $1 $mta.nick($1,$2) $+ 's rank is: 4. Wannabe Professional elseif (%rank == 20) mta.text $1 $mta.nick($1,$2) $+ 's rank is: 5. Profressional elseif (%rank == 25) mta.text $1 $mta.nick($1,$2) $+ 's rank is: 6. Smooth Agent elseif (%rank == 30) mta.text $1 $mta.nick($1,$2) $+ 's rank is: 7. Dangerous Killer elseif (%rank == 35) mta.text $1 $mta.nick($1,$2) $+ 's rank is: 8. Murderer } Link to comment
BetaDevil Posted March 14, 2007 Share Posted March 14, 2007 on *:SIGNAL:mta.join:{ !writeini " $+ $scriptdir $+ mta.rank.ini" RANKS $mta.nick($1,$2) $calc($readini($scriptdir $+ mta.rank.ini,RANKS,$mta.nick($1,$2)) + 1) mta.rank $1 $2 } on *:SIGNAL:mta.command:{ var %a = $iif($4,$iif($mta.nick($1,$4) != $null,$4,$iif($mta.getid($1,$4),$v1,-1)),$2) if ($3 == !rank) { if (%a == -1) mta.pm $1 $2 Error - Absent ID else mta.rank $1 %a } } alias mta.rank { var %rank = $readini($scriptdir $+ mta.rank.ini,RANKS,$mta.nick($1,$2)) if (%rank >= 35) mta.text $1 $mta.nick($1,$2) $+ 's rank is: 8. Murderer elseif (%rank >= 30) mta.text $1 $mta.nick($1,$2) $+ 's rank is: 7. Dangerous Killer elseif (%rank >= 25) mta.text $1 $mta.nick($1,$2) $+ 's rank is: 6. Smooth Agent elseif (%rank >= 20) mta.text $1 $mta.nick($1,$2) $+ 's rank is: 5. Profressional elseif (%rank >= 15) mta.text $1 $mta.nick($1,$2) $+ 's rank is: 4. Wannabe Professional elseif (%rank >= 10) mta.text $1 $mta.nick($1,$2) $+ 's rank is: 3. Amateur elseif (%rank >= 5) mta.text $1 $mta.nick($1,$2) $+ 's rank is: 2. Wannebe Amateur elseif (%rank >= 1) mta.text $1 $mta.nick($1,$2) $+ 's rank is: 1. Newbie } Link to comment
lil Toady Posted March 14, 2007 Share Posted March 14, 2007 bah, my fault. forgot the > sign. And yeah, like BetaDevil posted, you have to add the ranks in the order from the top one to the lowest one Link to comment
stylo Posted March 14, 2007 Author Share Posted March 14, 2007 Thnx *edit: It's not working, my friend tested it but it doesnt work * Link to comment
lil Toady Posted March 14, 2007 Share Posted March 14, 2007 i don't see why could it not work, maybe your friend does something wrong? Link to comment
damnet007 Posted March 14, 2007 Share Posted March 14, 2007 (edited) Here's something I tried, I don't really script for mta:sa so don't know if I've converted it right, try it if you want on *:SIGNAL:mta.join:{ !writeini -n " $+ $scriptdir $+ ranks.ini" ranks $mta.nick($1,$2) $calc($joinamt($1,$2) + 1) } on *:SIGNAL:mta.command:{ var %a = $iif($4,$iif($mta.nick($1,$4) != $null,$4,$iif($mta.getid($1,$4),$v1,-1)),$2) if ($3 == !rank) { if (%a == -1) mta.pm $1 $2 Error - Absent Nick/ID else mta.text $1 $mta.nick($1,%a) > Rank: $playerrank($1,%a) ( $+ $joinamt($1,%a) $+ pts) } } alias playerrank !return $iif($joinamt($1,$2) <= 4,Newbie,$iif($joinamt($1,$2) <= 9,Wannabe Amateur,$iif($joinamt($1,$2) <= 14,Amateur,$iif($joinamt($1,$2) <= 19,Wannabe Professional,$iif($joinamt($1,$2) <= 24,Professional,$iif($joinamt($1,$2) <= 29,Smooth Agent,$iif($joinamt($1,$2) <= 34,Dangerous Killer,$iif($joinamt($1,$2) > 34,Murderer)))))))),Unranked) alias joinamt !return $iif($readini(ranks.ini,ranks,$mta.nick($1,$2)),$v1,0) Edited March 14, 2007 by Guest Link to comment
lil Toady Posted March 14, 2007 Share Posted March 14, 2007 bleh, those $iif's don't make it look cool damnet007 and it's too messy like that. I'd say that what you did is useless and has only spoiled the script Link to comment
Scooby Posted March 14, 2007 Share Posted March 14, 2007 u cant use mta.rank since its already used for ur race rank. so u should name it something else. not sure why u would call join's a rank tho, people will just join and quit loadsa times to get a higher rank. Link to comment
damnet007 Posted March 14, 2007 Share Posted March 14, 2007 bleh, those $iif's don't make it look cool damnet007 and it's too messy like that. I'd say that what you did is useless and has only spoiled the script i can say that it works, it works fast on my pc, and as long as it works i dont care about any criticism made, i like my $iif statements as they don't make a lot of difference when processing and the script still works perfectly, the only thing someone might find a headache is when scripting the statement as there are so many brackets, but that's also not hard. Link to comment
lil Toady Posted March 14, 2007 Share Posted March 14, 2007 the fact is that you didn't do anything special so it was just useless. Also for scripting beginners it's a way easier to do that the way i posted imo. W/e i won't argue.. Link to comment
Scooby Posted March 14, 2007 Share Posted March 14, 2007 bleh, those $iif's don't make it look cool damnet007 and it's too messy like that. I'd say that what you did is useless and has only spoiled the script i can say that it works, it works fast on my pc, and as long as it works i dont care about any criticism made, i like my $iif statements as they don't make a lot of difference when processing and the script still works perfectly, the only thing someone might find a headache is when scripting the statement as there are so many brackets, but that's also not hard. At first, i thought it looked kinda messy too however i know things look a lot more bunched up when u add them too a post, in a script it probably doesnt look half as bad. U should always try to make the script effcient tho, its ok saying 'well it works' but when u add all these things together by the time u have a full script, it could be over 20 times slower. Link to comment
damnet007 Posted March 14, 2007 Share Posted March 14, 2007 I have a massive script and I use these $iif statements quite a bit, they don't slow anything down. I read your previous post and changed the alias names Link to comment
Keslertje2005 Posted March 15, 2007 Share Posted March 15, 2007 BetaDevil's script is working fine!! Thanks 'Lil Toady and BetaDevil! Link to comment
Recommended Posts