Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Yankee on May 27, 2017, 11:21 AM

Title: Weps With Money
Post by: Yankee on May 27, 2017, 11:21 AM
Hi guys,i want the players can buy a wep with a cost.Example,players use commands to buy weapons.Can anyone give me ?
Title: Re: Weps With Money
Post by: EK.IceFlake on May 27, 2017, 11:27 AM
player.Money -= cost;
Title: Re: Weps With Money
Post by: SAzEe21 on May 27, 2017, 11:39 AM
if ( cmd "wep" )
{
if ( !text ) MessagePlayer( "use /wep wepid", player );
player.SetWeapon( text );
player.Cash -= 100;
}
Title: Re: Weps With Money
Post by: Anik on May 27, 2017, 11:42 AM
Wrong Board... Btw zeeshan  thats not going to work.
Title: Re: Weps With Money
Post by: Yankee on May 27, 2017, 01:36 PM
Is this script work ?
if ( cmd "weapon" )
{
if ( !text ) MessagePlayer( " /weapon id", player );
else
  {
   switch(text)
   {
    case "34":
     player.Weapon(0,29);
     player.Cost -=50;
    case "28":
     player.Weapon(0,7);
     player.Cost -=50;
    case "26":
     player.Weapon(0,9);
     player.Cost -=50;
}
}
Title: Re: Weps With Money
Post by: Anik on May 27, 2017, 01:57 PM
MAN..... This is the wrong board... You shouldn't expect someone's help here.
Title: Re: Weps With Money
Post by: SAzEe21 on May 27, 2017, 03:22 PM
You are in wrong board nobody can help you here but next time post your request in here: http://forum.vc-mp.org/?board=37.0

if ( cmd "weapon" )
{
if ( !text ) MessagePlayer( " /weapon id", player );
else
  {
local wep = GetWeaponID(text);
   switch(wep)
   {
    case 34:
     player.Weapon(0,29);
     player.Cost -=50;
     break;

    case 28:
     player.Weapon(0,7);
     player.Cost -=50;
     break;

    case 26:
     player.Weapon(0,9);
     player.Cost -=50;
     break;
default:
MessagePlayer( "Invalid id", player );
}
}
}
Title: Re: Weps With Money
Post by: Yankee on May 27, 2017, 06:55 PM
Quote from: Zeeshan.Bhatti on May 27, 2017, 03:22 PMYou are in wrong board nobody can help you here but next time post your request in here: http://forum.vc-mp.org/?board=37.0

if ( cmd "weapon" )
{
if ( !text ) MessagePlayer( " /weapon id", player );
else
  {
local wep = GetWeaponID(text);
   switch(wep)
   {
    case "34":
     player.Weapon(0,29);
     player.Cost -=50;
     break;

    case "28":
     player.Weapon(0,7);
     player.Cost -=50;
     break;

    case "26":
     player.Weapon(0,9);
     player.Cost -=50;
     break;
default:
MessagePlayer( "Invalid id", player );
}
}
}

Oh thank you man you are pro.
Title: Re: Weps With Money
Post by: Yankee on May 28, 2017, 07:27 AM
Quote from: Yankee on May 27, 2017, 06:55 PM
Quote from: Zeeshan.Bhatti on May 27, 2017, 03:22 PMYou are in wrong board nobody can help you here but next time post your request in here: http://forum.vc-mp.org/?board=37.0

if ( cmd "weapon" )
{
if ( !text ) MessagePlayer( " /weapon id", player );
else
  {
local wep = GetWeaponID(text);
   switch(wep)
   {
    case "34":
     player.Weapon(0,29);
     player.Cost -=50;
     break;

    case "28":
     player.Weapon(0,7);
     player.Cost -=50;
     break;

    case "26":
     player.Weapon(0,9);
     player.Cost -=50;
     break;
default:
MessagePlayer( "Invalid id", player );
}
}
}

Oh thank you man you are pro.
Hey it not works man,game take my cash but not give me the weapon.Anyone know basic command for this.I want players can take a weapon with cost.
Title: Re: Weps With Money
Post by: SAzEe21 on May 28, 2017, 12:33 PM
@Yankee command will work properly when you give player a weapon when they buy.

use this one:

if ( cmd "weapon" )
{
if ( !text ) MessagePlayer( " /weapon id", player );
else
  {
local wep = GetWeaponID(text);
   switch(wep)
   {
    case 21:
     player.SetWeapon(21,999);
     player.Cost -=50;
     break;

    case 26:
     player.SetWeapon(26,999);
     player.Cost -=50;
     break;

    case 32:
     player.SetWeapon(32,999);
     player.Cost -=50;
     break;
default:
MessagePlayer( "Invalid id", player );
}
}
}

You can add more weapons like this way.