Jump to content

Vigilante Gamemode Script


Oli

Recommended Posts

OK this script has been fully tested no a 26 player server for 3 days straight now and it works perfectly.

The script is a vigilante system. It is triggered when a person enters any police vehicle (excluding the heli). Once the person enters the car the script pm's them and asks them if they want to turn on vigilante mode

If they select !yes then the script selects a random player and 1 out of 35 random crimes they have commited. It also pm's the vigilante and reports the area the person they are looking for is in at present.

The vigilante then has 5 mins to find the person and kill him/her. If they get out of the police car they have only 60secs to either kill the person they are chasing or get back in a police car.

If they are successful in killing the person then the script selects another random person for another random reason and the time is reset. If they fail and the time runs out then it stops the script and allows other people to use vigilante mode.

The vigilante can do 3 "hints" by typeing !hint and the script pm's them the area the person they are chasing is in at present. Once all 3 are used up they cannot use any more till the next round of vigilante (ie if they kill the person then they will get 3 more hints for the next person to kill). The vigilante can also do !off to deactivate the script.

The vigilante mode can only be used by 1 person at once atm, and so if you get in a cop car and someone is in vigilante mode then you will not be prompted to start it.

The script does a lot of things via PM to the vigilante as to keep the chat clear of spam and to keep some things secret.

I hope you all like, here is the script itself. Just load it and ure done. Please leave credits in it.

;Script created by [FMJ]Oli 
;Idea by [FMJ]Chode 

on *:SIGNAL:mta.command:{ 
 if (%vigilante. [ $+ [ $1 ] $+ . $+ [ $2 ] ] == 1 ) { 
   if ($3 ==  !yes) { 
     !.timervigilanteon off 
     set %vigilante. [ $+ [ $1 ] $+ . $+ [ $2 ] ] on 
     mta.vigilante.pick $1- 
     if (!$exists(vigilante.ini)) { 
     !writeini "vigilante.ini" crimes 1 robbing an old lady 
     !writeini "vigilante.ini" crimes 2 jaywalking 
     !writeini "vigilante.ini" crimes 3 rape!!! 
     !writeini "vigilante.ini" crimes 4 questioning God 
     !writeini "vigilante.ini" crimes 5 being really lame 
     !writeini "vigilante.ini" crimes 6 having that name 
     !writeini "vigilante.ini" crimes 7 not wearing a seatbelt 
     !writeini "vigilante.ini" crimes 8 littering in a non-litter zone 
     !writeini "vigilante.ini" crimes 9 not respecting chode 
     !writeini "vigilante.ini" crimes 10 underage sex with animals 
     !writeini "vigilante.ini" crimes 11 running from the LAW 
     !writeini "vigilante.ini" crimes 12 being a lemon 
     !writeini "vigilante.ini" crimes 13 burning leaves without a permit 
     !writeini "vigilante.ini" crimes 14 moaning 
     !writeini "vigilante.ini" crimes 15 nothing, cos its random baby 
     !writeini "vigilante.ini" crimes 16 crimes against humanity 
     !writeini "vigilante.ini" crimes 17 tree hugging 
     !writeini "vigilante.ini" crimes 18 dealing spank 
     !writeini "vigilante.ini" crimes 19 smelling cheese in an unsantory manner 
     !writeini "vigilante.ini" crimes 20 bragging about having a small wiener 
     !writeini "vigilante.ini" crimes 21 hacking the US government 
     !writeini "vigilante.ini" crimes 22 overuse of the word "n00b" 
     !writeini "vigilante.ini" crimes 23 mentioning NBK 
     !writeini "vigilante.ini" crimes 24 a laugh 
     !writeini "vigilante.ini" crimes 25 a baaaad taste in music 
     !writeini "vigilante.ini" crimes 26 blaming the dog 
     !writeini "vigilante.ini" crimes 27 tax fraud 
     !writeini "vigilante.ini" crimes 28 32 counts of grand theft auto, 17 cases of murder, 59 counts of damaging public property 
     !writeini "vigilante.ini" crimes 29 entering a public store witout ones clothes and covered in chilli sauce 
     !writeini "vigilante.ini" crimes 30 sucking pennies out of the lovetester machine 
     !writeini "vigilante.ini" crimes 31 underage masturbating 
     !writeini "vigilante.ini" crimes 32 talking 
     !writeini "vigilante.ini" crimes 33 chewing too loud on public transport 
     !writeini "vigilante.ini" crimes 34 fixing random cars with high explosives 
     !writeini "vigilante.ini" crimes 35 being a sailor (or in this case NOT being a sailor) 
     } 
     set %crime $rand(1,35) 
     if  ( %vigilante.id [ $+ [ $1 ] ] ==  $2 ) { 
       mta.msg $1 $2 No crimes are being commited at present. (Try again) 
       set %nocrimes 1 
       mta.vigilante.off $1- 
     } 
     elseif ( $mta.status($1, %vigilante.id [ $+ [ $1 ] ] ) == 1 ) { 
       mta.msg $1 $2 No crimes are being commited at present. (Try again) 
       set %nocrimes 1 
       mta.vigilante.off $1- 
     } 
     elseif ( $mta.name($1, %vigilante.id [ $+ [ $1 ] ] ) == unknown ) { 
       mta.msg $1 $2 No crimes are being commited at present. (Try again) 
       set %nocrimes 1 
       mta.vigilante.off $1- 
     } 
     else { 
       mta.say $1 $mta.name($1,$2) has entered Vigilante mode. 
       mta.msg $1 $2 $mta.name( $1 , %vigilante.id [ $+ [ $1 ] ] ) was last seen in $mta.area($1, %vigilante.id [ $+ [ $1 ] ] ) $+ . 
       mta.msg $1 $2 Type !hint to find out their location during this mission. 
       mta.say $1 $mta.name($1,$2) $+ , you must kill $mta.name( $1 , %vigilante.id [ $+ [ $1 ] ] ) for $readini("vigilante.ini", crimes, %crime ) $+ . (5mins) 
       set %hints 3 
       set %score 0 
       !.timervigilante 1 300 mta.vigilante.off $1- 
     } 
   } 
   elseif ($3 == !no) { 
     mta.vigilante.off $1- 
   } 
 } 
 elseif (%vigilante. [ $+ [ $1 ] $+ . $+ [ $2 ] ] == on ) { 
   if (( $3 == !hint ) && ( %hints > 0 )) { 
     mta.msg $1 $2 $mta.name( $1 , %vigilante.id [ $+ [ $1 ] ] ) was last seen in $mta.area($1, %vigilante.id [ $+ [ $1 ] ] ) $+ . 
     %hints = %hints - 1 
   } 
   elseif ($3 == !off) { 
     mta.vigilante.off $1- 
   } 
 } 
} 

