[SNIPPED] Simple Wep commad

Started by kennedyarz, Apr 13, 2017, 12:08 PM

Previous topic - Next topic

kennedyarz

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)


Step 3) Enjoy

ScreenShot


Tutorial How Install (-_-)
Tutorial

luchgox

Strength does not come from wining.Your struggles develop your strengths.

KAKAN

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...
oh no

Murdock

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

!


Discord: zeus#5155

luchgox

Strength does not come from wining.Your struggles develop your strengths.

!

#6
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

Discord: zeus#5155

KAKAN

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.
oh no

Yankee

How can we add a cost to these wep's.Anyone add for me ?

kennedyarz

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)
         }
}
}

luchgox

Thanks kennedy,I was looking for this
Strength does not come from wining.Your struggles develop your strengths.