Loan And PayLoan Cmd

[VM_U]Spectra.PhantoM^

  • Full Member
  • Posts: 109
Loan And PayLoan Cmd
« on December 22nd, 2015, 08:10 AM »Last edited on December 22nd, 2015, 08:42 AM
Code: [Select]
function onPlayerCommand( player, cmd, text )
{
else if ( cmd == "loan" )
{
local cash = status[ player.ID ].Cash;
local add = cash + 20000;
status[ player.ID ].Cash = add;
player.Cash = add;
Message("" +player.Name+ " took a loan of 20k. ");
}
}

Easy as hell. This Makes Ur Cash Go Up To 20000$ (You can edit cash amount by editing local add default value is 20k) And also pay loan :
Code: [Select]
else if ( cmd == "payloan" )
{
local cash = status[ player.ID ].Cash;
local det = cash - 20000;
status[ player.ID ].Cash = det;
player.Cash = det;
Message("[#ff0000]" +player.Name+ " [#ffffff]payed his loan of 20k. ");
}
}

@S.L.C Updated Post
Wanna Talk To Me? Come At Irc #[email protected]

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,807
Re: Loan And PayLoan Cmd
« Reply #1, on December 22nd, 2015, 08:29 AM »
Wan't me to tell you how useless this is? Well, for starters, let's begin with "loan".

Useless and never used. Whatever cash the player had they'll be erased at the end of this context.
Code: [Select]
local cash = status[ player.ID ].Cash;

What's the point of this?
Code: [Select]
local add = 20000;

You are literally replacing the payer cash here with a fixed value. If the player had $30,000 and needed another $20,000 to buy something then he just lost $10,000.
Code: [Select]
status[ player.ID ].Cash = add;
player.Cash = add;

Should I continue with "payloan" ? That's just a copy of the "loan" with a different name. Therefore you are no paying anything but rather getting money again. Where dafuq did you copied these pieces of junk?

Stop filling the snippet section with junk. You're making it harder for people to find good stuff. You damn retards think people can't write a 5 line snippet like this on their own?

@S.L.C requests @maxorator to lock the Snippet Showroom section for people with less than 100 posts. Otherwise we all have to put up with crap like this until we find the snippet we need. Or at least something that prevents people from spamming this section.
.

Anik

  • Sr. Member
  • Posts: 356
Re: Loan And PayLoan Cmd
« Reply #2, on December 22nd, 2015, 08:33 AM »
What kind of snippet is it?? You should add "loan=false;" in class to prevent abuse. And also use the "loan=false;"loan in cmd.

[VM_U]Spectra.PhantoM^

  • Full Member
  • Posts: 109
Re: Loan And PayLoan Cmd
« Reply #3, on December 22nd, 2015, 08:43 AM »
Quote from S.L.C on December 22nd, 2015, 08:29 AM
Wan't me to tell you how useless this is? Well, for starters, let's begin with "loan".

Useless and never used. Whatever cash the player had they'll be erased at the end of this context.
Code: [Select]
local cash = status[ player.ID ].Cash;
Sorry Updated Now

What's the point of this?
Code: [Select]
local add = 20000;

You are literally replacing the payer cash here with a fixed value. If the player had $30,000 and needed another $20,000 to buy something then he just lost $10,000.
Code: [Select]
status[ player.ID ].Cash = add;
player.Cash = add;

Should I continue with "payloan" ? That's just a copy of the "loan" with a different name. Therefore you are no paying anything but rather getting money again. Where dafuq did you copied these pieces of junk?

Stop filling the snippet section with junk. You're making it harder for people to find good stuff. You damn retards think people can't write a 5 line snippet like this on their own?

@S.L.C requests @maxorator to lock the Snippet Showroom section for people with less than 100 posts. Otherwise we all have to put up with crap like this until we find the snippet we need. Or at least something that prevents people from spamming this section.
Wanna Talk To Me? Come At Irc #[email protected]

Anik

  • Sr. Member
  • Posts: 356
