Ford

Using $rand

Recommended Posts

elseif ($3 == !roll) { 
var %a = $rand(1.,6) 
if (%a == 1) {  
mta.pm $1 $2 You receive additional cash, total $ $+ $pgs.cash($1,$2) 
pgs.add $mta.nick($1,$2) 500 
} 
elseif (%a == 2) { 
mta.pm $1 $2 You lost some cash, total $ $+ $pgs.cash($1,$2) 
pgs.sub $mta.nick($1,$2) 500 
} 
elseif (%a == 3) { 
mta.pm $1 $2 You receive mute for 1min... 
mta.mute $1 $2  
.timerunmuteroll 1 60 mta.unmute $1 $2 
} 
elseif (%a == 4) { 
mta.pm $1 $2 You receive freeze for 20 secs! 
if ($prs.mode($1) == deathmatch) mta.pm $1 $2 But since it's DM map you won't get it:) 
else { 
mta.freeze $1 $2  
.timerfreezeroll 1 20 mta.unfreeze $1 $2 
} 
} 
elseif (%a == 5) { 
mta.pm $1 $2 You receive 10 points! 
!hadd prsrank $mta.nick($1,$2) $calc($prs.points($1,$2) + 10) 
} 
elseif (%a == 6) { 
mta.pm $1 $2 You lost 10 points! 
!hadd prsrank $mta.nick($1,$2) $calc($prs.points($1,$2) - 10) 
} 
} 

Why isn't it working?

Share this post


Link to post

The timer mute line wont work either

.timerunmuteroll 1 60 mta.unmute $1 $2 

I will explain this:

<19:18:15> WannaKnow: !roll

<19:18:15> Admin: You receive mute for 1min...

(here will be start the timer muteroll)

<19:18:15> WannaKnow muted.

<19:18:35> [uVA]Bart: !roll

<19:18:35> Admin: You receive mute for 1min...

(here will you delete the existsing timer called muteroll and you will start one for [uVA]Bart and WannaKnow is still muted after 1 min

Change the code

.timerunmuteroll 1 60 mta.unmute $1 $2 

to

.timerunmuteroll $+ $2 1 60 mta.unmute $1 $2 

Bow you will add the ID of the player to the timer so i't won't be overwritten

Share this post


Link to post

elseif ($3 == !roll) { 
var %n = $mta.nick($1,$2) 
if ($readini(prscommand.ini,delay,%n) == yes) mta.pm $1 $2 Error: You can use this script once every 30 secs. 
else { 
writeini prscommand.ini delay %n yes 
var %a = $rand(1,6) 
if (%a == 1) {  
var %b = $rand(100,2000) 
pgs.add $mta.nick($1,$2) %b 
mta.pm $1 $2 You've won $ $+ %b $+ ! Total cash: $ $+ $pgs.cash($1,$2)  
.timerremove +$ $2 1 30 writeini prscommand.ini delay %n no 
} 
  

Why doesn't it work? Works for the 1st time and then always "Error: You can use this script once every 30 secs."..? I guess the %n var gets overwritten? Could someone confirm that? The script is kind a massive so I won't change it everywhere each time ;p

Share this post


Link to post

  • Recently Browsing   0 members

    No registered users viewing this page.