Author Topic: Script Help  (Read 8581 times)

0 Members and 1 Guest are viewing this topic.

Offline Tamas

  • Made Man
  • ***
  • Posts: 127
    • View Profile
    • http://www.tamasnet.eu/
Script Help
« 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

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: Script Help
« Reply #1 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) ] ]
}
}

Offline Force

  • LU Developer
  • Made Man
  • *
  • Posts: 242
    • View Profile
Re: Script Help
« Reply #2 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

Offline bazza

  • Street Thug
  • *
  • Posts: 18
    • View Profile
Re: Script Help
« Reply #3 on: July 28, 2008, 01:36:15 pm »
thijn's one worked for me.

Offline TanaX01

  • Made Man
  • ***
  • Posts: 214
  • BlackList! <3
    • View Profile
Re: Script Help
« Reply #4 on: July 29, 2008, 03:55:45 am »
Hey Force Thx 2 code ID and Name /c get id or name  :D

Offline Nemesis2500

  • Wiseguy
  • **
  • Posts: 63
  • The Joker
    • View Profile
    • Grand VCMP Server
Re: Script Help
« Reply #5 on: July 29, 2008, 03:57:51 am »
nice work


Offline Tamas

  • Made Man
  • ***
  • Posts: 127
    • View Profile
    • http://www.tamasnet.eu/
Re: Script Help
« Reply #6 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.
« Last Edit: August 01, 2008, 04:07:20 pm by [SRS]Tomi »

Offline Tamas

  • Made Man
  • ***
  • Posts: 127
    • View Profile
    • http://www.tamasnet.eu/
Re: Script Help
« Reply #7 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?

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: Script Help
« Reply #8 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 }
}
}

Offline Tamas

  • Made Man
  • ***
  • Posts: 127
    • View Profile
    • http://www.tamasnet.eu/
Re: Script Help
« Reply #9 on: August 02, 2008, 02:26:40 am »
This isn't work too  :P

Offline Force

  • LU Developer
  • Made Man
  • *
  • Posts: 242
    • View Profile
Re: Script Help
« Reply #10 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!

Offline Tamas

  • Made Man
  • ***
  • Posts: 127
    • View Profile
    • http://www.tamasnet.eu/
Re: Script Help
« Reply #11 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!

Offline Tamas

  • Made Man
  • ***
  • Posts: 127
    • View Profile
    • http://www.tamasnet.eu/
Re: Script Help
« Reply #12 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.

Offline TanaX01

  • Made Man
  • ***
  • Posts: 214
  • BlackList! <3
    • View Profile
Re: Script Help
« Reply #13 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  :)

Offline Tamas

  • Made Man
  • ***
  • Posts: 127
    • View Profile
    • http://www.tamasnet.eu/
Re: Script Help
« Reply #14 on: August 03, 2008, 01:30:56 am »
I know its easy but i want to add that to ingame command