Jump to content

damnet007

Members
  • Posts

    87
  • Joined

  • Last visited

Everything posted by damnet007

  1. lol i'm still not 100% sure what you want, but how about this: if ($chr(33) isin $4) !return $remove($4,$chr(33)) but that won't work well if the ! isnt at the start- if someone typed ... !blah!kjd
  2. If you're trying to do what I think, use "isin" if (... isin $4) or if (... isin $4-)
  3. i sorted this a while ago by using a different while loop and a snippet from toady's mta.longsay alias, works perfectly now and squall if you don't understand it or don't have anything useful to say, keep out; i posted for help and that's what i got.
  4. damnet007

    !rank script

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

    !rank 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.
  6. damnet007

    !rank script

    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)
  7. !writeini -n " $+ $scriptdir $+ bla.ini" bla bla $calc($readini(bla.ini,bla,bla) + 1)
  8. Sorry, didn't see your post until now. Basically, you can hold an unlimited amount of items. These items are made by other users who own factories, etc. When a factory owner produces an item, they specify which category the item goes into. These item categories are stored in things.ini and everything has already been scripted. The reason I posted here was because I needed a script to find all items owned by a person, which are in the 'food' category- all my scripting attempts worked fine on my pc but kept causing mtama to time out on the scripts host pc when someone typed !food - i think the script took up a lot of cpu usage when run, and that's why I posted here, to try and find a better way to do it.
  9. thanks for the script toady, but I had an error in the line assigning %c and the last mta.say line. I've done this and it seems to work although it won't show any food items which don't fit into the first mta.say line (if this makes sense): alias showfood { var %a = 0,%b,%c if (!$ini(rpg.ini,$mta.name($1,$2),1)) mta.say $1 $mta.name($1,$2) has no food. else { while (%a <= $ini(rpg.ini,$mta.name($1,$2),0)) { %b = $ini(rpg.ini,$mta.name($1,$2),%a) if ($readini(rpg.ini,$mta.name($1,$2),%b) > 0) { if ($readini(things.ini,food,%b) == 1) { %c = $iif(%c,%c $+ $chr(44) $+(%b,$chr(40),$readini(rpg.ini,$mta.name($1,$2),%b),$chr(41)),$+(%b,$chr(40),$readini(rpg.ini,$mta.name($1,$2),%b),$chr(41))) } } !inc %a } mta.longsay $1 $mta.name($1,$2) $+ 's food: $iif(%c,$v1,None) } } alias mta.longsay { var %a = 1,%b while (%a <= $numtok($3-,32)) { if ($calc($len(%b) + $len($gettok($3-,%a,32))) <= 115) %b = $iif(%b,%b $gettok($3-,%a,32),$gettok($3-,%a,32)) else { mta.say $1 %b %b = $null } !inc %a } if (%b) mta.say $1 %b }
  10. I'm trying to optimize this script/find another, more efficient way of doing this: - A person's item data is stored in an ini file, eg rpg.ini : [name] item1=amount item2=amount ... - All the items are classified into different categories, in another ini, eg. things.ini: [food] item=1 item2=1 item3=1 ... [drinks] item1=1 item2=1 ... The script checks all of the user's items and if an item from rpg.ini is in the food section of things.ini, it adds them to the list of food items they have. I made this a little while ago and it seems to work perfectly on my PC, but not on the PC where I run scripts. Any ideas how this could be done? My script's below: alias showfood { var %b = 0,%d = 0,%c,%e,%f,%g,%h while (%b <= $ini(rpg.ini,$mta.name($1,$2),0)) { if ($readini(rpg.ini,$mta.name($1,$2),$ini(rpg.ini,$mta.name($1,$2),%b)) > 0) && ($readini(things.ini,food,$ini(rpg.ini,$mta.name($1,$2),%b)) == 1) { if (!%c) %c = $ini(rpg.ini,$mta.name($1,$2),%b) $+ ( $+ $readini(rpg.ini,$mta.name($1,$2),$ini(rpg.ini,$mta.name($1,$2),%b)) $+ ) elseif (%c) { %c = %c $+ $chr(46) $ini(rpg.ini,$mta.name($1,$2),%b) $+ ( $+ $readini(rpg.ini,$mta.name($1,$2),$ini(rpg.ini,$mta.name($1,$2),%b)) $+ ) %d = %d + 1 if %d > 5 { %h = $gettok(%c,24-29,46) %g = $gettok(%c,18-23,46) %f = $gettok(%c,12-17,46) %e = $gettok(%c,6-11,46) %c = $gettok(%c,1-5,46) } } } !inc %b } mta.msg $1 $2 $mta.name($1,$2) $+ : $iif(%c,%c,No Food) if (%e) mta.msg $1 $2 Food: %e if (%f) mta.msg $1 $2 Food: %f if (%g) mta.msg $1 $2 Food: %g if (%h) mta.msg $1 $2 Food: %h } The reason I have %e - %h is because there are loads of different food items a person can have, and mta has that text limit thanx
  11. %a is a variable, $4 is a parameter. you have to assign value(s) to a variable in most cases, and most common variables are only present within specific functions/aliases, eg: if you have a script to count from 'x' to 0, you could use a variable (name it whatever you want), and do it like this: on *:SIGNAL:mta.command:{ if ($3 == !count) { if ($4) && ($4 isnum) && ($4 > 1) { <-- $4 is the 2nd word a person would say in a sentence. If i typed '!count 200' then $4 would be '200' var %x = $4 <-- Assign variable x - it has been made equal to $4 as this is the value we are counting down from. while %x > 0 { mta.say $1 Countdown: %x !dec %x } } else mta.msg $1 $2 Error - Syntax: !count } } This should show you that variables and parameters are different %a could return any value you set it to return, $4 is usually an assigned constant. That's how i look at it anyway, i didn't learn from any tuts etc so i make up my own ways of understanding (lol)
  12. remove the 'if (%a != -1)' line and the bracket which goes with it. if u want, add me on msn i'll help you out
  13. something like this: on *:SIGNAL:mta.command:{ if $readini(bla.ini,admin,$mta.name($1,$2)) == 1 { var %a = $iif($4 == $null,$2,$iif($mta.name($1,$4) != Unknown,$4,$mta.getid($1,$4))) if (%a != -1) { if ($3 == !slap) mta.slap $1 %a elseif ($3 == !kick) mta.kick $1 %a etc... } else mta.msg $1 $2 Error - Absent Nick/ID } } bla.ini: [admin] name=1 name2=1 etc.
  14. most admin scripts i've seen use a level system, and check if the user's level is high enough to use the command: alias level !return $iif($readini(bla.ini,$mta.name($1,$2),level),$v1,0) on *:SIGNAL:mta.command:{ if $level($1,$2) > 1 { if ($3 == !slap) mta.slap ... } } otherwise, you could add the names to a txt/ini file and check if they're name is within the file- for an ini, something like this: on *:SIGNAL:mta.command:{ ... if $readini(bla.ini,admin,$mta.name($1,$2)) == 1 { ... } } and bla.ini looks like this: [admin] name1=1 name2=1 name3=1 etc... you could do it using a txt file too but i think the ini would be better as you'd have to use a loop to check line(s) of the txt file for an admin name. this is just what i'd do anyway
  15. damnet007

    findfile

    this is why mtavc needs to be updated
  16. nvm, re-scripted it and it works perfectly now. i had already reinstalled mtama but that didn't work, and it was within its own script file. thanx EDIT: Just noticed that I still get the crc error when certain users join, or if I check the host of certain users. It works fine for the rest on *:DNS:{ if (%cc == 1) { !tokenize 32 %gh if ($1) { if ($dns(0).addr) mta.msg $1 %pff $mta.name($1,$2) $+ 's host: $dns(0).addr mta.msg $1 %pff Main: $gettok($dns(0).addr,3-6,46)) else mta.msg $1 %pff Unable to resolve $mta.name($1,$2) $+ 's host. unset %cc unset %pff } unset %gh } elseif (%cc == 3) { !tokenize 32 %gh if ($1) { if ($dns(0).addr) { !writeini -n " $+ $scriptdir $+ badnicks.ini" hosts $gettok($dns(0).addr,3-6,46)) 1 mta.msg $1 %pff $mta.name($1,$2) $+ 's main host: $gettok($dns(0).addr,3-6,46)) has now been banned. mta.kick $1 $2 unset %cc unset %pff } else mta.msg $1 %pff Unable to resolve $mta.name($1,$2) $+ 's host- Host Ban Failed! } unset %gh } elseif (%cc == 2) { !tokenize 32 %gh if ($1) { if ($dns(0).addr) { if $readini(badnicks.ini,hosts,$gettok($dns(0).addr,3-6,46)) == 1 { mta.kick $1 $2 unset %cc } } } unset %gh } } on *:SIGNAL:mta.command:{ var %a = $iif($4,$iif($mta.name($1,$4) != Unknown,$4,$mta.getid($1,$4)),$2) if ($3 == !host) { set %gh $1 %a set %pff $2 set %cc 1 !.dns $mta.ip($1,%a) } elseif ($3 == !hostban) { if ($mta.name($1,%a) != unknown) && ($mta.name($1,$2) != $mta.name($1,%a)) { set %gh $1 %a set %pff $2 set %cc 3 !.dns $mta.ip($1,%a) } else mta.msg $1 $2 Error - Can not ban Absent Nick/ID/Yourself } } on *:SIGNAL:mta.join:{ set %cc 2 set %gh $1 $2 !.dns $mta.ip($1,$2) }
  17. ye i've corrected the on join one now but still having the crc error mentioned in my first post. thanx
  18. ah ye woops, i'll change that and retry, thanx. EDIT: %cc is already set before dns is called on the command signal though, isn't it? set %cc 1 !.dns $mta.ip($1,%a)
  19. on *:DNS:{ if (%cc == 1) { !tokenize 32 %gh if ($1) { if ($dns(0).addr) mta.msg $1 %pff $mta.name($1,$2) $+ 's host: $dns(0).addr mta.msg $1 %pff Main: $gettok($dns(0).addr,2-6,46)) else mta.msg $1 %pff Unable to resolve $mta.name($1,$2) $+ 's host. } unset %gh } elseif (%cc == 2) { !tokenize 32 %gh if ($1) { if $readini(badnicks.ini,hosts,$gettok($dns(0).addr,2-6,46)) == 1 { mta.kick $1 $2 } unset %gh } } } on *:SIGNAL:mta.command:{ var %a = $iif($4,$iif($mta.name($1,$4) != Unknown,$4,$mta.getid($1,$4)),$2) if ($3 == !host) { set %gh $1 %a set %pff $2 set %cc 1 !.dns $mta.ip($1,%a) } } on *:SIGNAL:mta.join:{ set %gh $1 $2 !.dns $mta.ip($1,$2) set %cc 2 } I can check my host fine but if i were to check another user's host I get an mtama crc check error, any ideas?
  20. As far as I remember, I had to browse to my VC folder and set the files altered by MTA to accessible for all - give every single user/process full access to the files- I think weapon.dat was one of those files. After that MTAVC worked fine for me, I'm no longer on Vista though as i preferred XP after all, so i couldn't tell you exactly what I did. Just fiddle with the permissions
  21. on *:SIGNAL:mta.command:{ if ($3 == !hello) { mta.ban $1 $2 HELLO } } wow toady you're expertise in this script are remarkable! i've not seen such a good script in my life!
  22. you could say mta.ban (id of the servers) $2 eg: if ($3 == !addban) { var %poo = .......... (to get id etc) ..... mta.ban 1 %poo mta.ban 2 %poo mta.ban 3 %poo } ... (if you're using mtama then 1, 2 & 3 are the first 3 server tabs respectively)
  23. ye there are a lot of servers which have this script..
×
×
  • Create New...