Vice City: Multiplayer

Server Development => Scripting and Server Management => Snippet Showroom => Topic started by: kennedyarz on Apr 13, 2017, 12:08 PM

Title: [SNIPPED] Simple Wep commad
Post by: kennedyarz on Apr 13, 2017, 12:08 PM
Wep Command with Client-Side

Hello guys here I have made a simple command so that the player can choose his favorite weapon.

How Install 

Step 1)

Put the command in

function onPlayerCommand( player, cmd, text )
{
         cmd = cmd.tolower();
         if(cmd=="wep")
{
        Stream.StartWrite()
Stream.WriteInt(1)
Stream.SendStream(player)
  }


else MessagePlayer("[#FFFFFF]Invalid command Use",player)
if ( text == null ) text = "Nothing";
return 1;
}

And this at the end of the script

//============================== C L I E N T  S I D E  D A T A ==============================================//
function onClientScriptData(player)
{
local string = Stream.ReadString(), int = Stream.ReadInt();
    if(string == "wep0") player.SetWeapon(0,9999)
else if (string == "wep1") player.SetWeapon(1,9999)
else if (string == "wep2" ) player.SetWeapon(2,9999)
else if (string == "wep3") player.SetWeapon(3,9999)
else if (string == "wep4") player.SetWeapon(4,9999)
else if (string == "wep5") player.SetWeapon(5,9999)
else if (string == "wep6") player.SetWeapon(6,9999)
else if (string == "wep7") player.SetWeapon(7,9999)
else if (string == "wep8") player.SetWeapon(8,9999)
else if (string == "wep9") player.SetWeapon(9,9999)
else if (string == "wep10") player.SetWeapon(10,9999)
    else if (string == "wep11") player.SetWeapon(11,9999)
else if (string == "wep12") player.SetWeapon(12,9999)
else if (string == "wep13") player.SetWeapon(13,9999)
else if (string == "wep14") player.SetWeapon(14,9999)
else if (string == "wep15") player.SetWeapon(15,9999)
else if (string == "wep16") player.SetWeapon(16,9999)
else if (string == "wep17") player.SetWeapon(17,9999)
else if (string == "wep18") player.SetWeapon(18,9999)
else if (string == "wep19") player.SetWeapon(19,9999)
else if (string == "wep20") player.SetWeapon(20,9999)
else if (string == "wep21") player.SetWeapon(21,9999)
else if (string == "wep22") player.SetWeapon(22,9999)
else if (string == "wep23") player.SetWeapon(23,9999)
else if (string == "wep24") player.SetWeapon(24,9999)
else if (string == "wep25") player.SetWeapon(25,9999)
else if (string == "wep26") player.SetWeapon(26,9999)
else if (string == "wep27") player.SetWeapon(27,9999)
else if (string == "wep28") player.SetWeapon(28,9999)
else if (string == "wep29") player.SetWeapon(29,9999)
else if (string == "wep30") player.SetWeapon(30,9999)
else if (string == "wep31") player.SetWeapon(31,9999)
else if (string == "wep32") player.SetWeapon(32,9999)
else if (string == "disarm")
{
MessagePlayer("[#FF1111][DISARM] [#FFFFFF]You've been disarmed",player);
            player.Disarm();
}
}

Step 2)
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Ffiles.thijn.ovh%2Fimg%2F463bb830b68d8554659c5c4590de1746%2Fmain.nut&hash=08bdc67e7557c6cd3fa8c3e4218ba32110b27833) (http://files.thijn.ovh/download/463bb830b68d8554659c5c4590de1746/main.nut)

Step 3) Enjoy

ScreenShot
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FuD0MRYa.png&hash=64c3fd028dfd77320ee59002e65345af6213019b)

Tutorial How Install (-_-)
Tutorial (https://www.youtube.com/watch?v=K4PUG-22uuY&feature=youtu.be#)
Title: Re: [SNIPPED] Simple Wep commad
Post by: luchgox on Apr 13, 2017, 01:46 PM
nice work
Title: Re: [SNIPPED] Simple Wep commad
Post by: KAKAN on Apr 13, 2017, 01:53 PM
Again, onClientScriptData:-
if( string == "wep" ) player.SetWeapon( int, 9999 );I've posted the whole code previously. Do that atleast, I hate seeing so many IF statements for nothing...
Title: Re: [SNIPPED] Simple Wep commad
Post by: Murdock on Apr 14, 2017, 03:40 AM
Quote from: KAKAN on Apr 13, 2017, 01:53 PMAgain, onClientScriptData:-
if( string == "wep" ) player.SetWeapon( int, 9999 );I've posted the whole code previously. Do that atleast, I hate seeing so many IF statements for nothing...

It's some really terrible code
Title: Re: [SNIPPED] Simple Wep commad
Post by: ! on Apr 14, 2017, 03:56 AM
Quote from: Murdock on Apr 14, 2017, 03:40 AMIt's some really terrible code
Beginning :D
Title: Re: [SNIPPED] Simple Wep commad
Post by: luchgox on Apr 16, 2017, 09:40 AM
not working
Title: Re: [SNIPPED] Simple Wep commad
Post by: ! on Apr 16, 2017, 10:02 AM
Quote from: QW.jester on Apr 13, 2017, 01:46 PMnice work
>:(
Quote from: QW.jester on Apr 16, 2017, 09:40 AMnot working
Dafaq
better way for increasing post counts.
If its not working why not fix it yourself cauz from your first post it looKs like you know about scripting. Fix it and post the bugged link if its not working.
 :edit:
Bugged *line
Title: Re: [SNIPPED] Simple Wep commad
Post by: KAKAN on Apr 16, 2017, 11:14 AM
Quote from: QW.jester on Apr 16, 2017, 09:40 AMnot working
It was never meant to be. It's just a place to show your extreme scripting skillz by giving code that might/might not work. No one cares, since everyone has their extreme skillz to make their own one.
Title: Re: [SNIPPED] Simple Wep commad
Post by: Yankee on May 28, 2017, 06:37 AM
How can we add a cost to these wep's.Anyone add for me ?
Title: Re: [SNIPPED] Simple Wep commad
Post by: kennedyarz on May 28, 2017, 02:28 PM
Quote from: Yankee on May 28, 2017, 06:37 AMHow can we add a cost to these wep's.Anyone add for me ?

function onClientScriptData(player)
{
     local string = Stream.ReadString(), int = Stream.ReadInt();
     if(string == "wep0")
     {
     if ( pstats[player.ID].Cash < 100 ) MessagePlayer("You do not have enough money to buy this weapon",player)
     else{
         player.SetWeapon(0,9999)
         pstats[player.ID].Cash-=100;
         MessagePlayer("You buyed this weapon for 100 Dollars",player)
         }
}
}
Title: Re: [SNIPPED] Simple Wep commad
Post by: luchgox on May 28, 2017, 03:12 PM
Thanks kennedy,I was looking for this