This is how i would make it.
PHP Code:
main()
{
maps\mp\_load::main();
thread teleport();
zommessage = "^6-=^4This Can Only Be Used By The Zombies^6=-";
huntermessage = "^6-=^4This Can Only Be Used By The Hunters^6=-";
thread buyweap("buyweapon_kar98k", "kar98k_mp", 500, "axis", zommessage);
thread buyweap("buyweapon_MP5A4", "nsmp5a4_mp", 750, "allies", huntermessage);
}
buyweap(name, item, price, team, teammessage)
{
buyweap = getent(name, "targetname");
while(1)
{
buyweap waittill("trigger", shopper); //wait till the player activates the trigger
if(shopper.pers["team"] != team) //if player isn't the right team
{
shopper iprintlnbold(teammessage);
continue;
}
//checks that it shopper has enough money and he already hasn't the item
if(shopper.money >= price)
{
wepcurrent = shopper getcurrentweapon(); //checks the current weapon
weapon1 = shopper getweaponslotweapon("primary"); //checks the primary weapon
notwep = !(shopper hasweapon(item)); //checks if the player doesn't have the item
currentslot = "primaryb";
if(wepcurrent == weapon1)
{
currentslot = "primary";
}
shopper.money-=price; //takes the money
if(notwep)
shopper setweaponslotweapon(currentslot, item);
shopper givemaxammo(item); //gives max ammo to kar98k
shopper SwitchToWeapon(item);
}
else if(shopper.money < price) //if he doesn't have enough money
{
shopper iprintln("-=^1You Do Not Have Enough Money To Purchase This Item^7=-");
}
}
}
Originally Posted by
A$D SkyZ
You mixed some 'axis' and 'allies' with hunters and zombies.