PDA

View Full Version : MAPPING : Weapons on wall in custom map.



Killer.Pro
9th September 2012, 06:06
Hello fellas,
In this tutorial i'm gonna be showing you how to make a wall with weapon and you can buy it for money.
So for this tutorial i'm going to be using kar98k.
If you're following my previous money tutorials,this will be no problem :) .
Now in your map,place a Trigger_Use_Touch around your weapon or where you want to buy weapon.
Select the trigger,press N and the entity window will show up.
So here you need to put:

key = targetname
value = buyweapon_kar98k

&

key = hintstring
value = ^1Press ^2[Use] ^1to buy kar98k
Now you can save your map and compile it.
In the mp_mapname.gsc file you need to put this.


thread buyweap();

And right at the end of this file put this (you may have to do few changes in this script)


buyweap()
{
buyweap = getent("buyweapon_kar98k", "targetname");

while(1)
{
buyweap waittill("trigger", shopper); //wait till the player activates the trigger

item = "kar98k_mp"; //the weapon player will buy

wepcurrent = shopper getcurrentweapon(); //checks the current weapon
weapon1 = shopper getweaponslotweapon("primary"); //checks the primary weapon
weapon2 = shopper getweaponslotweapon("primaryb"); //checks the primaryb weapon
notwep = !(shopper hasweapon("kar98k_mp")); //checks if the player doesn't have kar98k

if(shopper.money >= 10 && wepcurrent == item && shopper.pers["team"] == "allies") //checks that it shopper has enough money and he already has kar98k and he is a hunter
{
if(wepcurrent == weapon1)
{
currentslot = "primary";
}
else
{
currentslot = "primaryb";
}

wepammo = shopper getweaponslotammo(currentslot);

shopper.money-=10; //takes the money
shopper givemaxammo(wepcurrent); //gives max ammo to kar98k
}
else if(shopper.pers["team"] != "allies") //if player is a zombie
{
shopper iprintlnbold("-=^1This Can Only Be Used By The Hunters^7=-");
}
else if(shopper.money < 10 && shopper.pers["team"] == "allies") //if player is a hunter and he doesn't have enough money
{
shopper iprintln("-=^1You Do Not Have Enough Money To Purchase This Item^7=-");
}
else if(notwep && shopper.pers["team"] == "allies" && shopper.money >= 10) //if player doesn't have kar98k and player is a hunter and has enough money
{
if(wepcurrent == weapon1)
{
currentslot = "primary";
}
else
{
currentslot = "primaryb";
}

shopper.money-=10; //take the money
shopper setweaponslotweapon(currentslot, item);
shopper SwitchToWeapon("kar98k_mp"); //gives kar98k
}
}
}

Now save it and run the map.
Any questions or errors on this tutorials.
Ask then in replies :)
Goodluck