Jump to content

The Drugs Script


WestCoast

Recommended Posts

Hello. I need a bit help with my drugs script.

i made a script that if i type !Drugs it says the drugs what i own

that work perfectly

but i have a problem with a !buyweed script

i want that i want choose how much i want to buy

Example:

!buyweed 1 to 100 etc.

in my script i can only buy 10 Kg of weed.

when i buyweed my cash goes to $-10000

i want a pm says: You dont have enough money to buy weed.

This is what i wrote:

on *:SIGNAL:mta.command: {
 var %a = $iif($4 == $null,$2,$iif($mta.getid($1,$4) == -1,$2,$v1)) 
 if ($3 = !Buyweed) {
   if (Ryton Aide !isin $mta.area($1,$2)) mta.msg $1 $2 You Are Not At Ryton Aide
   else {
     mta.say $1 $mta.name($1,$2) Brought 10 Kg Of Weed.
     writeini MTAScript.ini Cash $mta.name($1,$2) $calc($mta.cash($1,$2) - 10000)
     writeini Drugs.ini Drugs $mta.name($1,%a) $calc($mta.drugs($1,%a) + 10)
   }
 }
}

alias mta.cash !return $iif($readini(MTAScript.ini,Cash,$mta.name($1,$2)) == $null,0,$v1)
alias mta.drugs !return $iif($readini(Drugs.ini,Drugs,$mta.name($1,$2)) == $null,0,$v1)

Thnx :) WestCoast

Link to comment
  • 3 weeks later...

I'm not a very good scripter and never scripted for 0.5 but this should work

on *:SIGNAL:mta.command: {
 var %a = $iif($4 == $null,$2,$iif($mta.getid($1,$4) == -1,$2,$v1))
 if ($3 == !buyweed) {
   if (Ryton Aide isin $mta.area($1,$2) {
     if ($4 >= 1 && $4 <= 100) {
       mta.say $1 $mta.namce ($1,$2) brought $4 KG weed.
       writeini MTAScript.ini Cash $mta.name($1,$2) $calc($mta.cash($1,$2) - $4 * 100)
       writeini Drugs.ini Drugs $mta.name($1,%a) $calc($mta.drugs($1,%a) + $4)
     }
     else mta.msg $1 Enter a valid amount of drugs (1-100)
   }
   else mta.msg $1 $2 You are not at Ryton Aide
 }
}
alias mta.cash !return $iif($readini(MTAScript.ini,Cash,$mta.name($1,$2)) == $null,0,$v1)
alias mta.drugs !return $iif($readini(Drugs.ini,Drugs,$mta.name($1,$2)) == $null,0,$v1)

Link to comment

just to fix some BetaDevil's mistakes ;)

on *:SIGNAL:mta.command: {
 if ($3 == !buyweed) {
   if (Ryton isin $mta.area($1,$2)) {
     if (($4 isnum) && ($4 >= 1) && ($4 <= 100)) {
       mta.say $1 $mta.name($1,$2) brought $4 KG of weed.
       !writeini MTAScript.ini Cash $mta.name($1,$2) $calc($mta.cash($1,$2) - $4 * 1000)
       !writeini Drugs.ini Drugs $mta.name($1,$2) $calc($mta.drugs($1,$2) + $4)
     }
     else mta.msg $1 Enter a valid amount of drugs (1-100)
   }
   else mta.msg $1 $2 You are not at Ryton Aide
 }
}
alias mta.cash !return $iif($readini(MTAScript.ini,Cash,$mta.name($1,$2)),$v1,0)
alias mta.drugs !return $iif($readini(Drugs.ini,Drugs,$mta.name($1,$2)),$v1,0)

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...