Jump to content

MTA:MA Scripting


Harry

Recommended Posts

  • Replies 357
  • Created
  • Last Reply

Top Posters In This Topic

oli makes some awsome scripts but i cant find a RPG+DM server

can you make one were it says

!suspect (nick)(reason) makes a player wanted

!jail (nick)

!ch (nick) Challnge player

can you make more for me i wanted to no if u had the best scripts

p.s how do i make scripts?

Link to comment
  • 2 weeks later...

ok you scripters needing a challenge or just a task, i need a "Nuke" script.

for instance its like a car bomb script but for places. you buy a nuke at the military base for 10,000,000 or whatever... then type !nuke and it kills everyone in that area..

if sumone can help me id greatly appreciate it..

also, simple script would also be appreciated.

eg:

    if ($3 == !skin) {
    if ($4 == $null) {
     mta.say $1 $mta.name($1,$mta.findid($1,$2)) - Skin: %b
    }
    else {
     mta.say $1 $mta.name($1,$mta.findid($1,$4)) - Skin: %c
    }
   }
   if ($3 == !forums) {
     mta.say $1 Be sure to visit http://urbanwarriors.7.forumer.com
   }
   if ($3 == !showroom && $mta.level($1,$2) == 5) {
       mta.msg $1 $2 Sunshine Autos: $readini(RPG2.txt, Cash, Showroom)
   }

and not like this...

}
alias rpg.clanscan {
 var %a = 0,%b,%b,%d
 while %a < $mta.maxplayers($1) {
   if $rpg.isclan($1,%a) == $true {
     var %b = 0,%c = 1
     while %b < $mta.maxplayers($1) {
       if $rpg.isclan($1,%b) == $true && $mta.name($1,%b) != $mta.name($1,%a) && $rpg.clan($1,%a) == $rpg.clan($1,%b) {
         !inc %c
       }
       !inc %b
     }
     if %d { %d = %d $+ , $rpg.clan($1,%a) $+ ( $+ %c $+ ) }
     else %d = $rpg.clan($1,%a) $+ ( $+ %c $+ )
   }
   !inc %a
 }
 if %d { !return %d }
 else !return None
} 

thanks.

Link to comment

hi, im not really a error fixer with scripts but i really dont get wtf is happening here:

k lets say i have this:

