Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: Tamas on July 27, 2008, 09:35:13 pm

Title: Script Help
Post by: Tamas on July 27, 2008, 09:35:13 pm
Hi
This is my transfer script:

[/quote] elseif ($2 == !testgoto) {
      if ($hget(vcmp,loggedin. $+ %id) < 10) { vcmp.adminmsg %id You must be Admin Level 10 or higher to attempt this command. }
      else {
        if ($vcmp.nameid($3) == $null) vcmp.adminmsg %id Error: Invalid ID.
        else {
          if ($hget(vcmp,loggedin. $+ %id) < $hget(vcmp,loggedin. $+ $vcmp.nameid($3))) { vcmp.adminmsg %id You can't teleport someone higher level than you... }
          else {
             vcmp.setloc %id $vcmp.hgetpos.x($3) $vcmp.hgetpos.y($3) $vcmp.hgetpos.z($3) 0
             vcmp.adminchat Transfering:[ [ $vcmp.hgetname(%id) ] ] to:[ [ $vcmp.hgetname($3) ] ]
}
}
[/quote]

I want to do that when i type !testgoto --> i can give the player Name (not the ID only.) If i give examp: !testgoto 3 its work.
But in this format: !testgoto Tomi not .
Any idea how can i use this script with name variables too?

Tam
Title: Re: Script Help
Post by: thijn on July 28, 2008, 09:44:24 am
I think this work:
Quote
elseif ($2 == !testgoto) {
      if ($hget(vcmp,loggedin. $+ %id) < 10) { vcmp.adminmsg %id You must be Admin Level 10 or higher to attempt this command. }
      else {
        if ($vcmp.nameid($vcmp.hgetname($3)) == $null) vcmp.adminmsg %id Error: Invalid Name/ID.
        else {
          if ($hget(vcmp,loggedin. $+ %id) < $hget(vcmp,loggedin. $+ $vcmp.nameid($3))) { vcmp.adminmsg %id You can't teleport someone higher level than you... }
          else {
             vcmp.setloc %id $vcmp.hgetpos.x($vcmp.nameid($vcmp.hgetname($3))) $vcmp.hgetpos.y($vcmp.nameid($vcmp.hgetname($3))) $vcmp.hgetpos.z($vcmp.nameid($vcmp.hgetname($3))) 0
             vcmp.adminchat Transfering:[ [ $vcmp.hgetname(%id) ] ] to:[ [ $vcmp.hgetname($3) ] ]
}
}
Title: Re: Script Help
Post by: Force on July 28, 2008, 01:33:16 pm
I think that might be a bit buggy :P Here is the one I use, just added in the part about not being able to teleport to someone higher than you.

Code: [Select]
    elseif ($2 == !testgoto) {
      if ($hget(vcmp,loggedin. $+ %id) < 10) { vcmp.adminmsg %id You must be Admin Level 10 or higher to attempt this command. }

      elseif ($vcmp.nameid($3) == $null) vcmp.adminmsg %id Error: Invalid ID.

      elseif ($hget(vcmp,loggedin. $+ %id) < $hget(vcmp,loggedin. $+ $3) { vcmp.adminmsg %id You can't teleport someone higher level than you... }

      else {
        vcmp.adminchat ** Transferring: $chr(91) $vcmp.hgetname(%id) $chr(93) To: $chr(91) $vcmp.hgetname($3) $chr(93)
        vcmp.setloc $1 $vcmp.hgetpos.x($3) $vcmp.hgetpos.y($3) $vcmp.hgetpos.z($3)
      }
    }

That should work

Note: Not Tested
Title: Re: Script Help
Post by: bazza on July 28, 2008, 01:36:15 pm
thijn's one worked for me.
Title: Re: Script Help
Post by: TanaX01 on July 29, 2008, 03:55:45 am
Hey Force Thx 2 code ID and Name /c get id or name  :D
Title: Re: Script Help
Post by: Nemesis2500 on July 29, 2008, 03:57:51 am
nice work
Title: Re: Script Help
Post by: Tamas on August 01, 2008, 04:02:37 pm
Hmm
That code is the same what i has just another variable:

Example: elseif ($vcmp.nameid($3) == $null) vcmp.adminmsg %id Error: Invalid ID.
I has the same too, anyway if i use your code my script didnt start.
Because my script not accept "elseif" command sometimes only "if" and "else"
But i dont understound why the name variables dont work, because if i write !testgoto fghzt --> it says invalid ID, but if i write correct name than its not work, teleport me to the center of the golf stage... strange.
Title: Re: Script Help
Post by: Tamas on August 01, 2008, 09:03:45 pm
Okay i rewrited the command, and i puted to /c command.
Now its look like this:
Quote
 
elseif (($2 == goto) && ($vcmp.loggedin($1) > 4)) {
if ($vcmp.hgetname($3) == $null) vcmp.adminmsg $1 Error: Invalid ID.
  else {
     if ($hget(vcmp,loggedin. $+ $1) < $hget(vcmp,loggedin. $+ $vcmp.nameid($3))) { vcmp.adminmsg $1 You can't transfer someone higher level admin than you. }
      else { vcmp.adminchat Transfering:[ [ $vcmp.hgetname($1) ] ] to:[ [ $vcmp.hgetname($3) ] ] | vcmp.setloc $1 $vcmp.hgetpos.x($3) $vcmp.hgetpos.y($3) $vcmp.hgetpos.z($3) 0 }
}
}
Anyway its work fine but if i insert command suc: /c goto [SRS]Tomi it says invalid ID, if i repleace the ($vcmp.hgetname($3) to: ($vcmp.nameid($3) its still not work and also the server teleport me to golf stage if i use name instead number..

Any idea?
Title: Re: Script Help
Post by: thijn on August 01, 2008, 10:44:13 pm
try:
elseif (($2 == goto) && ($vcmp.loggedin($1) > 4)) {
if (!$3) vcmp.adminmsg $1 Error: Invalid ID.
  else {
     if ($hget(vcmp,loggedin. $+ $1) < $hget(vcmp,loggedin. $+ $vcmp.nameid($3))) { vcmp.adminmsg $1 You can't transfer someone higher level admin than you. }
      else { vcmp.adminchat Transfering:[ [ $vcmp.hgetname($1) ] ] to:[ [ $vcmp.hgetname($3) ] ] | vcmp.setloc $1 $vcmp.hgetpos.x($3) $vcmp.hgetpos.y($3) $vcmp.hgetpos.z($3) 0 }
}
}
Title: Re: Script Help
Post by: Tamas on August 02, 2008, 02:26:40 am
This isn't work too  :P
Title: Re: Script Help
Post by: Force on August 02, 2008, 02:54:01 am
Try this:

Code: [Select]
elseif (($2 == goto) && ($vcmp.loggedin($1) > 4)) {
if (!$3) vcmp.adminmsg $1 Error: Invalid ID.
  elseif ($hget(vcmp,loggedin. $+ $1) < $hget(vcmp,loggedin. $+ $vcmp.nameid($3))) {
vcmp.adminmsg $1 You can't transfer someone higher level admin than you.
}
      else {
vcmp.adminchat Transfering:[ [ $vcmp.nameid($1) ] ] to:[ [ $vcmp.nameid($3) ] ]

vcmp.setloc $1 $vcmp.hgetpos.x($vcmp.nameid($3)) $vcmp.hgetpos.y($vcmp.nameid($3)) $vcmp.hgetpos.z($vcmp.nameid($3)) 0
}
}

Note: Untested!
Title: Re: Script Help
Post by: Tamas on August 02, 2008, 04:11:32 am
Yeah just a little modd:

Quote
  elseif (($2 == goto) && ($vcmp.loggedin($1) > 4)) {
    if (!$3) vcmp.adminmsg $1 Error: Invalid ID.
    elseif ($hget(vcmp,loggedin. $+ $1) < $hget(vcmp,loggedin. $+ $vcmp.nameid($3))) {
       vcmp.adminmsg $1 You can't transfer someone higher level admin than you.
  }
    else {
       vcmp.adminchat Transfering:[ [ $vcmp.hgetname($vcmp.nameid($1)) ] ] to:[ [ $vcmp.hgetname($vcmp.nameid($3)) ] ]

       vcmp.setloc $1 $vcmp.hgetpos.x($vcmp.nameid($3)) $vcmp.hgetpos.y($vcmp.nameid($3)) $vcmp.hgetpos.z($vcmp.nameid($3)) 0
    }
  }
And works 100% Thanks!
Title: Re: Script Help
Post by: Tamas on August 02, 2008, 08:48:21 pm
2 More questions :D
How can i add name variables to these codes too:

Quote
  elseif (($2 == bringp) && ($vcmp.loggedin($1) > 4)) {
    if (!$3) vcmp.adminmsg $1 Error: Invalid ID.
    elseif ($hget(vcmp,loggedin. $+ $1) < $hget(vcmp,loggedin. $+ $vcmp.nameid($3))) {
       vcmp.adminmsg $1 You can't transfer someone higher level admin than you.
  }
    else {
       vcmp.adminchat Transfering:[ [ $vcmp.hgetname($vcmp.nameid($3)) ] ] to:[ [ $vcmp.hgetname($vcmp.nameid($1)) ] ]

       vcmp.setloc $3 $vcmp.hgetpos.x($vcmp.nameid($1)) $vcmp.hgetpos.y($vcmp.nameid($1)) $vcmp.hgetpos.z($vcmp.nameid($1)) 0
    }
  }

And this:
Quote
  elseif (($2 == setmon) && ($vcmp.loggedin($1) > 4)) {
     if (!$3) vcmp.adminmsg $1 Error: Invalid ID.
    elseif ($hget(vcmp,loggedin. $+ $1) < $hget(vcmp,loggedin. $+ $vcmp.nameid($3))) {
       vcmp.adminmsg $1 You can't give cash to someone higher level admin than you.
  }
    else {
       vcmp.adminchat Admin $vcmp.hgetname($1) Gave Cash To:[ $vcmp.hgetname($3) ] Amount:[ $4- ]

       vcmp.setmon $3 $4
    }
  }

Because i use the same code what you sent me, but thats only work with goto command.
Title: Re: Script Help
Post by: TanaX01 on August 02, 2008, 10:51:25 pm
use !get is bring  ;)

setmon:
 type /admin password (config.ini)
 
 you are already logged admin type /setmon id ammount is easy  :)
Title: Re: Script Help
Post by: Tamas on August 03, 2008, 01:30:56 am
I know its easy but i want to add that to ingame command
Title: Re: Script Help
Post by: TanaX01 on August 03, 2008, 03:11:13 am
I know its easy but i want to add that to ingame command

mm ok Use:

Code: [Select]
  elseif (($2 == bringp) && ($vcmp.loggedin($1) > 4)) {
    vcmp.setloc $3 $vcmp.hgetpos.x($1) $vcmp.hgetpos.y($1) $vcmp.hgetpos.z($1) 0
    vcmp.adminchat **Transfering:[ $vcmp.hgetname($3) ] To:[ $vcmp.hgetname($1) ]
  }

Work 100%  ;)