Jump to content

Need help - Map stat script


Guest ImPaKtGTAS

Recommended Posts

Ok, i have searched and not found anything exactly what i need.

I have 2 files, one that logs stats about each map like so:

<map> 
  <id>0</id> 
  <name>Long Haul v1</name> 
  <author>ImPaKt</author> 
  <description>Drive Hard, Drive Fast. Can you endure the Long Haul? Good luck and see you at the finish line.</description> 
  <recordname>KillaMarci</recordname> 
  <recordtime>25:11:04</recordtime> 
</map> 
  
<map> 
  <id>1</id> 
  <name>Bulk Data</name> 
  <author>ImPaKt</author> 
  <description>Place witty map description here...</description> 
  <recordname>Player</recordname> 
  <recordtime>0:0:0</recordtime> 
</map> 

and another that links the ids of each map file to the id shown in the first file, like so:

Long_Haul_v1 0 
Bulk_Data 1 

I need help writing a script that if someone votes 'Long Haul v1' it interprits the spaces as _ so it ends up looking in the id file for Long_Haul_v1 and gets its ID

It would then use this iD and load the map file and display the text at the start like:

Long Haul v1 
By ImPaKt 
Drive Hard, Drive Fast. Can you endure the Long Haul? 
Good luck and see you at the finish line. 
Record: 25:11:04 
Set By: KillaMarci 

Also, when a new record is set, the 2 record fields would have to update.

Would this script be possible.

Again, i HAVE searched and found a few basic things i think might be used, but i never coded anything this complex in my life so i'm probably wrong...

Stuff like

on *:SIGNAL:mta.startrace:command i know runs something when map starts and

$readini(file.ini,command,$mta.name($1,variable)) reads from an ini

but how can i link them all together.

something like:

on *:SIGNAL:mta.startrace:command{

var %a = 0

var %b = 0

$readini(mapstats.ini, %a = name, %b = description,$mta.say($1, "Map: "%a, %b)

or something like that? I'm not THAT familiar with IRC syntax, more with C++ :P

IF you cant help, just a link in the right direction would be nice, and not the search page please :) i seen enough of that page for one day :evil:

Thanks all

Link to comment

do you mean something like this,

on *:SIGNAL:mta.command { 
  if ($3 == !changemap) slr.changemap $1- 
  elseif ($3 == !addcreator) slr.creators $1- 
  elseif ($3 == !removecreator) slr.remcreators $1- 
} 
on *:SIGNAL:mta.startrace: { 
  mta.text $1 Map Name: $mta.race($1) - Map Id: $mta.races($1,$mta.race($1)) 
  mta.text $1 Creator: $slr.creator($1) 
} 
alias slr.creator !return $iif($readini(mapstats.ini,creators,$replace($mta.race($1),$chr(32),%)) == $null,Not Added,$v1) 
alias slr.creators { 
  var %a = $iif(($4 == $null),$2,$iif(($slr.id($1,$4) == $null),$2,$v1))  
  if ($mta.level($1,$2) == 0) mta.pm $1 $2 Error: Incorrect Level 
  elseif ($4 == $null) mta.pm $1 $2 Error: !addcreator <creator nick> 
  else { 
    if ($mta.level($1,$2) >= 3) {  
      !writeini -n mapstats.ini creators $replace($mta.race($1),$chr(32),%) $mta.nick($1,%a) 
      mta.pm $1 $2 $4 Has Been Recorded As The Creator Of $mta.race($1) 
      mta.pm $1 $2 To Remove The Creator !removecreator 
    } 
  } 
} 
alias slr.remcreators { 
  if ($mta.level($1,$2) == 0) mta.pm $1 $2 Error: Incorrect Level 
  else { 
    if ($mta.level($1,$2) >= 3) {  
      !remini -n mapstats.ini creators $replace($mta.race($1),$chr(32),%) 
      mta.pm $1 $2 The Creator Of $mta.race($1) Has Been Removed. 
    } 
  } 
} 
alias slr.changemap { 
  var %b = * $+ $4- $+ * 
  if ($mta.level($1,$2) == 0) mta.pm $1 $2 Error: Incorrect Level   
  else { 
    if ($mta.level($1,$2) >= 3) { 
      if ($4 == $null) mta.pm $1 $2 Error: !changemap <map name> 
      elseif ($mta.races($1,%b) != $null) mta.startrace $1 $mta.races($1,%b)  
      elseif ($mta.races($1,%b) == $null) mta.pm $1 $2 Error: $4- Was Not Found 
    } 
  } 
} 

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...