Author Topic: Buyprop Commands  (Read 5548 times)

0 Members and 1 Guest are viewing this topic.

Offline TanaX01

  • Made Man
  • ***
  • Posts: 214
  • BlackList! <3
    • View Profile
Buyprop Commands
« on: September 06, 2008, 09:56:53 pm »
Commands !buyprop !Sellprop Script by: Tommis, Vrock and Rulk.

Code: [Select]

  elseif ($2 == !buyprop) || ($2 == !buyprop) {
    var %lines $calc($lines(vc-mp/vcmp.properites.ini)-1)
    var %registered = $readini(vc-mp/vcmp.admin.ini,LEVELS,$vcmp.name(%id))

    if ($vcmp.cmdcheck(!buyprop,%id) == fail) !halt

    elseif (!$3) {
      vcmp.msg %id Error - Missing Information, $2 <ID>
      !halt
    }

    elseif ( $3 > %lines ) {
      vcmp.say >> $2 $+ , Invalid property ID.
      !halt
    }

    elseif ($3 !isnum) {
      vcmp.say >> $2 $+ , Invalid property ID.
      !halt
    }

    elseif (. isin $3) {
      vcmp.say >> $2 $+ , Invalid property ID.
      !halt
    }

    elseif (+ isin $3) || (- isin $3)  {
      vcmp.say >> $2 $+ , Invalid property ID.
      !halt
    }

    ;if they already owns that property - take them to the property
    if ( $vcmp.name(%id) == $hget(BuyPropHashTable, $3)) {

      vcmp.setlocation $vcmp.getid(%name) $vcmp.axis.getloc($vcmp.propname($3))

      vcmp.say >> Taking $vcmp.name(%id) to his property: $vcmp.propname($3)
      !halt
    }

    elseif ( $vcmp.propname($3) != $vcmp.propname($3)) vcmp.say >> $2 $+ , Invalid property.

    elseif ( $vcmp.propname($3) !isin $vcmp.area(%b)) vcmp.msg %id Error - You must be located at $vcmp.propname($3)

    elseif ( !%registered ) {
      vcmp.msg %id Error - You must be a registered player to purchase a property.
      !halt
    }

    elseif ($hget(myprops, $vcmp.name(%id)) >= 2) vcmp.msg %id Error, you have reached your property limit.

    elseif ( $3 == $hfind(BuyPropHashTable, $3)) vcmp.say >> $vcmp.name(%id) $+ , property: $vcmp.propname($3) - ID: $3 - currently belongs to: $hget(BuyPropHashTable, $3)

    elseif ( $vcmp.costprop($vcmp.propname($3)) > $vcmp.cash(%id)) {
      vcmp.msg %id Error - You need atleast $ $+ $bytes($vcmp.costprop($vcmp.propname($3)),b) to buy this property
      !halt
    }

    else {

      var %props = $hget(myprops, $vcmp.name(%id))

      vcmp.cash- %b $vcmp.costprop($vcmp.propname($3))

      !hadd -m BuyPropHashTable $3 $vcmp.name(%id)

      !hadd -m myprops $vcmp.name(%id) $calc(%props +1)

      vcmp.setlocation $vcmp.getid(%name) $vcmp.axis.getloc($vcmp.propname($3))

      vcmp.say >> Selling property: $vcmp.propname($3) - ID: $3 - To: $vcmp.name(%id) - Cost: $ $+ $bytes($vcmp.costprop($vcmp.propname($3)),b)
      vcmp.msg %id Type $chr(91) !Autospawn ON $3 $chr(93) to spawn infront of this property.


    }
  }

  elseif ($2 == !sellprop) || ($2 == !pmsellprop) {

    ;buyer
    var %g = $iif($4,$iif($4 !isnum,$iif($vcmp.getid($4) != Unknown,$v1,-1),$iif($vcmp.name($4) != Unknown,$4,-1)),%id)

    var %dss = $readini(vc-mp/vcmp.admin.ini,LEVELS,$vcmp.name(%g))

    var %lines $calc($lines(vc-mp/vcmp.properites.ini)-1)

    var %money = $calc($vcmp.costprop($vcmp.propname($3)) / 2)

    if ($vcmp.cmdcheck(!sellprop,%id) == fail) !halt

    elseif (!$3) vcmp.msg %id Error - Missing Information, $2 <Property ID> <name>

    elseif (%g == -1) {
      vcmp.msg %id Error - Absent ID/Name
      !halt
    }

    elseif ( $3 > %lines ) {
      vcmp.say >> $2 $+ , Invalid property ID
      !halt
    }

    elseif ($3 !isnum) {
      vcmp.say >> $2 $+ , Invalid property ID
      !halt
    }

    elseif (. isin $3) {
      vcmp.say >> $2 $+ , Invalid property ID
      !halt
    }

    elseif (+ isin $3) || (- isin $3)  {
      vcmp.say >> $2 $+ , Invalid property ID
      !halt
    }

    elseif (!$4) {
      vcmp.msg %id Error - Missing Information, $2 <ID> <Player>
      !halt
    }

    elseif ( $vcmp.propname($3) !isin $vcmp.area(%b)) {
      vcmp.msg %id Error - You must be located at $vcmp.propname($3)
      !halt
    }

    ;if the sellers name is not against the property id in the hash table
    elseif ( $vcmp.name(%id) != $hget(BuyPropHashTable, $3)) vcmp.msg %id $vcmp.name(%id) $+ , you do not own $vcmp.propname($3)



    ;if the property is not in the hash tabel
    elseif ( $3 != $hfind(BuyPropHashTable, $3)) vcmp.msg %id $vcmp.name(%id) $+ , you do not own $vcmp.propname($3)


    elseif ( $vcmp.propname($3) !isin $vcmp.area(%g)) {
      vcmp.msg %id Error - $vcmp.name(%g) must also be located at $vcmp.propname($3)
      !halt
    }

    elseif ( !%dss ) {
      vcmp.msg %id Error - $vcmp.name(%g) is not a registered player.
      !halt
    }

    elseif ( %money > $vcmp.cash(%g)) {
      vcmp.msg %id Error - $vcmp.name(%g) needs atleast $ $+ $bytes(%money,b) to buy this property.
      !halt
    }


    elseif ( $vcmp.name(%id) == $vcmp.name(%g) ) {
      vcmp.msg %id Error, you cannot sell a property to yourself.
      !halt
    }


    elseif ($hget(myprops, $vcmp.name(%g)) >= 2) {
      vcmp.msg %id Error, $vcmp.name(%g) $+ 's property limit has been reached.
      !halt
    }

    if ( $vcmp.name(%id) == $hget(BuyPropHashTable, $3)) {

      !hdel BuyPropHashTable $3

      vcmp.msg %id $vcmp.name(%id) $+ , you sold $vcmp.propname($3)
      vcmp.msg %id To: $vcmp.name(%g) For: $ $+ $bytes(%money,b)

      vcmp.msg %g $vcmp.name(%g) $+ , you purchased $vcmp.propname($3)
      vcmp.msg %g From: $vcmp.name(%id)  For: $ $+ $bytes(%money,b)
      vcmp.msg %g Type $chr(91) !Autospawn ON $3 $chr(93) to spawn infront of this property.

      !hadd -m BuyPropHashTable $3 $vcmp.name(%g)

      ;take cash from buyer
      vcmp.cash- %g %money

      ;increase total myprops by 1 for buyer
      var %props = $hget(myprops, $vcmp.name(%g))
      !hadd -m myprops $vcmp.name(%g) $calc(%props +1)



      ;decrease total myprops by 1 for seller
      var %props = $hget(myprops, $vcmp.name(%id))
      !hadd -m myprops $vcmp.name(%id) $calc(%props -1)
      if ($hget(myprops, $vcmp.name(%id)) == 0 ) !hdel myprops $vcmp.name(%id)

      if ($hfind(AutoSpawn, $vcmp.name(%id)) ) !hdel AutoSpawn $vcmp.name(%id)

      ;add cash to seller
      vcmp.cash+ %b %money
      !halt
    }
  }

  elseif ($2 == !myprops) || ($2 == !pmmyprops) {
    var %bb = $hget(myprops, $vcmp.name(%id))

    if ($vcmp.cmdcheck(!myprops,%id) == fail) !halt
    if ($hget(myprops, $vcmp.name(%id))) {
      $vcmp.myprops($vcmp.name(%id))
      vcmp.msg %id $vcmp.name(%id) owns: $+($chr(91),%bb,/2,$chr(93)) properties.
      !halt
    }
    else {
      vcmp.msg %id Error, $1  you do not own a property.
    }
  }

  elseif ($2 == !home) || ($2 == !pmhome) {
    if ($vcmp.cmdcheck(!home,%id) == fail) !halt
    var %lines $calc($lines(vc-mp/vcmp.properites.ini)-1)
    ;if they already owns that property - take them to the property
    if ( $vcmp.name(%id) == $hget(BuyPropHashTable, $3)) {

      vcmp.setlocation $vcmp.getid(%name) $vcmp.axis.getloc($vcmp.propname($3))

      vcmp.say >> Taking $vcmp.name(%id) to his property: $vcmp.propname($3)
      !halt
    }

    elseif (!$3) vcmp.msg %id Error - Missing Information, $2 <ID>
    elseif ( $3 > %lines ) vcmp.say >> $2 $+ , Invalid property ID.
    elseif ($3 !isnum)  vcmp.say >> $2 $+ , Invalid property ID.
    elseif (. isin $3)  vcmp.say >> $2 $+ , Invalid property ID.

    elseif (+ isin $3) || (- isin $3)  {
      vcmp.say >> $2 $+ , Invalid property ID.
      !halt
    }

    else {
      vcmp.say >> $vcmp.name(%id) $+ , $vcmp.propname($3) is not your property.
      !halt
    }
  }

  elseif (!AutoSpawn* iswm $2)  {

    var %lines $calc($lines(vc-mp/vcmp.properites.ini)-1)

    var %registered = $readini(vc-mp/vcmp.admin.ini,LEVELS,$vcmp.name(%id))


    if ($vcmp.cmdcheck(!AutoSpawn,%id) == fail) !halt

    elseif (!$3) vcmp.msg %id Error - Missing Information, $2 <ON/OFF>

    elseif ($3 == $chr(79)) vcmp.msg %id Error - Absent parameter ON/OFF

    elseif ($3 == off) {

      if ($4) vcmp.msg %id Error - Missing Information, $2 <OFF>

      elseif ( !%registered ) {
        vcmp.msg %id Error - You must be a registered player.
        !halt
      }

      elseif (!$hfind(AutoSpawn, $vcmp.name(%id)) ) {
        vcmp.say >> $vcmp.name(%id) $+ , you do not have Auto-Spawn Enabled.
        !halt
      }

      elseif (!$hfind(AutoSpawn, $vcmp.name(%id)) ) {
        vcmp.say $vcmp.name(%id) - Auto-Spawn is already disabled.
        !halt
      }
      else {
        vcmp.say Disabling Auto-Spawn for $vcmp.name(%id)
        $autospawnoff($vcmp.name(%id))
      }
    }


    elseif ($3 == on) {

      if (!$4) vcmp.msg %id Error - Missing Information, $2 <ON/OFF> <ID>

      elseif ( $4 > %lines ) {
        vcmp.say >> $2 $+ , Invalid property ID.
        !halt
      }

      elseif ($4 !isnum) {
        vcmp.say >> $2 $+ , Invalid property ID.
        !halt
      }

      elseif (. isin $4) {
        vcmp.say >> $2 $+ , Invalid property ID.
        !halt
      }

      elseif (+ isin $4) || (- isin $4)  {
        vcmp.say >> $2 $+ , Invalid property ID.
        !halt
      }

      elseif ( !%registered ) {
        vcmp.msg %id Error - You must be a registered player.
        !halt
      }

      elseif ( $vcmp.name(%id) != $hget(BuyPropHashTable, $4)) {
        vcmp.say >> $vcmp.name(%id) $+ , $vcmp.propname($4) is not your property.
        !halt
      }

      elseif ($hfind(AutoSpawn, $vcmp.name(%id)) ) {
        ;vcmp.say $vcmp.name(%id) - Auto-Spawn is already enabled for property: $vcmp.propname($hget(AutoSpawn,$vcmp.name(%id).data)))
        vcmp.say $vcmp.name(%id) - Auto-Spawn is already enabled for ID: $hget(AutoSpawn,$vcmp.name(%id).data)
        !halt
      }
      else {
        vcmp.say Enabling Auto-Spawn for $vcmp.name(%id)
        $autospawn($4,$vcmp.name(%id))
      }
    }
  }

