07-28-2011, 22:29
ok so what i have right now is a menu that opens up when you connect to the server to list my weapons the only problem i notice is that the weapons menu does not open on a ffa match but it will on a team match here is the code
basicly i want it to do the same thing it does in team deathmatch whenyou connect and the came type is a team type game my class menu loads but in ffa you just spawn with a gun any help would be great
Code:
/*
===================================================
// scripted by: Virus
// steam: assassin5469
// takbolts
===================================================
*/
#include common_scripts\utility;
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;
init()
{
game["menu_class_takbolts"] = "class_takbolts";
precacheMenu(game["menu_class_takbolts"]);
setDvar( "scr_disable_cac", 1 );
self.pers["primary_wep"] = undefined;
self.pers["menuallow"] = undefined;
self setclientDvar( "scr_disable_cac", 1 );
level thread onPlayerConnect();
}
onPlayerConnect()
{
while( true )
{
level waittill( "connected", player );
player thread onPlayerSpawned();
}
}
onPlayerSpawned()
{
self setclientDvar( "scr_disable_cac", 1 );
self thread teamWait();
self endon( "disconnect" );
while( true )
{
self waittill( "spawned_player" );
//on first spawn give
self takeAllWeapons();
self giveWeapon("mosin_sp");
self giveWeapon("knife_zm");
wait 0.05;
self thread giveStoredWep();
self.pers["menuallow"] = true;
self thread onMenuResponse();
self setclientDvar( "scr_disable_cac", 0 );
self thread cacDisable();
}
}
onMenuResponse()
{
self endon( "death" );
self endon( "disconnect" );
while( true )
{
self waittill( "menuresponse", menu, response );
if( response == "open_class_takbolts_menu" )
{
self thread getMyMenu();
}
if (response == "giveMosin" )
{
self closeMenu();
self closeInGameMenu();
if( self.pers["menuallow"] != false )
{
self thread takePrimary();
self giveWeapon("mosin_sp");
self switchToWeapon("mosin_sp");
self.pers["primary_wep"] = "mosin_sp";
}
else
{
self.pers["primary_wep"] = "mosin_sp";
}
}
if (response == "giveKar" )
{
self closeMenu();
self closeInGameMenu();
if( self.pers["menuallow"] != false )
{
self thread takePrimary();
self giveWeapon("kar98k_mp");
self switchToWeapon("kar98k_mp");
self.pers["primary_wep"] = "kar98k_mp";
}
else
{
self.pers["primary_wep"] = "kar98k_mp";
}
}
if (response == "giveArisaka" )
{
self closeMenu();
self closeInGameMenu();
if( self.pers["menuallow"] != false )
{
self thread takePrimary();
self giveWeapon("arisaka_mp");
self switchToWeapon("arisaka_mp");
self.pers["primary_wep"] = "arisaka_mp";
}
else
{
self.pers["primary_wep"] = "arisaka_mp";
}
}
}
}
//other functions
getMyMenu()
{
self closeMenu();
self closeInGameMenu();
self openMenu("class_takbolts");
}
teamWait()
{
while(1)
{
self waittill("joined_team");
self setclientDvar( "scr_disable_cac", 1 );
wait 0.1;
self thread getMyMenu();
self setclientDvar( "scr_disable_cac", 0 );
}
}
takePrimary()
{
self takeweapon( "mosin_sp" );
self takeweapon( "kar98k_mp" );
self takeweapon( "arisaka_mp" );
}
giveStoredWep()
{
if( self.pers["primary_wep"] != undefined)
{
self thread takePrimary();
self giveWeapon ( self.pers["primary_wep"] );
self switchtoweapon( self.pers["primary_wep"] );
wait 1;
}
}
cacDisable()
{
self setclientDvar( "scr_disable_cac", 0 );
wait 8;
self setclientDvar( "scr_disable_cac", 1 );
}
basicly i want it to do the same thing it does in team deathmatch whenyou connect and the came type is a team type game my class menu loads but in ffa you just spawn with a gun any help would be great