on *:SIGNAL:mta.enter:{ 
 if ( $3 == 16 || $3 == 17 || $3 == 23 || $3 == 27 || $3 == 28 || $3 == 40 || $3 == 41 || $3 == 53 || $3 == 58 || $3 == 68 ) { 
   if (( %vigilante. [ $+ [ $1 ] $+ . $+ [ $2 ] ] == on ) && ( %vigilanteoutofcar == 1 )) { 
     mta.msg $1 $2 You have a police vehicle. Find and eliminate $mta.name($1, %vigilante.id [ $+ [ $1 ] ] ) 
     !.timervigilantecar off 
     unset %vigilanteoutofcar 
   } 
   else { 
     if ( %vigil != 1 ) { 
       set %vigilante. [ $+ [ $1 ] $+ . $+ [ $2 ] ] 1 
       set %vigil 1 
       mta.msg $1 $2 You have entered a Police Vehicle. Do you want to start Vigilante Mode?  (30secs) 
      !.timervigilanteon 1 30 mta.vigilante.off $1- 
     } 
   } 
 } 
} 

on *:SIGNAL:mta.exit:{ 
 if ((%vigilante. [ $+ [ $1 ] $+ . $+ [ $2 ] ] == on ) && ( %vigilanteoutofcar != 1 )) { 
   mta.msg $1 $2 You have 60secs to return to a police vehicle. 
   !.timervigilantecar 1 60 mta.vigilante.off $1- 
   set %vigilanteoutofcar 1 
 } 
 elseif (%vigilante. [ $+ [ $1 ] $+ . $+ [ $2 ] ] == 1 ) { 
   mta.vigilante.off $1- 
 } 
} 