Or Download File: http://rapidshare.com/files/143172830/scripts.zip.html

- TaNaX01 -  :D
« Last Edit: September 06, 2008, 10:40:16 pm by TanaX01 »

Offline Punjabi

  • Made Man
  • ***
  • Posts: 147
  • Config Editor
    • View Profile
    • PUN Clan
Re: Buyprop Commands
« Reply #1 on: September 07, 2008, 10:42:43 am »
Thanks bro may god bless you :) ;) :D ;D
GOD BLESS ALL..<<Founder of PUN Clan.....Born to fight and Kill..>>

Offline Intruder

  • Street Thug
  • *
  • Posts: 24
    • View Profile
Re: Buyprop Commands
« Reply #2 on: September 07, 2008, 11:20:03 am »
i dnt get how ya spost to do that :'(

Offline Punjabi

  • Made Man
  • ***
  • Posts: 147
  • Config Editor
    • View Profile
    • PUN Clan
Re: Buyprop Commands
« Reply #3 on: September 07, 2008, 11:58:47 am »
Hey why cant u get that code the code is infront of u grab it man before it vanishes
 :D :D
GOD BLESS ALL..<<Founder of PUN Clan.....Born to fight and Kill..>>

Offline Punjabi

  • Made Man
  • ***
  • Posts: 147
  • Config Editor
    • View Profile
    • PUN Clan
Re: Buyprop Commands
« Reply #4 on: September 07, 2008, 12:00:08 pm »
Hey tana what u will get if u complete ur 300 posts
Status?
How many stars :o
GOD BLESS ALL..<<Founder of PUN Clan.....Born to fight and Kill..>>

Windlord

  • Guest
Re: Buyprop Commands
« Reply #5 on: September 07, 2008, 12:20:32 pm »
Stop double/triple/quadruple posting aka spamming.

Your bloody stars have no meaning so make sure your posts are absolutely essential to the thread before you post in it because some people can get really annoyed by your consistent spam.

Offline TanaX01

  • Made Man
  • ***
  • Posts: 214
  • BlackList! <3
    • View Profile
Re: Buyprop Commands
« Reply #6 on: September 08, 2008, 06:03:44 am »
Stop double/triple/quadruple posting aka spamming.

Your bloody stars have no meaning so make sure your posts are absolutely essential to the thread before you post in it because some people can get really annoyed by your consistent spam.

to who you say windlord to him? me the offers by p.m. ok   topic Locked. ;)