Jump to content

lastvisit


BetaDevil

Recommended Posts

Posted
Is it possible when players leave the server it will save the time and date, what signal do I have to use?

I use MTA:SA

Probably something like this:

on *:SIGNAL:mta.disconnect:command: {
 ;Parameters:
 ;$1 = Server
 ;$2- = Reason
 var %time = $mta.time($1)
 !writeini -n " $+ $scriptdir $+ last.ini" LASTVISIT $mta.ip($1,$2) %time
}

on *:SIGNAL:mta.join:command: {
 ;Parameters:
 ;$1 = Server
 ;$2 = PlayerID
 mta.text $1 Last visit on $+ : $iif($readini($scriptdir $+ last.ini,LASTVISIT,$mta.ip($1,$2)),$readini($scriptdir $+ last.ini,LASTVISIT,$mta.ip($1,$2)),Not Found)
}

Or something similair, but i don't know if mta.time is ingame or outgame time.

Posted

mta.disconnect is triggered when mtama disconnects. and you dont need to type 'command' after a triger.

on *:SIGNAL:mta.part:{
 !writeini " $+ $scriptdir $+ lastseen.ini" $mta.nick($1,$2) date $date
 !writeini " $+ $scriptdir $+ lastseen.ini" $mta.nick($1,$2) time $time
}
on *:SIGNAL:mta.command:{
 if ($3 == !lastseen) {
   if ($4) {
     if ($readini($scriptdir $+ lastseen.ini,$4,time)) mta.text $1 $4 has been last seen on $readini($scriptdir $+ lastseen.ini,$4,date) at $readini($scriptdir $+ lastseen.ini,$4,time)
     else mta.text $1 $4 has never been seen on the server
   }
   else mta.text $1 Missing nick
 }
}

Do not PM me, im not going to read it anyway.

Posted

After entering that script in my file, everytime I use a command this line shows up in mIRC:

/on: not connected to server (line 234, mtaclan.mrc)

Line 234 - 237:

on *:SIGNAL:mta.part: {
 !writeini " $+ $scriptdir $+ clan.ini" $mta.nick($1,$2) date $date
 !writeini " $+ $scriptdir $+ clan.ini" $mta.nick($1,$2) time $time
}

Posted

probably forgot to close the "on *:SIGNAL:mta.command: part above it

code is always in tidy blocks

if ($3 == hello) {

mta.text $1 Hello World

}

but each part of code needs to be inside a block too

on *:SIGNAL:mta.command: {

"if code" { do }

}

so .. you may have overwriten a }

on *:SIGNAL:mta.anything: 
 {
"if code"  { do }

}               <---- so this one might have accidentally been removed

on *:SIGNAL:mta.part: 
  {
  code
  }
}

and if the block isnt closed commands from the next block wil be inside the first block - so imho thats why your new code that only should be executed once a player parts is executed whenever someone types a ! type command

coz_sig_oob.png

Server Blog | Server quickinfo

STFU and dont bug the mta team with ''when is DM comming''

or risk theyre spending more time explaining they're still working on DM than actually getting work done :shock:

  • Recently Browsing   0 members

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