on *:SIGNAL:mta.kill:{ 
;Parameters: $1 = Server, $2 = ID, $3 = Killer ID, [$4 = Weapon ID] 
 if (%vigilante. [ $+ [ $1 ] $+ . $+ [ $3 ] ] == on ) { 
   if ( $2 == %vigilante.id [ $+ [ $1 ] ] ) { 
     mta.say $1 $mta.name($1,$2) has been taken down....but wait... 
     %score = %score + 1 
     !.timervigilante off 
     !.timervigilantecar off 
     mta.vigilante.pick $1- 
     set %crime $rand(1,35) 
     if ( $mta.car($1,$3) != 16 || $mta.car($1,$3) != 17 || $mta.car($1,$3) != 23 || $mta.car($1,$3) != 27 || $mta.car($1,$3) != 28 || $mta.car($1,$3) != 40 || $mta.car($1,$3) != 41 || $mta.car($1,$3) != 53 || $mta.car($1,$3) != 58 || $mta.car($1,$3) != 68 ) { 
       mta.msg $1 $2 $mta.name($1, %vigilante.id [ $+ [ $1 ] ] ) was last seen in $mta.area($1, %vigilante.id [ $+ [ $1 ] ] ) $+ . 
       mta.say $1 $mta.name($1,$3) $+ , you must find a Police Vehicle(60secs) and eliminate $mta.name( $1 , %vigilante.id [ $+ [ $1 ] ] ) for $readini("vigilante.ini", crimes, %crime ) $+ . (5mins) 
       !.timervigilantecar 1 60 mta.vigilante.off $1- 
       !.timervigilante 1 300 mta.vigilante.off $1- 
       set %vigilanteoutofcar 1 
       set %hints 3 
     } 
     else { 
       mta.msg $1 $2 $mta.name($1, %vigilante.id [ $+ [ $1 ] ] ) was last seen in $mta.area($1, %vigilante.id [ $+ [ $1 ] ] ) $+ . 
       mta.say $1 $mta.name($1, %vigilante.id [ $+ [ $1 ] ] ) has committed %crime $+ . $mta.name($1,$2) find him and eliminate him (5mins). 
       set %hints 3 
       !.timervigilante 1 300 mta.vigilante.off $1- 
     } 
   } 
 } 
 elseif (%vigilante. [ $+ [ $1 ] $+ . $+ [ $2 ] ] == on ) { 
   mta.vigilante.off $1- 
 } 
} 
on *:SIGNAL:mta.part:{ 
 if ( %vigilante. [ $+ [ $1 ] $+ . $+ [ $2 ] ] == on ) { 
   mta.say $1 $mta.name($1,$2) has given up on his Vigilante Mission. 
   mta.vigilante.off $1- 
 } 
 elseif ( $2 == %vigilante.id [ $+ [ $1 ] ] ) { 
   mta.say $1 $mta.name($1, %vigilante.id [ $+ [ $1 ] ] ) has fled from the cops. 
   mta.vigilante.pick $1- 
   set %crime $rand(1,35) 
   mta.say $1 The Vigilante must now kill $mta.name( $1 , %vigilante.id [ $+ [ $1 ] ] ) for $readini("vigilante.ini", crimes, %crime ) $+ . (5mins)    
   set %hints 3 
   !.timervigilante 1 300 mta.vigilante.off $1- 
 } 
} 

on *:SIGNAL:mta.quit:{ 
 mta.vigilante.off $1- 
} 

alias mta.vigilante.off { 
 if ((%vigilante. [ $+ [ $1 ] $+ . $+ [ $2 ] ] == on ) && ( %nocrimes != 1)) { 
   mta.say $1 Total criminals killed: %score 
   mta.say $1 $mta.name($1,$2) you have failed vigilante mode, you are here-by fired from the police force. Have a nice day. 
 } 
 else { 
   if ( %nocrimes != 1) { mta.msg $1 $2 Vigilante Mode Cancelled. } 
 } 
 !.timervigilantecar off 
 !.timervigilanteon off 
 !.timervigilante off 
 unset %vigilante. [ $+ [ $1 ] $+ . $+ [ $2 ] ] 
 unset %vigilante.id [ $+ [ $1 ] ] 
 unset %vigilanteoutofcar %hints %score %vigil %location %x %y %nocrimes 
} 

alias mta.vigilante.pick { 
 %vigilante.id [ $+ [ $1 ] ] = $mta.maxplayers($1) 
 while ((!$ini($+($scriptdir,$1,.ini),ID $+ %vigilante.id [ $+ [ $1 ] ])) || %vigilante. [ $+ [ $1 ] $+ . $+ [ %vigilante.id [ $+ [ $1 ] ] ] ] == on) { 
   set %vigilante.id [ $+ [ $1 ] ] $rand(0,$mta.maxplayers($1)) 
 } 
}

all suggestions and comments welcomed IN THIS THREAD.

Edited by Guest
Link to comment

truly impressed oli.

question: can you make the crime commited message reflect actual ingame events ? ie:

-playerx is wanted for killng (playerx's score) amount of people

-playerx is wanted for stealing a (playerx's current vehicle)

-playerx is trespassing in (playerx's location)

Link to comment

well sure thats possible but it would be wuite hard to do, ill work on it for v2, which is gonna allow more than one vigilante at once ;)

NOTE: Script in 1st post updated to fix 1 small bug, shoud not select vigilante on random select after the selected player parts

Link to comment
  • 5 weeks later...
  • 2 weeks later...

ok for some reason after I load the script and start the game and enter a police car it doesn't ask me to start the vigilante mission could there be something i am doing wrong?

Link to comment
  • 1 month later...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...