Help

Started by SAzEe21, Dec 01, 2015, 09:07 PM

Previous topic - Next topic

SAzEe21

Hi , there.

I need a wep command weps with priced and ammos.

Like

Weapons which will cost:
UZI = 200$ - ( Unlimited ammo 9999)
Ingram = 200$ - ( Unlimited ammo 9999)
M60 = 500$ - ( Unlimited ammo 9999)
Stubby = 500$ - ( Unlimited ammo 9999)
Shotgun = 200$- ( Unlimited ammo 9999)
M4 = 300$ - (Unlimited ammo 9999)
Kindly post the codes here.

Thank you :)

Thijn

Kindly make it yourself and come back with problems.

SAzEe21

Any example how can I make?

Xmair

function onPlayerCommand(player,cmd,text)
{
    if ( cmd == "buywep" )
{
if (!text) PrivMessage(player,"/buywep <Wep Name>")
else
{
local Pos = player.Pos, checkpoly;
checkpoly = InPoly( Pos.x, Pos.y, -682.759, 1201.86,-682.76, 1208.14,-666.617, 1209.52,-666.617, 1202.46);
local wep = GetWeaponName(GetWeaponID(text));
if( checkpoly == false ) PrivMessage(player,"You need to be at the ammunation shop in Downtown to buy weapons!")
else if ( wep == "M60")
{
if ( player.Cash <= 499) PrivMessage(player,"You need to have atleast 500$!")
player.SetWeapon(32,9999)
player.Cash-=500;
PrivMessage(player,"You have bought: [#ffffff]"+wep+"[#0099ff] in [#ffffff]500$. [#0099ff]!")
}
else PrivMessage(player,"Sorry we don't have that type of model of the weapon "+text+" here.")
}
}
}
You can add more in it, it's just an example how to do it, It's not tested.

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

#4
Better to create a function!
if( cmd == "wep" ){
local weptype = null, params = split(text, " ");
if(!text) PrivMessage(player,"FUU! Use the correct syntax");
for(local i = 0; i < params.len() - 1;i++){
if(IsNum(params[ i ])) weptype = params[ i ];
else weptype = GetWeaponID( params[ i ] );
player.Cash -= Wepcost(player,weptype);
player.SetWeapon(weptype,9999);
}
}

Now create a function:-
function Wepcost(player,wep){
if(player){
switch(wep.tointeger()){
case 32: return 300;
default: return 100;
}
}
}

Just an example code.
It won't work, or may work.
You need to edit it and make it fit for you!
oh no

Xmair

Quotefunction wepcost(player,wep){
Just tell me WHAI

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

Quote from: Xmair on Dec 02, 2015, 09:55 AM
Quotefunction wepcost(player,wep){
Just tell me WHAI
So that you can use player.SetWeapon there.
You can remove that, or do it like I did it now.
oh no

SAzEe21

Hmmm thank's for you examples..

I've done it myself and worked..

Thank you all.

-Locked.