DazzaJay Posted April 19, 2007 Share Posted April 19, 2007 Hello all, just wondering if some smart person can add a command to this script, first of all, i have no idea who the creator of this script is, i just found it while googleing about one day.. the basic command i want is !points &/or !score wich i want to show up the points the user has, i would also like the ability to have a command !points to be able to check other peoples score. if anyone can help out on that it would be greatly apprecieated. Heres a copy of the script that i found..... on *:SIGNAL:mta.finish: { if (($mta.rank($1,$2) <5>= 2)) { var %score = $replacex($mta.rank($1,$2),1,5,2,4,3,3,4,2,5,1) var %position = $replace($mta.rank($1,$2),1,first,2,second,3,third,4,fourth,5,fifth) mta.text $1 $mta.nick($1,$2) came %position and earned %score points! !writeini " $+ $scriptdir $+ points.ini" POINTS $mta.ip($1,$2) $iif($readini($scriptdir $+ points.ini,POINTS,$mta.ip($1,$2)),$calc($v1 + %score),%score) } elseif ($mta.server($1).players == 1) { mta.text $1 Playing alone earned you 2 points! !writeini " $+ $scriptdir $+ points.ini" POINTS $mta.ip($1,$2) $iif($readini($scriptdir $+ points.ini,POINTS,$mta.ip($1,$2)),$calc($v1 + 2),2) } } it also makes a file called points.ini where it saves the points.... it looks like this.... (i have removed the second octet from each ip addy for security reasons) [POINTS] 203.***.249.116=59 84.***.36.196=12 86.***.18.240=34 84.***.152.102=4 87.***.51.145=25 86.***.142.47=10 212.***.245.50=1 76.***.27.190=22 87.***.51.147=4 Would it be possible to save the points by username instead of IP? cos ive got a lot of "Dynamic mates" :::EDIT::: A mate just asked me to ask about a !resetpoints command for admins level 7 and higher to use. Link to comment
kevuwk Posted April 19, 2007 Share Posted April 19, 2007 moved to add-ons as the scripting area is more for lua Link to comment
DazzaJay Posted April 19, 2007 Author Share Posted April 19, 2007 well, i seen the topic "Scripting" so i thaught it was the logical place to put the thread. Anyway, can anyone help out on this? Link to comment
Scooby Posted April 20, 2007 Share Posted April 20, 2007 ok im not gonna go to town on this, here: on *:SIGNAL:mta.finish: { if ($mta.rank($1,$2) < 5) && ($mta.server($1).players > 1) { var %score = $replacex($mta.rank($1,$2),1,5,2,4,3,3,4,2,5,1) var %position = $replace($mta.rank($1,$2),1,first,2,second,3,third,4,fourth,5,fifth) mta.text $1 $mta.nick($1,$2) came %position and earned %score points! !writeini " $+ $scriptdir $+ points.ini" POINTS $mta.nick($1,$2) $iif($readini($scriptdir $+ points.ini,POINTS,$mta.nick($1,$2)),$calc($v1 + %score),%score) } elseif ($mta.server($1).players == 1) { mta.text $1 Playing alone earned you 2 points! !writeini " $+ $scriptdir $+ points.ini" POINTS $mta.nick($1,$2) $iif($readini($scriptdir $+ points.ini,POINTS,$mta.nick($1,$2)),$calc($v1 + 2),2) } } and in on *:SIGNAL:mta.command: { add this: elseif ($3 == !points) || ($3 == !score) { if (!$4) mta.text $1 $mta.nick($1,$2) $+ 's Points: $readini($scriptdir $+ points.ini,POINTS,$mta.nick($1,$2)) elseif (%a != -1) mta.text $1 $mta.nick($1,%a) $+ 's Points: $readini($scriptdir $+ points.ini,POINTS,$mta.nick($1,%a)) else mta.text $1 $4 $+ 's Points: $iif($readini($scriptdir $+ points.ini,POINTS,$4) == $null,0,$v1) } elseif ($3 == !resetpoints) && ($gus.level($1,$2) > = 7) { if (!$4) mta.pm $1 $2 Type !resetpoints else { mta.text $1 $mta.nick($1,$2) Has Reset $4 $+ 's Points. !writeini " $+ $scriptdir $+ points.ini" POINTS $4 0 } } there, i think that should do u. although if u dont even have points in ur script already, im guessing u have so much more missing too... maybe u should think about getting a better script Link to comment
DazzaJay Posted April 20, 2007 Author Share Posted April 20, 2007 Thanks for that, im about to test it out, but from what ive seen so far, it seems to work ok, and i havent seen any scripts that are just a plain and simple score system, so from the style of script that i am looking for, this is the best one i have found. So at the moment, its just Tommis's General Use Scripts Finall + this points script, and it does the job, and theres bugger all stuffing around. i wil make another reply if i have any problems, but it looks like it sould be good, Thanks man. Link to comment
DazzaJay Posted April 20, 2007 Author Share Posted April 20, 2007 Ok... it looks like i am some kind of gaigantic retarded monkey.... i gaurentee i know what ive done wrong..... well, heres the deal, typing !points or !score didnt work, im guessing that ive put that part in either the wrong file, or the wrong place.... basically, because im like Uber nub, i put it in the same file as the rest of the script kinda like this..... on *:SIGNAL:mta.finish: { if ($mta.rank($1,$2) <5> 1) { var %score = $replacex($mta.rank($1,$2),1,5,2,4,3,3,4,2,5,1) var %position = $replace($mta.rank($1,$2),1,first,2,second,3,third,4,fourth,5,fifth) mta.text $1 $mta.nick($1,$2) came %position and earned %score points! !writeini " $+ $scriptdir $+ points.ini" POINTS $mta.nick($1,$2) $iif($readini($scriptdir $+ points.ini,POINTS,$mta.nick($1,$2)),$calc($v1 + %score),%score) } elseif ($mta.server($1).players == 1) { mta.text $1 Playing alone earned you 2 points! !writeini " $+ $scriptdir $+ points.ini" POINTS $mta.nick($1,$2) $iif($readini($scriptdir $+ points.ini,POINTS,$mta.nick($1,$2)),$calc($v1 + 2),2) } } on *:SIGNAL:mta.command: { elseif ($3 == !points) || ($3 == !score) { if (!$4) mta.text $1 $mta.nick($1,$2) $+ 's Points: $readini($scriptdir $+ points.ini,POINTS,$mta.nick($1,$2)) elseif (%a != -1) mta.text $1 $mta.nick($1,%a) $+ 's Points: $readini($scriptdir $+ points.ini,POINTS,$mta.nick($1,%a)) else mta.text $1 $4 $+ 's Points: $iif($readini($scriptdir $+ points.ini,POINTS,$4) == $null,0,$v1) } elseif ($3 == !resetpoints) && ($gus.level($1,$2) > = 7) { if (!$4) mta.pm $1 $2 Type !resetpoints else { mta.text $1 $mta.nick($1,$2) Has Reset $4 $+ 's Points. !writeini " $+ $scriptdir $+ points.ini" POINTS $4 0 } } if my guess is correct, i have put this in the wrong place, but im totally buggered on where the correct place is.[/code] Link to comment
Scooby Posted April 20, 2007 Share Posted April 20, 2007 well i kinda expected u to add it into gus, somewhere in the middle, or down at the bottom, it doesnt work like u have it because the first command starts with 'elseif' u can change it to 'if' and it will work, but ur missing the line: var %a = $iif($4,$iif($mta.nick($1,$4) != $null,$4,$gus.getid($1,$4)),$2) which needs to be the first line in mta.command i took that out of gus^ that should work ok if u do that. its should start like this: on *:SIGNAL:mta.command: { var %a = $iif($4,$iif($mta.nick($1,$4) != $null,$4,$gus.getid($1,$4)),$2) if ($3 == !points) || ($3 == !score) { etc... Link to comment
DazzaJay Posted April 20, 2007 Author Share Posted April 20, 2007 Ok, i moved all the code around, put the command code in the Gus file, and it works...... kinda.... theres some little tiny problem in it tho i race, i win.. ive got 6 points now, but when i type !points or !score it just says [PHS]Dan[AU]'s Points: thats it, no number.... any ideas on why?. im guessing itl be somthing that i screwed up... any ideas? Link to comment
Scooby Posted April 20, 2007 Share Posted April 20, 2007 ok yeah i see it, sry use this: elseif ($3 == !points) || ($3 == !score) { if (!$4) mta.text $1 $mta.nick($1,$2) $+ 's Points: $iif($readini($scriptdir $+ points.ini,POINTS,$mta.nick($1,$2)) == $null,0,$v1) elseif (%a != -1) mta.text $1 $mta.nick($1,%a) $+ 's Points: $iif($readini($scriptdir $+ points.ini,POINTS,$mta.nick($1,%a)) == $null,0,$v1) else mta.text $1 $4 $+ 's Points: $iif($readini($scriptdir $+ points.ini,POINTS,$4) == $null,0,$v1) } this will fix the nothing showing problem, not sure why it didnt show ur 6 points tho. test this anyway and see how u get on. Link to comment
DazzaJay Posted April 20, 2007 Author Share Posted April 20, 2007 well, i put it in, and its still doing the same thing.... but its clearly saving the points in the file...... [POINTS] ~PHS~Dan~AU~=8 ~PHS~Grim_Reeper=2 Alexx=5 -~SPHiNX~-Sn0b=2 whitey=4 Gooshy=2 Link to comment
lil Toady Posted April 20, 2007 Share Posted April 20, 2007 on *:SIGNAL:mta.command: { if (($3 == !points) || ($3 == !score)) { if (%a != -1) mta.text $1 $mta.nick($1,%a) $+ 's Points: $calc($readini($scriptdir $+ points.ini,POINTS,$mta.nick($1,%a))) elseif ($mta.nick($1,$4)) mta.text $1 $4 $+ 's Points: $calc($readini($scriptdir $+ points.ini,POINTS,$4)) else mta.text $1 $mta.nick($1,$2) $+ 's Points: $calc($readini($scriptdir $+ points.ini,POINTS,$mta.nick($1,$2))) } elseif ($3 == !resetpoints) && ($gus.level($1,$2) > = 7) { if (!$4) mta.pm $1 $2 Type !resetpoints else { mta.text $1 $mta.nick($1,$2) Has Reset $4 $+ 's Points. !writeini " $+ $scriptdir $+ points.ini" POINTS $4 0 } } } Link to comment
DazzaJay Posted April 20, 2007 Author Share Posted April 20, 2007 Quick Question Toady, i noticed that your code has "If" instead of "Elseif" so does it go in the gus script? or can i add it to the bottom of the points script? If so, im guessing that i have to do this? u can change it to 'if' and it will work, but ur missing the line:var %a = $iif($4,$iif($mta.nick($1,$4) != $null,$4,$gus.getid($1,$4)),$2) which needs to be the first line in mta.command :::EDIT::: and one more thing, im guessing that this line designates what position wins how many points... var %score = $replacex($mta.rank($1,$2),1,5,2,4,3,3,4,2,5,1) if my guess is correct, if i changed it to var %score = $replacex($mta.rank($1,$2),1,25,2,20,3,15,4,10,5,1) would that set it to be First place 25 Points, second place 20 points, third 15 points, fourth 10 points, fifth 1 point. and one more thing, if i knock a few number out of there, like so: var %score = $replacex($mta.rank($1,$2),1,5,2,4,3,3) would that result in only the first 3 places reciving points? (yes im a total noob, but i pick up on some things fairly fast) Link to comment
lil Toady Posted April 20, 2007 Share Posted April 20, 2007 1. you can change every command start to 'if' but this way it's gonna take more cpu, to reduce cpu we use 'elseif' so it skips all those with elseif once a command has been executed but the first command always has to use 'if' to start from, you can not do 'elseif' if there was no 'if' 2. var %score = $replacex($mta.rank($1,$2),1,25,2,20,3,15,4,10,5,1) var %score = $replacex($mta.rank($1,$2),1,5,2,4,3,3) yes, those both will work. The syntax is: $replacex(source,string,newstring,string,newstring,etc...) 3. var %a = $iif($4,$iif($mta.nick($1,$4) != $null,$4,$gus.getid($1,$4)),$2) this line is there to define a variable %a with an ID which it gets from the $4's arg. (so if you do '!command something' it will start looking for a player that has 'something' it his name and will set %a to this player's ID) It is not nesessary to have that in your script, but it is handy enough. Link to comment
DazzaJay Posted April 20, 2007 Author Share Posted April 20, 2007 ok, its all working, altho theres a slight little odd thing it seems to be doing.... heres the script at the moment: on *:SIGNAL:mta.finish: { if ($mta.rank($1,$2) <5> 1) { var %score = $replacex($mta.rank($1,$2),1,5,2,4,3,3,4,2,5,1) var %position = $replace($mta.rank($1,$2),1,first,2,second,3,third,4,fourth,5,fifth) mta.text $1 $mta.nick($1,$2) came %position and earned %score points! !writeini " $+ $scriptdir $+ points.ini" POINTS $mta.nick($1,$2) $iif($readini($scriptdir $+ points.ini,POINTS,$mta.nick($1,$2)),$calc($v1 + %score),%score) } elseif ($mta.server($1).players == 1) { mta.text $1 Playing alone earned you 2 points! !writeini " $+ $scriptdir $+ points.ini" POINTS $mta.nick($1,$2) $iif($readini($scriptdir $+ points.ini,POINTS,$mta.nick($1,$2)),$calc($v1 + 2),2) } } on *:SIGNAL:mta.command: { var %a = $iif($4,$iif($mta.nick($1,$4) != $null,$4,$gus.getid($1,$4)),$2) if (($3 == !points) || ($3 == !score)) { if (%a != -1) mta.text $1 $mta.nick($1,%a) $+ 's Points: $calc($readini($scriptdir $+ points.ini,POINTS,$mta.nick($1,%a))) elseif ($mta.nick($1,$4)) mta.text $1 $4 $+ 's Points: $calc($readini($scriptdir $+ points.ini,POINTS,$4)) else mta.text $1 $mta.nick($1,$2) $+ 's Points: $calc($readini($scriptdir $+ points.ini,POINTS,$mta.nick($1,$2))) } elseif ($3 == !resetpoints) && ($gus.level($1,$2) > = 7) { if (!$4) mta.pm $1 $2 Type !resetpoints else { mta.text $1 $mta.nick($1,$2) Has Reset $4 $+ 's Points. !writeini " $+ $scriptdir $+ points.ini" POINTS $4 0 } } } and here's a screenie of the "Oddness" :::EDIT::: Hrmm, after some testing, i have found somthing odd. if i type !points it will reply with [PHS]Dan[AU]'s Points: [PHS]Dan[AU]'s Points: 13 but if i type !points Ben[uK] it replys with Ben[uK]'s Points: 4 (thats if hes in the server, if the person isnt in the server it replys like this: !points Ben[uK] [PHS]Dan[AU]'s Points: 13 So its only Doubble responding when you type just !points i have a feeling that the problem is Here.... $calc($readini($scriptdir $+ points.ini,POINTS,$mta.nick($1,%a))) elseif ($mta.nick($1,$4)) mta.text $1 $4 $+ 's Points: $calc($readini($scriptdir $+ points.ini,POINTS,$4)) else mta.text $1 $mta.nick($1,$2) $+ 's Points: $calc($readini($scriptdir $+ points.ini,POINTS,$mta.nick($1,$2))) Noticing that the First line, and the Last line are EXACTLY the same Except, one ends in ($1,%a))) while the other ends in ($1,$2))) Link to comment
lil Toady Posted April 21, 2007 Share Posted April 21, 2007 atually they have a structure if,elseif,else, that means that if one of them has been called others cant. Prob ain't in the script, maybe you have another script loaded ? Link to comment
DazzaJay Posted April 21, 2007 Author Share Posted April 21, 2007 Nope, just a stock Gus, Auto Namekick script (i got bored of telling "Player" to change his name) and the points script as listed in my previous post. Link to comment
DazzaJay Posted April 21, 2007 Author Share Posted April 21, 2007 Oh, ben just asked me: "What about a !toppoints & !topscore command, that when used, shows the 3 highest scoring people's names and thier scores." im guessing that would be a tricky one to make tho. Link to comment
Scooby Posted April 21, 2007 Share Posted April 21, 2007 man why dont u just use my script? it has all these things already in it. Link to comment
DazzaJay Posted April 22, 2007 Author Share Posted April 22, 2007 well, when i was searching around a few months ago, this one was the best to suit what i mainly wanted. but yeah, iil have a look at yer script. (if i cant find it, iil post back here tomorow) (the forums search here is completly useless... i was searching for a money script before i figured it would be eaiaier to use the points script... my god, i found like, everything BUT what i was looking for.) Link to comment
Scooby Posted April 22, 2007 Share Posted April 22, 2007 no need to search far... the link is under my sig. or go to the prs topic. Link to comment
DazzaJay Posted April 22, 2007 Author Share Posted April 22, 2007 One really quick question, as this looks very familiar... (i think we have used these before) Is there 10 levels of admin like in the Gus script? Because i think we had your ones before and had to use Rcon to log in to admin... wich is the main reason why we didnt end up using them. Link to comment
Wheelburner Posted April 22, 2007 Share Posted April 22, 2007 Nope, there's rcon system Link to comment
DazzaJay Posted April 22, 2007 Author Share Posted April 22, 2007 Oh well, guess iil have to make do with what i have got. Link to comment
Scooby Posted April 22, 2007 Share Posted April 22, 2007 Oh well, guess iil have to make do with what i have got. i still dont see why thats a problem. i dont see the point in adding another login system to mta, when mta devs spent the time to include it for us, it works perfectly 100%, yet u prefer to use one that doesnt work properly just coz it has 10 levels and u dont have to login? ok well good luck to u. Link to comment
Dead-Inside Posted April 22, 2007 Share Posted April 22, 2007 You know what would be easier? Just include the level system into PRS (I'm not saying Scoob should do it, definently not), that way you don't have to do all of this stuff in your awesomly bad script and can instead enjoy the comfort of a fully working script that's a lot better than, well, anything else. That's what I would do, if I wanted it that way. Link to comment
Recommended Posts