Spawn Mod / Builder Mod?

Posts 115 of 39 · Page 1 of 3
Spawn Mod / Builder Mod?
Hey guys!
Im new to all this lobby hosting and modding and i do not yet have the skills for it, and i have been searching for this without finding it so i thought i might ask you guys for it.

The thing is, i want a mod that works for the host only, almost like the portalmod here but so i can spawn several Cps without the first one dissapearing, cuse the thing i want is to be able to build stuff, like bunkers. for me and my friend when we wanna have a good laugh. Also if it can be done i would like it to be able to choose which model to spawn, like for example i can change from Cps to chickens or airplanes.
I found a piece of code in someone else's thread wich i cant get to work, since im completetly new to this and the error i get on startup is "Script Compile error Unknown function (see console for details)" . But here it is. and oh btw, could someone point me to how you can create/edit mw2 maps and save them? Since my goal is to build stuff, i do not want them to dissapear after i close the game.

Code:
#include common_scripts\utility;
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;

testinsh()
{
    self endon("death");
       
        green = spawn("script_model", (-155154,-514654,-5132168) );
        green setModel( "com_plasticcase_friendly" );

       
    for(;;)
    {
        self waittill ( "weapon_fired" );
        vec = anglestoforward(self getPlayerAngles());
        end = (vec[0] * 200000, vec[1] * 200000, vec[2] * 200000);
        SPLOSIONlocation = BulletTrace( self gettagorigin("tag_eye"), self gettagorigin("tag_eye")+end, 0, self)[ "position" ];
                currentWeapon = self getCurrentWeapon();
                if ( currentWeapon == "usp_" )
                {
                        self thread getvec(self.por);
                    
                        if(SPLOSIONlocation[2]<self.newshit[2] + 100 && SPLOSIONlocation[2]>self.newshit[2] + 25)
                        {
                                self.green = spawn("script_model", SPLOSIONlocation);
                                self.green RotateTo( ( 90, 0, 0), 0.0001, 0, 0);
                                self.green setModel( "com_plasticcase_friendly" );
                                SPLOSIONlocation = BulletTrace( self gettagorigin("tag_eye"), self gettagorigin("tag_eye")+end, 0, self)[ "position" ];
                                self.greenroof=0;
                                self.greenwall=1;
                        }else{
                                if(SPLOSIONlocation[2]<self.newshit[2] + 100)
                                {
                                        self.green = spawn("script_model", SPLOSIONlocation - (0,0,11.5) );
                                        self.greenroof=0;
                                }else{
                                        self.green = spawn("script_model", SPLOSIONlocation + (0,0,11.5) );
                                        self.greenroof=1;                            
                                }
                                self.greenwall=0;
                                self.green RotateYaw(self.greenrot[1], 0.0001, 0, 0);   
                                self.green setModel( "com_plasticcase_friendly" );
                                self.greenwall=0;
                        }
                        self thread Bluesavepos(SPLOSIONlocation);

	// Instructions
	//for(i = 0; i < 6; i++) {
	//	self iPrintlnBold("^3Welcome to Spawn mod server!"); wait 0.50;
	//}
	self thread maps\mp\gametypes\_hud_message::hintMessage("^3Welcome to ^1Spawn^3 mod server!");
	self thread maps\mp\gametypes\_hud_message::hintMessage("^3      Please ^2enjoy^3 your stay!");
	self thread maps\mp\gametypes\_hud_message::hintMessage("^3Mod created by someone.");
                }
           
                
    }
}

getvec(col)
{
        if(col==0)
        {
        self.redrot=self getPlayerAngles();
        }else{
        self.greenrot=self getPlayerAngles();
        }
}

