Money system

Started by wilber32, Aug 29, 2015, 09:24 PM

Previous topic - Next topic

wilber32

class PlayerStats {
IsReg = false;
IsLogged = false;

Cash = 0;
Bank = 0;

}

function onPlayerCommand else if ( cmd == "givecash" )
{
local Pos = player.Pos, checkpoly;
checkpoly = InPoly( Pos.x, Pos.y, -898.2357,-326.6091,-898.2196,-355.5072,-936.2309,-355.5205,-939.2854,-352.5587,-952.3001,-342.9138,-957.1079,-341.7898,-966.5380,-337.4671,-966.5401,-328.1766 );
if ( status[ player.ID ].IsReg == false ) MessagePlayer(RED+"** [DNUS-Error]: >> "+ORANGE+"You Need To Registered First!", player );
else if ( status[ player.ID ].IsLogged == false ) MessagePlayer( RED+"** [DNUS-Error]: >> "+ORANGE+"You Need To Logged-In First!", player );
else if ( !player.IsSpawned ) MessagePlayer( RED+"** [DNUS-Error]: >> "+ORANGE+"First Spawned And Then Use It.", player );
else if( checkpoly == false ) MessagePlayer( RED+"** [DNUS-Error]: >> "+ORANGE+"You Have To Be At Bank.", player );
else if ( !text )
{
MessagePlayer(ORANGE+"Usage: /givecash [Amount] [Nick/ID]", player );
return;
}
else if ( NumTok( text, " " ) < 2 ) MessagePlayer(ORANGE+"Usage: /givecash [Amount] [Nick/ID]", player );
else {
local plr = GetPlayer( GetTok( text, " ", 2 ) );
if ( !plr ) MessagePlayer( RED+"** [DNUS-Error]: >> "+ORANGE+"Invalid Player.", player );
else if (plr.ID == player.ID) MessagePlayer(RED+"** [DNUS-Error]: >> "+ORANGE+"You Don't GiveCash To Himself!",player);
else {
local Poss = plr.Pos, checkpolyy;
checkpolyy = InPoly( Poss.x, Poss.y, -898.2357,-326.6091,-898.2196,-355.5072,-936.2309,-355.5205,-939.2854,-352.5587,-952.3001,-342.9138,-957.1079,-341.7898,-966.5380,-337.4671,-966.5401,-328.1766 );
if ( checkpolyy == false ) {MessagePlayer(RED+"** [DNUS-Error]: >> "+ORANGE+"This Player Isn't In The Bank.", player ); MessagePlayer(RED+"** [Notice]: >> "+ORANGE+""+player.Name+" Want Came You In The Bank For Giving Money!",plr);}
else {
if ( text.tointeger() > player.Cash ) MessagePlayer( RED+"** [DNUS-Error]: >> "+ORANGE+"Invalid Amount!", player );
else if (!IsNum(GetTok( text, " ", 1 ) ) ) MessagePlayer( RED+"** [DNUS-Error]: >> "+ORANGE+"Ammount Must Be In Numbers!", player );
else if ( text.tointeger() < 0 ) MessagePlayer( RED+"** >> Sending Failed! "+ORANGE+"Please Use The Correct Way To Send.", player );
else {
DecCash( player, text.tointeger() );
IncCash( plr, text.tointeger() );
MessagePlayer(BLUE+"** >> You Given $" + text.tointeger() + " Rupees To " + plr.Name + "",player);
MessagePlayer(BLUE+"** >> "+player.Name+" Given You $" + text.tointeger() + " Rupees!",plr);
}
}
}
}
}

else if ( cmd == "deposit" )
{
local Cash = status[ player.ID ].Cash;
local Pos = player.Pos, checkpoly;
checkpoly = InPoly( Pos.x, Pos.y, -898.2357,-326.6091,-898.2196,-355.5072,-936.2309,-355.5205,-939.2854,-352.5587,-952.3001,-342.9138,-957.1079,-341.7898,-966.5380,-337.4671,-966.5401,-328.1766 );
if ( status[ player.ID ].IsReg == false ) MessagePlayer(RED+"** [DNUS-Error]: >> "+ORANGE+"You Need To Registered First!", player );
else if ( status[ player.ID ].IsLogged == false ) MessagePlayer( RED+"** [DNUS-Error]: >> "+ORANGE+"You Need To Logged-In First!", player );
else if ( !text ) MessagePlayer(ORANGE+"Usage: /deposit [Ammout/All]", player );
else if( checkpoly == false ) MessagePlayer( RED+"** [DNUS-Error]: >> "+ORANGE+"You Have To Be At Bank.", player );
else if ( status[ player.ID ].Cash == 0 ) MessagePlayer( RED+"** [DNUS-Error]: >> "+ORANGE+"Not Enough Money.", player );
else {
if( text == "all" )
{local pcash = status[ player.ID ].Cash;
if( pcash > 0 ) {
DecCash( player, pcash );
IncBank( player, pcash );
MessagePlayer(ORANGE+"** >> You Have Deposited:[ "+pcash+" ] Into Your Bank Account.", player );
local Bank = status[ player.ID ].Bank;
MessagePlayer(YELLOW+"** >> Your New Bank Balance:[ $"+Bank+" ].", player );
}
}
else if ( !IsNum( text ) )  MessagePlayer( RED+"** [DNUS-Error]: >> "+ORANGE+"Amount Must Be In Numbers.", player );
else if ( Cash < text.tointeger() ) MessagePlayer( RED+"** [DNUS-Error]: >> "+ORANGE+"Not Enough Money.", player );
else {
local text = text.tointeger();
DecCash( player, text );
IncBank( player, text );
MessagePlayer(ORANGE+"** >> You Have Deposited:[ $"+text+" ] Into Your Bank Account.", player );
local Bank = status[ player.ID ].Bank;
MessagePlayer(YELLOW+"** >> Your New Bank Balance:[ $"+Bank+" ].", player );
}
}
}