on *:SIGNAL:mta.command:{

if ($3 == !blah) {

mta.say $1 Blah

}

then on MIRC it says:

* /if: close bracket not found (line 2, blah.mrc)

and as u can see i HAVE The bracket {

also

when i have 2 ON signals in the same file like:

on *:SIGNAL:mta.command:{

if ($3 == !blah) {

mta.say $1 Blah

}

on *:SIGNAL:mta.join:{

mta.say $1 Blah

}

the 2nd on signal doesnt work. please help!

Link to comment
hi, im not really a error fixer with scripts but i really dont get wtf is happening here:

k lets say i have this:

on *:SIGNAL:mta.command:{

if ($3 == !blah) {

mta.say $1 Blah

}

then on MIRC it says:

* /if: close bracket not found (line 2, blah.mrc)

and as u can see i HAVE The bracket {

also

when i have 2 ON signals in the same file like:

on *:SIGNAL:mta.command:{

if ($3 == !blah) {

mta.say $1 Blah

}

on *:SIGNAL:mta.join:{

mta.say $1 Blah

}

the 2nd on signal doesnt work. please help!

Because you arent closing the on *:SIGNAL:mta. {. It needs to be

on *:SIGNAL:mta.command:{
if ($3 == !blah) {
mta.say $1 Blah
}
}
on *:SIGNAL:mta.join:{
mta.say $1 Blah
}
}

Link to comment

Hey,

This might not be revolving around what you were talking about, but many people ask so i post.

$mta.nick = MTASA

$mta.name = MTAVC

mta.pm = MTASA

mta.msg = MTAVC

mta.text = MTASA

mta.say = MTAVC

thats about it, please look in aerons html file for further info.

Cya,

[XE]Tommis

Link to comment
jeremy ive tried your advice, still isnt working It says:

/on: not connected to server

and the 2nd and 3rd etc on signals still dont work

on *:SIGNAL:mta.command:{
if ($3 == !blah) {
mta.say $1 Blah
}
}
on *:SIGNAL:mta.join:{
mta.say $1 Blah
}

:P

Link to comment
  • 2 weeks later...

The $2 parameter IS the player's id, you use it to gather other information about the player.

Unless you mean how to get a player's ID if you have their name (so the opposite). There is a command $mta.getid(SERVERID,NAME).

So if i was MTAPlayer and you wanted my ID (and say it was 11), if you used the command $mta.getid(SERVERID,MTAPlayer), it would simply return "11". This also works for wildcard searches, so $mta.getid(SERVERID,MTA) would also return "11" if there was noone in the server who also had MTA within their name (and if they did, be more specific on the name :P)

It's actually detailed in the manual you get with MTAMA if you want to look it up further..

- Bungle

Link to comment
  • 3 weeks later...

ook... anyways.... i am having issues with places commands. the following doesnt read its location its supposed to. HELP!

 if ($3 == !place) {
     var %a = $mta.area($1,$2)
     if (%a == Vice-City) {
       mta.msg $1 $2 There is no property at your current location
     }
     else {
       mta.say $1 %a --- Owner: $readini(vcpdata.txt, %a, Owner) --- Price: $calc($readini(vcpdata.txt, %a, Price) + 1)
     }
   }

Ok, so you guys know, its in brackets correctly and everything, just keeps bringing back this...

Sunshine_Autos --- Owner: --- Price: 1

Which is like, not even close. The vcpdata.txt shows this...

[sunshine_Autos]
Owner=FOR SALE
Price=100000

Please help.

Link to comment

You're trying to read a text file with the $readini function.

Try the following:

if ($3 == !place) {
 var %a = $mta.area($1,$2)
 if (%a == Vice-City) {
   mta.msg $1 $2 There is no property at your current location
 }
 else {
   mta.say $1 %a --- Owner: $read(vcpdata.txt, %a, Owner) --- Price: $calc($read(vcpdata.txt, %a, Price) + 1)
 }
}

Or you could even just rename vcpdata.txt to vcpdata.ini as use the code you were using before.

Gl :)

Link to comment
You're trying to read a text file with the $readini function.

Try the following:

if ($3 == !place) {
 var %a = $mta.area($1,$2)
 if (%a == Vice-City) {
   mta.msg $1 $2 There is no property at your current location
 }
 else {
   mta.say $1 %a --- Owner: $read(vcpdata.txt, %a, Owner) --- Price: $calc($read(vcpdata.txt, %a, Price) + 1)
 }
}

Or you could even just rename vcpdata.txt to vcpdata.ini as use the code you were using before.

Gl :)

Extension doesn't matter for mIRC, if you want to read a file as IN, mIRC tries.

Link to comment

Okay, i found out my problem. Heres the scenario...

I have many many issues with windows, which makes my machine frequently crash. To prevent loss of data, i made a "D:\" format. This has my mIRC on it. When i moved my files onto my disk drive or c:\, the vcpdata.txt was in there.So when i ran the script D:\, there was no vcpdata.txt in that folder with mirc. so it couldnt find it... too many dupicatates.... :P i thot it was a recurring error i had previously.

ok so thats one problem solved... My next question is ... lets say i want a person to stay in a certain area for, lets say, 5 minutes.... For example, Sunshine Autos, How would i go about doing that...?

this confuses me.

Link to comment

You'd need a good way of checking if they're still in it, calling mta.area frequently for all the players in a busy server get's very cpu hogging.

Then once they're there, save the time (i'd use $ticks, which returns the ammount of miliseconds since system startup), and compare with the current ticks, to see how long they've been there.

Link to comment

No, they're not.. although, if you think about it logically, it's only gonna get out of the while loop, and to the else if it isn't true anymore, so it's not even needed.

You need to understand how programs work, they're all constant loops, once it's finished running the code, it'l go over it all again.. so mirc will read through the script, then it has to do its own stuff and loop over and over.

Basically, that while loop you have there is going to freeze mirc until that statement isn't true, you'll need to check it with a timer or something.

Link to comment

well idk if it helps much, but so you know, i am trying to make a custom jobs script, but i am having a hard time with it. I have the format to setup multiple jobs, via .ini, but i cannot make sure that if they are on a job, they stay in their job area assigned. HElp.

Link to comment

Maybe you should work your way upto it, start off with something smaller, but a good way would be to make some other events.. eg:

on *:SIGNAL:mta.connect: mta.areacheck $1
on *:SIGNAL:mta.disconnect: $+(!.timerareacheck,$1) off
on *:SIGNAL:mta.quit:{
 var %a = 1
 while (%a <=  {
   $+(!.timerareacheck,%a) off
   !inc %a
 }
}

alias mta.areacheck {
 var %a = 0
 while (%a < $mta.maxplayers($1)) {
   if ($mta.name($1,%a) != Unknown) {
     if ($mta.area($1,%a) != $readini(areas.ini,$+($1,%a),current)) {
       !writeini areas.ini $+($1,%a) prev $v2
       !writeini areas.ini $+($1,%a) current $v1
       mta.areachange $1 %a $v1
     }
   }
   !inc %a
 }
 $+(!.timerareacheck,$1) 1 $mta.players($1) mta.areacheck $1
}

alias mta.areachange {
 mta.say $1 $mta.name($1,$2) moved from $readini(areas.ini,$+($1,$2),prev) to $3-
}

It's just an example, so it might not even work, but you get the idea.

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...