Re: Loan And PayLoan Cmd
« Reply #4, on December 22nd, 2015, 08:54 AM »
This a better modified snippet.
add this on class Playerstats
Code: [Select]
loan = false;
Now on cmd
Code: [Select]
else if ( cmd == "loan" )
{
if ( status[ player.ID ].loan == true ) MessagePlayer("** [Error]: >> You Already took Loan!", player );
else
{
local cash = player.Cash;
local add = cash + 20000;
player.Cash = add;
status[ player.ID ].loan = true;
Message("" +player.Name+ " took a loan of 20k. ");
}
}

Code: [Select]
else if ( cmd == "payloan" )
{
if ( status[ player.ID ].loan == false ) MessagePlayer("** [Error]: >> You didnt took Loan!", player );
else{
local cash = player.Cash;
local det = cash - 20000;
player.Cash = det;
status[ player.ID ].loan = false;
Message("" +player.Name+ " payed his loan of 20k. ");
}
}
Re: Loan And PayLoan Cmd
« Reply #5, on December 22nd, 2015, 09:02 AM »
I can say without testing the code that it will make your cash to -20000 either how much cash u have.
Quote
Easy as hell. This Makes Ur Cash Go Up To 20000$ (You can edit cash amount by editing local add default value is 20k) And also pay loan :
Code: [Select]
else if ( cmd == "payloan" )
{
local cash = status[ player.ID ].Cash;
local det = cash - 20000;
status[ player.ID ].Cash = det;
player.Cash = det;
Message("[#ff0000]" +player.Name+ " [#ffffff]payed his loan of 20k. ");
}
}
@S.L.C Updated Post

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,807
Re: Loan And PayLoan Cmd
« Reply #6, on December 22nd, 2015, 09:03 AM »Last edited on December 22nd, 2015, 09:08 AM
Replace:
Code: [Select]
local cash = player.Cash;
local add = cash + 20000;
player.Cash = add;

With:
Code: [Select]
player.Cash += 20000;

And also replace:
Code: [Select]
local cash = player.Cash;
local det = cash - 20000;
player.Cash = det;

With:
Code: [Select]
player.Cash -= 20000;

Same result, less code. But if you don't understand it then the following has the same result.
Code: [Select]
player.Cash = (player.Cash + 20000);
player.Cash = (player.Cash - 20000);

And also add a check to see if you have where to withdraw the money from.

Code: [Select]
if (player.Cash < 20000)
    MessagePlayer("** [Error]: >> You don't have the money fool!", player );
    // EXPLODE!
.

Anik

  • Sr. Member
  • Posts: 356
Re: Loan And PayLoan Cmd
« Reply #7, on December 22nd, 2015, 09:10 AM »
Yeah @S.L.C But shouldn't this topic moved to Support or Squirrel Scripting Board??

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,807
Re: Loan And PayLoan Cmd
« Reply #8, on December 22nd, 2015, 09:17 AM »
I'm guessing the intent of this topic was to be a snippet but it ended up in a regular topic in the end. So yeah, this could fit int any of these sections except Support since that's for server/client support and not scripting support.
.

Williams

  • Jr. Member
  • #GiveRespectGetRespect
  • Posts: 82
Re: Loan And PayLoan Cmd
« Reply #9, on December 25th, 2015, 09:34 AM »
Can i ask one thing i want 100k loan to how can i take 100k ? can anyone change to this
else if ( cmd == loan )
if ( !text ) MessagePlayer( " / "+ cmd +" <loan price > " player );

We can take limited loan like 10k to 500k
Hey, i m always at IRC and Forum you can comtact me at IRC channel :- #GDM @LUNet and Forum :- http://pro-fighter.tk/index.php

Anik

  • Sr. Member
  • Posts: 356
Re: Loan And PayLoan Cmd
« Reply #10, on December 25th, 2015, 10:28 AM »Last edited on December 25th, 2015, 10:53 AM
Quote from Williams on December 25th, 2015, 09:34 AM
Can i ask one thing i want 100k loan to how can i take 100k ? can anyone change to this
else if ( cmd == loan )
if ( !text ) MessagePlayer( " / "+ cmd +" <loan price > " player );

We can take limited loan like 10k to 500k
that's so easy to do. Anyway I m posting a better on.