else if ( cmd == "withdraw" )
{
local Bank = status[ player.ID ].Bank;
local Pos = player.Pos, checkpoly;
checkpoly = InPoly( Pos.x, Pos.y,  -898.2357,-326.6091,-898.2196,-355.5072,-936.2309,-355.5205,-939.2854,-352.5587,-952.3001,-342.9138,-957.1079,-341.7898,-966.5380,-337.4671,-966.5401,-328.1766 );
if ( status[ player.ID ].IsReg == false ) MessagePlayer(RED+"** [DNUS-Error]: >> "+ORANGE+"You Need To Registered First!", player );
else if ( status[ player.ID ].IsLogged == false ) MessagePlayer( RED+"** [DNUS-Error]: >> "+ORANGE+"You Need To Logged-In First!", player );
else if ( !text ) MessagePlayer(ORANGE+"Usage: /withdraw [Amount/All]", player );
else if ( checkpoly == false ) MessagePlayer( RED+"** [DNUS-Error]: >> "+ORANGE+"You Have To Be At Bank.", player );
else if ( status[ player.ID ].Bank == 0 ) MessagePlayer( RED+"** [DNUS-Error]: >> "+ORANGE+"Not Enough Money.", player );
else {
if( text == "all" )
{local pbank = status[ player.ID ].Bank;
if( pbank > 0 ) {
DecBank( player, pbank );
IncCash( player, pbank );
MessagePlayer(BLUE+"** >> You Have Withdrawed:[ $"+Bank+" ] From Your Bank Account.", player );
}
}
else if ( !IsNum( text ) ) MessagePlayer( RED+"** [DNUS-Error]: >> "+ORANGE+"Ammount Must Be In Numbers!", player );
else if ( Bank < text.tointeger() ) MessagePlayer( RED+"** [DNUS-Error]: >> "+ORANGE+"Not Enough Money!", player );
else {
local text = text.tointeger();
DecBank( player, text );
IncCash( player, text );
MessagePlayer(BLUE+"** >> You Have Withdrawed:[ $"+text+" ] From Your Bank Account.", player );
}
}
}

Functions function DecCash( player, amount )
{
local cash = status[ player.ID ].Cash;
local det = cash - amount;
status[ player.ID ].Cash = det;
player.Cash = det;
}
function IncCash( player, amount )
{
local cash = status[ player.ID ].Cash;
local add = cash + amount;
status[ player.ID ].Cash = add;
player.Cash = add;
}
function DecBank( player, amount )
{
local bank = status[ player.ID ].Bank;
local det = bank - amount;
status[ player.ID ].Bank = det;
}
function IncBank(player,amount)
{
local bank = status[ player.ID ].Bank;
local add = bank + amount;
status[ player.ID ].Bank = add;
}


PlayerX

Ya lo se, vas a querer robar de nuevo las password de los users para usarlo en otro server como antes?
If some see me on a server and see that I'm not from Argentina, is an impostor >_>.
Playing since 9 years.

wilber32


soulshaker

Quote from: PlayerX on Aug 29, 2015, 09:26 PMYa lo se, vas a querer robar de nuevo las password de los users para usarlo en otro server como antes?
You should keep conversations in English so others can know about it

wilber32


FinchDon

I gonna say Good Luck But Mr. @wilber32 You just got this code from DNUS Leak Script :/
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

Xmair

Leaked script of DNUS :/ You actually don't know how to script and you post leaked scripts codes and say that you're a big scripter and get proud of yourself....Such a....And this script won't even work because of your Blue+ Red+ things.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

KAKAN

Ya @Xmair is right, this can be written in even simpler form
oh no

FinchDon

What simple ? the whole code is from DNUS what you need first some function incbank inccash then classes then simple command that was the work you only need to do else of leak

@Thijn I want you to lock this topic
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )