mSL Mafia Wars

Platform:  mIRC
Published  May 23, 2010
Updated  May 23, 2010
An mSL version of the SQL version of Mafia Wars on SwiftIRC #mafiawars ;\\\\\\\\\\ ALIASES \\\\\\\\\\

alias -l pDir { return Mafia\ }
alias -l pFile { return Mafia\Players.ini }
alias -l pNew { return .hmake $1 10 }
alias -l pSave { return hsave -i $1 $pFile($1) $1 }
alias -l pLoad { return hload -i $1 $pFile($1) $1 }
alias -l pDel { return hfree -w $+(*,$nick,*) }
alias -l doHighscore {
;$doHighscore(NAME,VAR)
.window -c @hs
.window -h @hs
var %x = $ini($pFile,0)
while (%x) {
var %y = $ini($pFile,%x)
aline @hs $+(%y,=,$readini($pFile,%y,$2))
dec %x
}
.filter -wwctue 2 61 @hs @hs *=*
return $iif($iif($1 isnum,$gettok($line(@hs,$1),1,61),$ord($fline(@hs,$1 $+ =*))),$v1,NR)
}
alias -l doStats { return .msg # $&
7[5Cash:4 $chr(36) $+ $bytes($hget($1,cash),b) 07[04 $+ $doHighscore($1,Cash) $+ 07]] $&
7[5Exp:4 $bytes($hget($1,exp),b) 07[04 $+ $doHighscore($1,Exp) $+ 7]] $&
7[5Job:4 $iif($hget($1,job) isnum,$duration($hget($1,job)),$hget($1,job)) $+ 7] $&
7[5Pickpocket:4 $iif($hget($1,pickpocket) isnum,$duration($hget($1,pickpocket)),$hget($1,pickpocket)) $+ 7] $&
7[5Deal:4 $iif($hget($1,deal) isnum,$duration($hget($1,deal)),$hget($1,deal)) $+ 7] $&
7[5Fight:4 $iif($hget($1,fight) isnum,$duration($hget($1,fight)),$hget($1,fight)) $+ 7]
$pSave($nick)
}
alias -l doJob {
var %Cash = $r(500,3500)
var %Exp = $r(3,15)
var %Wait = $r(90,300)
hinc $1 Cash %Cash
hinc $1 Exp %Exp
hadd -z $1 Job %Wait
.timer 1 %Wait //hadd $1 Job Ready
return .msg # 7** (4Mafia7)4 $nick 5does a job for the 4Godfather 5and gets $&
7[5Cash: $+(7+04,$chr(36),$bytes(%Cash,b)) $+ 7] $&
7[5Exp: 7+04 $+ $bytes(%Exp,b) $+ 7] $&
7[5Waiting time:4 $duration(%Wait) $+ 7]
$pSave($nick)
}
alias -l doFight {
var %Cash = $r(1500,5000)
var %Exp = $r(10,35)
var %Wait = $r(1800,3600)
var %Foe = $nick(#,$r(1,$nick(#,0)))
hinc $1 Cash %Cash
hinc $1 Exp %Exp
hadd -z $1 Fight %Wait
.timer 1 %Wait //hadd $1 Fight Ready
return .msg # 7** (4Mafia7)4 $nick 5starts a fight with4 %Foe 5and gets $&
7[5Cash: $+(7+04,$chr(36),$bytes(%Cash,b)) $+ 7] $&
7[5Exp: 7+04 $+ $bytes(%Exp,b) $+ 7] $&
7[5Waiting time:4 $duration(%Wait) $+ 7]
$pSave($nick)
}
alias -l doPickpocket {
var %Cash = $r(1000,4000)
var %Exp = $r(3,10)
var %Wait = $r(90,300)
var %Mafia = Triads.Yakuza.Italian Mafia.Mexican Mafia.New York Mafia.Russian Mafia.Columbian Cartel.Isreili Mafia.Serbian Mafia.Albanian Mafia
var %PP = $gettok(%Mafia,$r(1,$numtok(%Mafia,46)),46)
hinc $1 Cash %Cash
hinc $1 Exp %Exp
hadd -z $1 Pickpocket %Wait
.timer 1 %Wait //hadd $1 Pickpocket Ready
return .msg # 7** (4Mafia7)4 $nick 5steals from the4 %PP 5and gets $&
7[5Cash: $+(7+04,$chr(36),$bytes(%Cash,b)) $+ 7] $&
7[5Exp: 7+04 $+ $bytes(%Exp,b) $+ 7] $&
7[5Waiting time:4 $duration(%Wait) $+ 7]
$pSave($nick)
}
alias -l doDeal {
var %Drugs = Booze.Tobacco.Marijuana.Cough Syrup.Meth.Cocaine.LSD.DMT.Roofies.Mushrooms.Peyote.Ketamine.Ecstasy.Oxycodone.Salvia.Hash.Opium
var %Drug = $gettok(%Drugs,$r(1,$numtok(%Drugs,46)),46)
var %Cash = $floor($calc($r(100,250) * $findtok(%Drugs,%Drug,46) * (1 + $hget($1,exp) / 100))))
var %Exp = $r(10,30)
var %Wait = $r(1800,3600)
hinc $1 Cash %Cash
hinc $1 Exp %Exp
hadd -z $1 Deal %Wait
.timer 1 %Wait //hadd $1 Deal Ready
return .msg # 7** (4Mafia7)4 $nick 5quickly deals some4 %Drug 5on the streets and gets $&
7[5Cash: $+(7+04,$chr(36),$bytes(%Cash,b)) $+ 7] $&
7[5Exp: 7+04 $+ $bytes(%Exp,b) $+ 7] $&
7[5Waiting time:4 $duration(%Wait) $+ 7]
$pSave($nick)
}

