I want to ask for help in a scripting problem and i am newb at scripting :p
I was looking a topic here for how to make custom dvars
What i want is a dvar that will change the fov scale of the player that call it in b3 (for the ones that dont knows what b3 does is to send information to the console so the console must know who call it .That hear weird to me i tried a code last night i created the dvar witch is "promod" and it refers to "cg_fovscale,1.25" but when i write !promod what i see is that the command is execing in the start of a round and for all the players not the one who calls it pls help : (i edited the following)
Code: Select all
//B3 dvars
#include braxi\_dvar;
#include braxi\_admin;
init ( modVersion )
{
addDvar( "promod", "promod", 1, 0, 1, "int" );
if( level.dvar["promod"] == 1 )
thread promodview();
else
if( level.dvar["promod"] == 0 )
thread nopromodview();
}
promodview()
{
while ( 1 )
{
level waittill("connected",player);
player thread view_on();
}
}
nopromodview()
{
while ( 1 )
{
level waittill("connected",player);
player thread view_off();
}
}
view_on()
{
level waittill("connected",player);
self endon ( "disconnect" );
self endon ( "joined_specators" );
if( isDefined( player ) && player isReallyAlive() )
{
self setClientDvar("cg_fovscale",1.25);
self iPrintln("Promod View ^2[ON]");
}
}
view_off()
{
level waittill("connected",player);
self endon ( "disconnect" );
self endon ( "joined_specators" );
if( isDefined( player ) && player isReallyAlive() )
{
self setClientDvar("cg_fovscale",1);
self iPrintln("Promod View ^9[OFF]");
}
}
I have installed in b3 a deathrun plugin and have put the code :
Code: Select all
def cmd_promod(self, data, client, cmd=None):
"""\
!promod - Gives a player a promod view.
"""
self.console.write( 'promod 1' )