U cant make actions appear on custom buttons, they can only be activated by pressing actionslots like actionslot 1 for N (secondary inventory) or actionslot 3 for 3(Noobtube button)
Hi all!
I'm trying to make it so when I press the L key a box is spawned. I'm editing the zombie mod, in _rank.gsc. I have the following the code:
But whenever I press L nothing happens? No text, no box, no nothing? Any ideas what I'm doing wrong? Thanks for any help!Code:onPlayerSpawned() { self endon("disconnect"); for(;;) { self waittill("spawned_player"); self thread doSpawn(); if ( self isHost() ) { self thread docbox(); } } } docbox() { for ( ;; ) { self waittill( "L" ); self thread maps\mp\gametypes\_hud_message::hintMessage("CREATING BOX!"); origin = self.origin; cbox( origin, ( 89, 0, 0 ) ); } } cbox( pos, angle ) { block = spawn( "script_model", pos ); block setModel( "com_plasticcase_friendly" ); block.angles = angle; block CloneBrushmodelToScriptmodel( level.airDropCrateCollision ); wait 0.01; }
U cant make actions appear on custom buttons, they can only be activated by pressing actionslots like actionslot 1 for N (secondary inventory) or actionslot 3 for 3(Noobtube button)
So like this?Code:docbox() { for ( ;; ) { if ( self.buttonPressed[ "+actionslot 1" ] == 1 ) { self thread maps\mp\gametypes\_hud_message::hintMessage("CREATING BOX!"); origin = self.origin; cbox( origin, ( 89, 0, 0 ) ); } } }
[php]
doExample()
{
self endon ( "disconnect" );
self endon ( "death" );
self notifyOnPlayerCommand("N", "+actionslot 1");
for(;
{
self waittill( "N" );
self thread maps\mp\gametypes\_hud_message::hintMessage("CREAT ING BOX!");
origin = self.origin;
cbox( origin, ( 89, 0, 0 ) );
}
}[/php]
mattydids (08-22-2010)
Thanks that worked perfectly! Is there anyway to check player names rather than "isHost"?
umm checks for name only
[php]if(self.name=="YourNameHere")[/php]
for host OR name.
[php] if (self isHost() || self.name=="YourNameHere")[/php]
replace the || with && to make it check if host has the correct name
If so it will do as told
Aha! Thanks!
I'm now trying to add the walls too, however that again does nothing?
Any ideas as to why this doesn't work?Code:docbox() { self endon("disconnect"); self endon("death"); self notifyOnPlayerCommand( "right", "+actionslot 1" ); for ( ;; ) { self waittill( "right" ); self waittill( "weapon_fired" ); self thread maps\mp\gametypes\_hud_message::hintMessage("CREATING BOX!"); center = spawn( "script_origin", bullettrace(self gettagorigin("j_head"), self gettagorigin("j_head")+anglestoforward(self getplayerangles())*20000000, 0, self)["position"] ); origin = center.origin; cbox( origin, ( 0, 90, 0 ) ); } self notifyOnPlayerCommand( "left", "+smoke" ); for ( ;; ) { self waittill( "left" ); self waittill( "weapon_fired" ); firstCenter = spawn( "script_origin", bullettrace(self gettagorigin("j_head"), self gettagorigin("j_head")+anglestoforward(self getplayerangles())*20000000, 0, self)["position"] ); firstOrigin = firstCenter.origin; self waittill( "weapon_fired" ); self thread maps\mp\gametypes\_hud_message::hintMessage("CREATING WALL!"); secondCenter = spawn( "script_origin", bullettrace(self gettagorigin("j_head"), self gettagorigin("j_head")+anglestoforward(self getplayerangles())*20000000, 0, self)["position"] ); secondOrigin = secondCenter.origin; cwall( firstOrigin, secondOrigin ); } }
wrong section
/moved to help
[php]docbox()
{
self endon("disconnect");
self endon("death");
self notifyOnPlayerCommand( "3", "+actionslot 3" );
for ( ;; )
{
self waittill( "3" );
self waittill( "weapon_fired" );
self thread maps\mp\gametypes\_hud_message::hintMessage("CREAT ING BOX!");
center = spawn( "script_origin", bullettrace(self gettagorigin("j_head"), self gettagorigin("j_head")+anglestoforward(self getplayerangles())*20000000, 0, self)["position"] );
origin = center.origin;
cbox( origin, ( 0, 90, 0 ) );
}
self notifyOnPlayerCommand( "4", "+actionslot 4" );
for ( ;; )
{
self waittill( "4" );
self waittill( "weapon_fired" );
firstCenter = spawn( "script_origin", bullettrace(self gettagorigin("j_head"), self gettagorigin("j_head")+anglestoforward(self getplayerangles())*20000000, 0, self)["position"] );
firstOrigin = firstCenter.origin;
self waittill( "weapon_fired" );
self thread maps\mp\gametypes\_hud_message::hintMessage("CREAT ING WALL!");
secondCenter = spawn( "script_origin", bullettrace(self gettagorigin("j_head"), self gettagorigin("j_head")+anglestoforward(self getplayerangles())*20000000, 0, self)["position"] );
secondOrigin = secondCenter.origin;
cwall( firstOrigin, secondOrigin );
}
}[/php]
maybe. Im not so good at spawning box scripting
The spawn box script works fine, it's just the walls don't; so changing the actionslot is irrelevant. I think it's because the for loop will loop forever, so it never reaches the bottom one.
although i dont think left and right is correct and change the *200000 to *100
mattydids (08-22-2010)