Author Topic: Help in Syntax  (Read 3543 times)

0 Members and 1 Guest are viewing this topic.

Offline Tamas

  • Made Man
  • ***
  • Posts: 127
    • View Profile
    • http://www.tamasnet.eu/
Help in Syntax
« on: August 07, 2008, 07:35:09 pm »
Pls help me about sintax:
My ban command:

Quote
  elseif (($2 == ban) && ($vcmp.loggedin($1) > 4)) {
    if ($vcmp.loggedin($1) < 10) vcmp.adminmsg $1 You are not an admin, so you hasn't got permission to ban someone!
    else {
     if ($vcmp.nameid($3) == $null) { vcmp.adminmsg $1 Error: Invalid ID/Name }
       else { vcmp.adminchat vcmp.ban $vcmp.nameid($3) $iif($4-,Reason:[ [ $4-,) ] ] | Kicking: $vcmp.hgetname($vcmp.nameid($3)) }
    }
  }
Thats work fine but i want to add a third if command too that says you cant ban higher level admin than you.

I tryed this:

Quote
  elseif (($2 == ban) && ($vcmp.loggedin($1) > 4)) {
    if ($vcmp.loggedin($1) < 10) vcmp.adminmsg $1 You are not an admin, so you hasn't got permission to ban someone!
    else {
      if ($hget(vcmp,loggedin. $+ $1) < $hget(vcmp,loggedin. $+ $vcmp.nameid($3))) { vcmp.adminmsg $1 You can't ban someone higher level admin than you. }
    else }
     if ($vcmp.nameid($3) == $null) { vcmp.adminmsg $1 Error: Invalid ID/Name }
       else { vcmp.adminchat vcmp.ban $vcmp.nameid($3) $iif($4-,Reason:[ [ $4-,) ] ] | Kicking: $vcmp.hgetname($vcmp.nameid($3)) }
    }
  }

But when i go ingame the commands not work, i know thats about because i using wrong sintax in the third if command.
So how can i variable that 3rd if command to work fine?
« Last Edit: August 07, 2008, 07:38:55 pm by [SRS]Tomi »

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: Help in Syntax
« Reply #1 on: August 08, 2008, 02:58:50 pm »
try:
Code: [Select]
elseif (($2 == ban) && ($vcmp.loggedin($1) > 4)) {
    if ($vcmp.loggedin($1) < 10) vcmp.adminmsg $1 You are not an admin, so you hasn't got permission to ban someone!
    else {
      if ($hget(vcmp,loggedin. $+ $1) < $hget(vcmp,loggedin. $+ $vcmp.nameid($3))) { vcmp.adminmsg $1 You can't ban someone higher level admin than you. }
    else {
     if ($vcmp.nameid($3) == $null) { vcmp.adminmsg $1 Error: Invalid ID/Name }
       else { vcmp.adminchat vcmp.ban $vcmp.nameid($3) $iif($4-,Reason:[ [ $4-,) ] ] | Kicking: $vcmp.hgetname($vcmp.nameid($3)) }
    }
  }

Offline Tamas

  • Made Man
  • ***
  • Posts: 127
    • View Profile
    • http://www.tamasnet.eu/
Re: Help in Syntax
« Reply #2 on: August 12, 2008, 06:42:38 pm »
This isnt work too  :(
When i put this version of ban than the script not work anymore.
Same happen like in my version.

szostol

  • Guest
Re: Help in Syntax
« Reply #3 on: August 12, 2008, 06:45:52 pm »
I think it's problem with { and } There have to be as much } as {.

Offline ReVilo

  • Wiseguy
  • **
  • Posts: 64
  • Master of All that is Holy
    • View Profile
Re: Help in Syntax
« Reply #4 on: August 12, 2008, 07:17:17 pm »
In other words try removing one of the closing brackets at the end.