• Welcome to Vice City Multiplayer.
 

Simple gotoloc and saveloc for SanSan

Started by Force, July 26, 2008, 03:34:09 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Force

I got bored just now and decided to whip up a quick gotoloc and saveloc script for sansan. Admittedtly the alias's have come from Tommis' GUS 9.0 ;)

on *:SIGNAL:vcmp.event.gamecmd {


  elseif ($2 == !gotoloc) {
    if (!$3) vcmp.adminmsg $1 Error - Missing Information, $2 <Name>
    elseif (!$vcmp.name.getloc($3-)) vcmp.adminmsg $1 Error - Absent/Wrong Location Name
    else {
      vcmp.adminmsg $1 Taking you to location name: $chr(91) $vcmp.name.getloc($3-) $chr(93)
      vcmp.setloc $1 $vcmp.axis.getloc($3-)
    }
  }

  elseif ($2 == !saveloc) {
    if (!$3) vcmp.adminmsg $1 Error - Missing Information, $2 <Name>
    else {
      vcmp.adminmsg $1 Location Saved - Name: $chr(91) $3- $chr(93)
      !writeini -n vcmp.locations.ini LOCATIONS $round($vcmp.hgetpos.x($1),3) $+ , $+ $round( $vcmp.hgetpos.y($1),3) $+ , $+ $round( $vcmp.hgetpos.z($1)),3) $3-
    }
  }


;--- Go To Loc Alias'


alias vcmp.name.getloc {
  var %a = 0
  while (%a <= $ini(vcmp.locations.ini,LOCATIONS,0)) {
    if ($1 isin $readini(vcmp.locations.ini,LOCATIONS,$ini(vcmp.locations.ini,LOCATIONS,%a))) !return $readini(vcmp.locations.ini,LOCATIONS,$ini(vcmp.locations.ini,LOCATIONS,%a))
    !inc %a
  }
}
alias vcmp.axis.getloc {
  var %a = 0
  while (%a <= $ini(vcmp.locations.ini,LOCATIONS,0)) {
    if ($1 isin $readini(vcmp.locations.ini,LOCATIONS,$ini(vcmp.locations.ini,LOCATIONS,%a))) !return $gettok($ini(vcmp.locations.ini,LOCATIONS,%a),1,44) $gettok($ini(vcmp.locations.ini,LOCATIONS,%a),2,44) $gettok($ini(vcmp.locations.ini,LOCATIONS,%a),3,44)
    !inc %a
  }
}

GTA-Roloboy


Force

Well whoever made it :P I thought it was VRocker

bakasan

Tommis  ;)

Quote*These scripts have been wrote fully by me, but i still leave Vrocker's name in there, because without him, i wouldnt of made these scripts

Tommis

Hey,

I completely URGE you to stay away from this. Get rid of the "loc find loop". Once your ini get's too big, every query will go through every single line trying to find the closest match, causing insane amounts of CPU usage (almost always hanging the scripts).

As in my new scripts, just make it go by exact name. And its not case sensitive, so this should work perfectly.

Regards,
Tommis

Windlord

Same thing happened to me with the pickups.
Try not to search inis with loops in any case.

Using hashes would be a good idea.
My own computer used to run for a hundred miles before giving the result from my pickup ini.

//Windlord

Tamas

Hmm this script didnt do anything for me, but i trying  ???

maxorator

Yikes... it's like a flame war has unleashed here. K.I.S.S, bazza, stop it, or you'll be banhammered. Stunty2008, don't accuse people of stealing code without referring to a valid source.

Bazza, you are the one offending and insulting people and Force is the one donating pieces of code and being polite to others. Do yourself a favor and leave him alone.

Jkownz

Doesnt work 4 me says Bad Command im workng on how to fix it

Punjabi

GOD BLESS ALL..<<Founder of PUN Clan.....Born to fight and Kill..>>