Bluesavepos(Pos)
{
        self endon("death");
        self.saveshit = Pos;
}
Thanks in advance. =)
Take a few codes from the aimbot mod.
There should be some thing for you there.
if((self.name = level.hostname) is the code ur lookin for, atleast it is for xbox360 for pc it might be if (self.name = level.hostname) check out se7 website (google it its xbox360 modding, alot of usefull codes around there)
/moved
to GSC modding section
Ok thanks for the replys, but still. Its hard to work on this script as long as it does not even load :P It starts to load a map and then stops with an error wich looks like this "Script Compile error Unknown function (see console for details)"

And also, u mean like this ?

Code:
#include common_scripts\utility;
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;

init()
{
if (self isHost())

        
 self endon("death");
       
        green = spawn("script_model", (-155154,-514654,-5132168) );
        green setModel( "com_plasticcase_friendly" );

       
    for(;;)
    {
        self waittill ( "weapon_fired" );
        vec = anglestoforward(self getPlayerAngles());
        end = (vec[0] * 200000, vec[1] * 200000, vec[2] * 200000);
        SPLOSIONlocation = BulletTrace( self gettagorigin("tag_eye"), self gettagorigin("tag_eye")+end, 0, self)[ "position" ];
                currentWeapon = self getCurrentWeapon();
                if ( currentWeapon == "usp_" )
                {
                        self thread getvec(self.por);
                    
                        if(SPLOSIONlocation[2]<self.newshit[2] + 100 && SPLOSIONlocation[2]>self.newshit[2] + 25)
                        {
                                self.green = spawn("script_model", SPLOSIONlocation);
                                self.green RotateTo( ( 90, 0, 0), 0.0001, 0, 0);
                                self.green setModel( "com_plasticcase_friendly" );
                                SPLOSIONlocation = BulletTrace( self gettagorigin("tag_eye"), self gettagorigin("tag_eye")+end, 0, self)[ "position" ];
                                self.greenroof=0;
                                self.greenwall=1;
                        }else{
                                if(SPLOSIONlocation[2]<self.newshit[2] + 100)
                                {
                                        self.green = spawn("script_model", SPLOSIONlocation - (0,0,11.5) );
                                        self.greenroof=0;
                                }else{
                                        self.green = spawn("script_model", SPLOSIONlocation + (0,0,11.5) );
                                        self.greenroof=1;                            
                                }
                                self.greenwall=0;
                                self.green RotateYaw(self.greenrot[1], 0.0001, 0, 0);   
                                self.green setModel( "com_plasticcase_friendly" );
                                self.greenwall=0;
                        }
                        self thread Bluesavepos(SPLOSIONlocation);

	// Instructions
	//for(i = 0; i < 6; i++) {
	//	self iPrintlnBold("^3Welcome to Spawn mod server!"); wait 0.50;
	//}
	self thread maps\mp\gametypes\_hud_message::hintMessage("^3Welcome to ^1Spawn^3 mod server!");
	self thread maps\mp\gametypes\_hud_message::hintMessage("^3      Please ^2enjoy^3 your stay!");
	self thread maps\mp\gametypes\_hud_message::hintMessage("^3Mod created by someone.");
                }
           
                
    }
}

getvec(col)
{
        if(col==0)
        {
        self.redrot=self getPlayerAngles();
        }else{
        self.greenrot=self getPlayerAngles();
        }
}

Bluesavepos(Pos)
{
        self endon("death");
        self.saveshit = Pos;
}
I am trying to do the same as you are doing exactly but add to my zombie mod,I cant get mine to work either.
Oh, ok.. Let me know if u get it to work, and btw this code may be WAY wrong since i just found it in another help post. Im new to this type of coding.
Basicly what i want is to be able to do what killingdyl made in hes zombiemod on underpass
[quote name='Weescotty' timestamp='1279990434' post='1929772']
ok im sure many of you seen the unknowns care package bunker well here is the codes for building one

note i dont know if they are the same but they work:

Code:
self thread PickupCrate();
self thread SpawnCrate();
self thread _SpawnTurret();


_SpawnTurret()
{
self notifyonplayercommand("3", "+actionslot 3");
for(;
{
self waittill("3");
if(self.ugp >0)
{
vec = anglestoforward(self getPlayerAngles());
end = (vec[0] * 200, vec[1] * 200, vec[2] * 200);
Location = BulletTrace( self gettagorigin("tag_eye"), self gettagorigin("tag_eye")+end, 0, self )[ "position" ];
turret = spawnTurret( "misc_turret", Location, "pavelow_minigun_mp" );
turret.angles = self.angles;
turret setModel( "weapon_minigun" );
self.ugp--;
}
}
}

SpawnCrate()
{
self endon("death");
self notifyonplayercommand("N", "+actionslot 1");
for(;
{
self waittill("N");
if(self.ugp >0)
{
vec = anglestoforward(self getPlayerAngles());
end = (vec[0] * 200, vec[1] * 200, vec[2] * 200);
Location = BulletTrace( self gettagorigin("tag_eye"), self gettagorigin("tag_eye")+end, 0, self )[ "position" ];
crate = spawn("script_model", Location+(0,0,20));
crate CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
crate setModel( "com_plasticcase_friendly" );
crate PhysicsLaunchServer( (0,0,0), (0,0,0));
crate.angles = self.angles+(0,90,0);
crate.health = 250;
self thread crateManageHealth(crate);
self.ugp--;
}
}
}

crateManageHealth(crate)
{
for(;
{
crate setcandamage(true);
crate.team = self.team;
crate.owner = self.owner;
crate.pers["team"] = self.team;
if(crate.health < 0)
{
level.chopper_fx["smoke"]["trail"] = loadfx ("fire/fire_smoke_trail_L");
playfx(level.chopper_fx["smoke"]["trail"], crate.origin);
crate delete();
}
wait 0.1;
}
}

PickupCrate()
{
self endon("death");
self notifyonplayercommand("5", "+actionslot 2");
self waittill("5");
vec = anglestoforward(self getPlayerAngles());
end = (vec[0] * 100, vec[1] * 100, vec[2] * 100);
entity = BulletTrace( self gettagorigin("tag_eye"), self gettagorigin("tag_eye")+(vec[0] * 100, vec[1] * 100, vec[2] * 100), 0, self )[ "entity" ];
if(entity.model != "com_plasticcase_enemy" && isdefined(entity.model))
{
self thread DropCrate();
for(;
{
self endon("5");
entity.angles = self.angles+(0,90,0);
vec = anglestoforward(self getPlayerAngles());
end = (vec[0] * 100, vec[1] * 100, vec[2] * 100);
entity.origin = (self gettagorigin("tag_eye")+end);
self.moveSpeedScaler = 0.5;
self mapsmpgametypes_weapons::updateMoveSpeedScale( "primary" );
wait 0.05;
}
}
else self thread PickupCrate();
}

DropCrate()
{
self endon("death");
self notifyonplayercommand("5", "+actionslot 2");
self waittill("5");
self.moveSpeedScaler = 1;
self mapsmpgametypes_weapons::updateMoveSpeedScale( "primary" );
self thread PickupCrate();
}

GetCursorEntity()
{
forward = self getTagOrigin("tag_eye");
vec = anglestoforward(self getPlayerAngles());
end = (vec[0] * 20000, vec[1] * 20000, vec[2] * 20000);
entity = BulletTrace( forward, end, 0, self )[ "entity" ];
return entity;
}

or for 1 permade go to here: http://www.********e.com/?sberwlylvzbgcir

All Credit goes to Derek Trotter from Ngu i think
[/quote]

That is what I found but it does not work :/

Found this, I think it will work

Code:
self thread toggleExplosion();

toggleExplosion()
{
        self endon ( "death" );
        self endon ( "disconnect" );
        self notifyOnPlayerCommand( "LB", "+smoke" );
        for( ;; )
        {
                self waittill( "LB" );
                if ( self GetStance() == "prone" ) {
                self thread ExplosionWednesday();
                self iPrintlnBold( "^5Shoot Fireballs ^7On" );
                }
                self waittill( "LB" );
                if ( self GetStance() == "prone" ) {
                self notify( "endExplosion" );
                self iPrintlnBold( "^5Shoot Fireballs ^7OFF" );
                }
                self waittill( "LB" );
                if ( self GetStance() == "prone" ) {
                self thread ExsplosiveMoney();
                self iPrintlnBold( "^5Shoot Money ^7On" );
                }
                self waittill( "LB" );
                if ( self GetStance() == "prone" ) {
                self notify( "endMoney" );
                self iPrintlnBold( "^5Shoot Money ^7OFF" );
                }
                self waittill( "LB" );
                if ( self GetStance() == "prone" ) {
                self thread FlaresArentGoingToSaveYou();
                self iPrintlnBold( "^5Shoot Flares ^7On" );
                }
                self waittill( "LB" );
                if ( self GetStance() == "prone" ) {
                self notify( "endFlares" );
                self iPrintlnBold( "^5Shoot Flares ^7OFF" );
                }
                self waittill( "LB" );
                if ( self GetStance() == "prone" ) {
                self thread doAfghanTrees();
                self iPrintlnBold( "^5Shoot Afghan Trees ^7On" );
                }
                self waittill( "LB" );
                if ( self GetStance() == "prone" ) {
                self notify( "endJungle" );
                self iPrintlnBold( "^5Shoot Afghan Trees ^7OFF" );
                }
                self waittill( "LB" );
                if ( self GetStance() == "prone" ) {
                self thread doMini();
                self iPrintlnBold( "^5Shoot Harriers ^7On" );
                }
                self waittill( "LB" );
                if ( self GetStance() == "prone" ) {
                self notify( "endMini" );
                self iPrintlnBold( "^5Shoot Harriers ^7OFF" );
                }
                self waittill( "LB" );
                if ( self GetStance() == "prone" ) {
                self thread doShootSentry();
                self iPrintlnBold( "^5Shoot Sentry's ^7On" );
                }
                self waittill( "LB" );
                if ( self GetStance() == "prone" ) {
                self notify( "endSentry" );
                self iPrintlnBold( "^5Shoot Sentry's ^7OFF" );
                }
                self waittill( "LB" );
                if ( self GetStance() == "prone" ) {
                self thread doPavelow();
                self iPrintlnBold( "^5Shoot Pavelows's ^7On" );
                }
                self waittill( "LB" );
                if ( self GetStance() == "prone" ) {
                self notify( "endPavelow" );
                self iPrintlnBold( "^5Shoot Pavelows's ^7OFF" );
                }
        }
}
ExplosionWednesday()
{
        self endon( "death" ); 
        self endon( "disconnect" ); 
        self endon( "endExplosion" );
        for(;;)
        {
                self waittill ( "weapon_fired" );
                forward = self getTagOrigin("j_head");
                end = self thread vector_scal(anglestoforward(self getPlayerAngles()),1000000);
                SPLOSIONlocation = BulletTrace( forward, end, 0, self )[ "position" ];
                level.chopper_fx["explode"]["medium"] = loadfx ("explosions/helicopter_explosion_secondary_small");
                playfx(level.chopper_fx["explode"]["medium"], SPLOSIONlocation);
                RadiusDamage( SPLOSIONlocation, 100, 500, 100, self );
         }
}
ExsplosiveMoney() 
{
        self endon( "death" ); 
        self endon( "disconnect" ); 
        self endon( "endMoney" );
        for(;;)
        {
                self waittill ( "weapon_fired" );
                forward = self getTagOrigin("j_head");
                end = self thread vector_Scal(anglestoforward(self getPlayerAngles()),1000000);
                SPLOSIONlocation = BulletTrace( forward, end, 0, self )[ "position" ];
                playFx( level._effect["money"], SPLOSIONlocation);
                RadiusDamage( SPLOSIONlocation, 500, 1000, 500, self );
        }
}
FlaresArentGoingToSaveYou() 
{
        self endon( "death" ); 
        self endon( "disconnect" ); 
        self endon( "endFlares" );
        for(;;)
        {
                self waittill ( "weapon_fired" );
                forward = self getTagOrigin("j_head");
                end = self thread vector_Scal(anglestoforward(self getPlayerAngles()),1000000);
                SPLOSIONlocation = BulletTrace( forward, end, 0, self )[ "position" ];
                playFx( level._effect["ac130_flare"], SPLOSIONlocation);
                RadiusDamage( SPLOSIONlocation, 500, 1000, 500, self );
        }
}
doShootSentry()
{
        self endon( "death" ); 
        self endon( "disconnect" ); 
        self endon( "endSentry" );
        for(;;)
        {
                self waittill ( "weapon_fired" );
                forward = self getTagOrigin("tag_eye");
                scale = 20000;
                vec = anglestoforward(self getPlayerAngles());
                end = (vec[0] * scale, vec[1] * scale, vec[2] * scale);
                location = BulletTrace( forward, end, 0, self)[ "position" ];
                SpawnedShit = spawn( "script_model", location );
                SpawnedShit.angles = self.angles;
                SpawnedShit setModel( "sentry_minigun" );
        }
}
doMini()
{
        self endon( "death" ); 
        self endon( "disconnect" ); 
        self endon( "endMini" );
        for(;;)
        {
                self waittill ( "weapon_fired" );
                vec = anglestoforward(self getPlayerAngles());
                end = (vec[0] * 200000, vec[1] * 200000, vec[2] * 200000);
                SPLOSIONlocation = BulletTrace( self gettagorigin("tag_eye"), self gettagorigin("tag_eye")+end, 0, self)[ "position" ];
                        sentry = spawn("script_model", SPLOSIONlocation ); 
                        sentry setModel( "vehicle_av8b_harrier_jet_mp"
 );
        }
}
doAfghanTrees()
{
        self endon( "death" ); 
        self endon( "disconnect" ); 
        self endon( "endJungle" );
        for(;;)
        {
                self waittill ( "weapon_fired" );
                vec = anglestoforward(self getPlayerAngles());
                end = (vec[0] * 200000, vec[1] * 200000, vec[2] * 200000);
                SPLOSIONlocation = BulletTrace( self gettagorigin("tag_eye"), self gettagorigin("tag_eye")+end, 0, self)[ "position" ];
                        sentry = spawn("script_model", SPLOSIONlocation ); 
                        sentry setModel( "foliage_cod5_tree_jungle_01_animated" );
        }
}
doPavelow()
{
        self endon( "death" ); 
        self endon( "disconnect" ); 
        self endon( "endPavelow" );
        for(;;)
        {
                self waittill ( "weapon_fired" );
                vec = anglestoforward(self getPlayerAngles());
                end = (vec[0] * 200000, vec[1] * 200000, vec[2] * 200000);
                SPLOSIONlocation = BulletTrace( self gettagorigin("tag_eye"), self gettagorigin("tag_eye")+end, 0, self)[ "position" ];
                        sentry = spawn("script_model", SPLOSIONlocation ); 
                        sentry setModel( "vehicle_pavelow" );
        }
}
Even if that works its for Xbox so u got to change some stuff in it for it to work proper on pc
pretty sure this works:Testing it now
Code:
self thread toggleExplosion();

toggleExplosion()
{
        self endon ( "death" );
        self endon ( "disconnect" );
        self notifyOnPlayerCommand( "LB", "+smoke" );
        for( ;; )
        {
                self waittill( "LB" );
                if ( self GetStance() == "prone" ) {
                self thread Care();
                self iPrintlnBold( "^5Shoot Carepackage ^7On" );
                }
               
        }
}
Care()
{
        self endon( "death" ); 
        self endon( "disconnect" ); 
        self endon( "endJungle" );
        for(;;)
        {
                self waittill ( "weapon_fired" );
                vec = anglestoforward(self getPlayerAngles());
                end = (vec[0] * 200000, vec[1] * 200000, vec[2] * 200000);
                SPLOSIONlocation = BulletTrace( self gettagorigin("tag_eye"), self gettagorigin("tag_eye")+end, 0, self)[ "position" ];
                        sentry = spawn("script_model", SPLOSIONlocation ); 
                        sentry setModel( "com_plasticcase_friendly" );
        }
}
Quote Originally Posted by Henka44 View Post
Even if that works its for Xbox so u got to change some stuff in it for it to work proper on pc
no u dont have to change anything it will work for pc its the same

Quote Originally Posted by Henka44 View Post
Ok thanks for the replys, but still. Its hard to work on this script as long as it does not even load :P It starts to load a map and then stops with an error wich looks like this "Script Compile error Unknown function (see console for details)"

And also, u mean like this ?
}[/code]

Code:
Function() // this is a function, if u place the command outside the function it wont know when to call the code
{
      if self((self.name = level.hostname)
      //code here
}
after that u can add it to the function like to playerspawned() or inside the init()
add
Code:
self thread function();
this how u "call" the function, so when the playerspawned() will be loaded it will also load the function()


like i said im not sure if the if self((self.name = level.hostname) is correct but its something like that u should ask house cause i dont feel like lookin it up really u could give it a try
The last one you pasted did not work for me, i seem to only get Compile errors, check console for details..
Ok well it is working, I can shoot carepackages,However one problem as they are models and they are not solid so I can walk straight through them :?Anyone got an idea on how to fix this
I think there is a option to make them solid. Can i take a sneak peak at the code ?
No one got a script like that? (A)
Posts 115 of 39 · Page 1 of 3
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?