;\\\\\\\\\\ EVENTS \\\\\\\\\\
on *:join:%MafiaWars:{
;.notice $nick 4Welcome to7 # $+ 4,7 $nick $+ 4. I am7 $me 4and if you would like to play7 Mafia Wars4, type7 !help 4for a list of commands.
if !$ini($pFile,$nick) {
$pNew($nick)
}
elseif !$hget($nick) {
$pNew($nick)
$pLoad($nick)
}
else halt
$pSave($nick)
}

on *:part:%MafiaWars:{
$pSave($nick)
}

on *:nick:%MafiaWars:{
if !$ini($pFile,$nick) {
$pNew($nick)
}
else {
$pNew($nick)
$pLoad($nick)
}
$pSave
}

on *:text:!help:%MafiaWars:{
.notice $nick 7My commands are:4 !fight7, 4!pickpocket7, 4!job7, 4!deal7, and 4!stats7.
}

on *:text:!job:%MafiaWars:{
if !$ini($pFile,$nick) || !$hget($nick) { $pNew($nick) }
if $hget($nick,Job) isnum {
.notice $nick 7** (4Mafia7) 5You still have to wait4 $duration($hget($nick,Job)) 5before you can use this command again.
halt
}
else {
$doJob($nick)
$doStats($nick)
}
$pSave($nick)
}

on *:text:!fight:%MafiaWars:{
if !$ini($pFile,$nick) || !$hget($nick) { $pNew($nick) }
if $hget($nick,Fight) isnum {
.notice $nick 7** (4Mafia7) 5You still have to wait4 $duration($hget($nick,Fight)) 5before you can use this command again.
halt
}
else {
$doFight($nick)
$doStats($nick)
}
$pSave($nick)
}

on *:text:!pickpocket:%MafiaWars:{
if !$ini($pFile,$nick) || !$hget($nick) { $pNew($nick) }
if $hget($nick,Pickpocket) isnum {
.notice $nick 7** (4Mafia7) 5You still have to wait4 $duration($hget($nick,Pickpocket)) 5before you can use this command again.
halt
}
else {
$doPickpocket($nick)
$doStats($nick)
}
$pSave($nick)
}

on *:text:!deal:%MafiaWars:{
if !$ini($pFile,$nick) || !$hget($nick) { $pNew($nick) }
if $hget($nick,Deal) isnum {
.notice $nick 7** (4Mafia7) 5You still have to wait4 $duration($hget($nick,Deal)) 5before you can use this command again.
halt
}
else {
$doDeal($nick)
$doStats($nick)
}
$pSave($nick)
}

on *:text:!stats:%MafiaWars:{ $doStats($nick) }

on *:text:!hs*:%MafiaWars:{
.msg # $+(4,$ini($pFile,$ini($pFile,$2))) 5is ranked7 $doHighscore($2,$3) 5in4 $3 5with7 $&
$bytes($gettok($line(@hs,$fline(@hs,$2 $+ =*)),2,61)),b) $+ 5.
}

Comments

Sign in to comment.
Wulfe   -  Apr 02, 2011
keeps telling me that table exists for the nick..... -_-

if !$ini($pFile,$nick) || !$hget($nick) { $pNew($nick) }
this line is borked all over.....

* /hmake: table 'Wulfe' exists (line 168, script1.txt)
-
* /hmake: table 'Wulfe' exists (line 142, script1.txt)
-
* /hmake: table 'Wulfe' exists (line 155, script1.txt)
-
* /hmake: table 'Wulfe' exists (line 129, script1.txt)


thats the same code on all of those lines.......
 Respond  
GuitarMasterx7   -  Nov 02, 2010
well first off it doesnt work cause you have
to go into your Variables section of your snippet editor
and add
%MafiaWars#channelname

or jus go through the code changing %mafiawarto your channel
 Respond  
MashhitDK   -  May 25, 2010
Niiiice...

But I can't get it to work as it it...
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.