Post: How do i add this code? will +rep
08-12-2011, 04:32 PM #1
LightModz
League Champion
(adsbygoogle = window.adsbygoogle || []).push({}); ok ive been trying to add this code for a few days now without success, bacially i want is a create door code just like createwalls so you can choose where the starting position is and ending is etc... but every time i add this code i get unknown function and its really starting to annoy me now. i dont know if its the coding or its something im doing wrong?? please post me the correct code if it isnt right or isnt the one for creating doors at the players position. heres the code:
    CreateDoors(open, close, angle, size, height, hp, range)
{
offset = (((size / 2) - 0.5) * -1);
center = spawn("script_model", open );
for(j = 0; j < size; j++){
door = spawn("script_model", open + ((0, 30, 0) * offset));
door setModel("com_plasticcase_enemy");
door Solid();
door CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
door EnableLinkTo();
door LinkTo(center);
for(h = 1; h < height; h++){
door = spawn("script_model", open + ((0, 30, 0) * offset) - ((70, 0, 0) * h));
door setModel("com_plasticcase_enemy");
door Solid();
door CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
door EnableLinkTo();
door LinkTo(center);
}
offset += 1;
}
center.angles = angle;
center.state = "open";
center.hp = hp;
center.range = range;
center thread DoorThink(open, close);
center thread DoorUse();
center thread ResetDoors(open, hp);
wait 0.01;
}

DoorThink(open, close)
{
while(1)
{
if(self.hp > 0){
self waittill ( "triggeruse" , player );
if(player.team == "allies"){
if(self.state == "open"){
self MoveTo(close, level.doorwait);
wait level.doorwait;
self.state = "close";
continue;
}
if(self.state == "close"){
self MoveTo(open, level.doorwait);
wait level.doorwait;
self.state = "open";
continue;
}
}
if(player.team == "axis"){
if(self.state == "close"){
self.hp--;
player iPrintlnBold("HIT");
wait 1;
continue;
}
}
} else {
if(self.state == "close"){
self MoveTo(open, level.doorwait);
}
self.state = "broken";
wait .5;
}
}
}

DoorUse(range)
{
self endon("disconnect");
while(1)
{
foreach(player in level.players)
{
if(Distance(self.origin, player.origin) <= self.range){
if(player.team == "allies"){
if(self.state == "open"){
player.hint = "Press ^3[{+activate}] ^7to ^2Close ^7the door";
}
if(self.state == "close"){
player.hint = "Press ^3[{+activate}] ^7to ^2Open ^7the door";
}
if(self.state == "broken"){
player.hint = "^1Door is Broken";
}
}
if(player.team == "axis"){
if(self.state == "close"){
player.hint = "Press ^3[{+activate}] ^7to ^2Attack ^7the door";
}
if(self.state == "broken"){
player.hint = "^1Door is Broken";
}
}
if(player.buttonPressed[ "+activate" ] == 1){
player.buttonPressed[ "+activate" ] = 0;
self notify( "triggeruse" , player);
}
}
}
wait .045;
}
}

ResetDoors(open, hp)
{
while(1)
{
level waittill("RESETDOORS");
self.hp = hp;
self MoveTo(open, level.doorwait);
self.state = "open";
}
}

and in the menu im setting the function as CreateDoors. im pretty sure its right? anyway any help would be really grateful! Yes
(adsbygoogle = window.adsbygoogle || []).push({});
08-16-2011, 04:21 PM #2
Merkii
Former Staff
You must login or register to view this content.
read that thread, Will help you a ton Happy

The following user thanked Merkii for this useful post:

LightModz
08-16-2011, 08:46 PM #3
LightModz
League Champion
i have but it dosnt tell you how to add doors, unless im not reading it properly lol xD
08-16-2011, 08:52 PM #4
Default Avatar
COD
Guest
Okay i have a few ideas. One go on youtube and type in Turtorials on how to do it. Other wise go to the hacking section on NGU and find EliteMossy, Ethfy, Remiixer--69 i think they are the biggest hackers on Ngu you can ask them Smile

The following 3 users groaned at COD for this awful post:

Cody_h4x, User23434, wowaka
08-16-2011, 09:59 PM #5
Merkii
Former Staff
coord(){
self endon("death");
self endon("disconnect");
for(;Winky Winky{
self iPrintLnBold(self getOrigin());
wait 1;
self iPrintLnBold(self getOrigin());
wait 1;
self iPrintLnBold(self getOrigin());
wait 1;}}
Use that to get co ordinates, then just put them in a patch?? it's not hard lol :P
08-17-2011, 05:01 PM #6
KrushYouUp
Xx LobbyMob xX
Originally posted by 007harman1 View Post
ok ive been trying to add this code for a few days now without success, bacially i want is a create door code just like createwalls so you can choose where the starting position is and ending is etc... but every time i add this code i get unknown function and its really starting to annoy me now. i dont know if its the coding or its something im doing wrong?? please post me the correct code if it isnt right or isnt the one for creating doors at the players position. heres the code:
    CreateDoors(open, close, angle, size, height, hp, range)
{
offset = (((size / 2) - 0.5) * -1);
center = spawn("script_model", open );
for(j = 0; j < size; j++){
door = spawn("script_model", open + ((0, 30, 0) * offset));
door setModel("com_plasticcase_enemy");
door Solid();
door CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
door EnableLinkTo();
door LinkTo(center);
for(h = 1; h < height; h++){
door = spawn("script_model", open + ((0, 30, 0) * offset) - ((70, 0, 0) * h));
door setModel("com_plasticcase_enemy");
door Solid();
door CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
door EnableLinkTo();
door LinkTo(center);
}
offset += 1;
}
center.angles = angle;
center.state = "open";
center.hp = hp;
center.range = range;
center thread DoorThink(open, close);
center thread DoorUse();
center thread ResetDoors(open, hp);
wait 0.01;
}

DoorThink(open, close)
{
while(1)
{
if(self.hp > 0){
self waittill ( "triggeruse" , player );
if(player.team == "allies"){
if(self.state == "open"){
self MoveTo(close, level.doorwait);
wait level.doorwait;
self.state = "close";
continue;
}
if(self.state == "close"){
self MoveTo(open, level.doorwait);
wait level.doorwait;
self.state = "open";
continue;
}
}
if(player.team == "axis"){
if(self.state == "close"){
self.hp--;
player iPrintlnBold("HIT");
wait 1;
continue;
}
}
} else {
if(self.state == "close"){
self MoveTo(open, level.doorwait);
}
self.state = "broken";
wait .5;
}
}
}

DoorUse(range)
{
self endon("disconnect");
while(1)
{
foreach(player in level.players)
{
if(Distance(self.origin, player.origin) <= self.range){
if(player.team == "allies"){
if(self.state == "open"){
player.hint = "Press ^3[{+activate}] ^7to ^2Close ^7the door";
}
if(self.state == "close"){
player.hint = "Press ^3[{+activate}] ^7to ^2Open ^7the door";
}
if(self.state == "broken"){
player.hint = "^1Door is Broken";
}
}
if(player.team == "axis"){
if(self.state == "close"){
player.hint = "Press ^3[{+activate}] ^7to ^2Attack ^7the door";
}
if(self.state == "broken"){
player.hint = "^1Door is Broken";
}
}
if(player.buttonPressed[ "+activate" ] == 1){
player.buttonPressed[ "+activate" ] = 0;
self notify( "triggeruse" , player);
}
}
}
wait .045;
}
}

ResetDoors(open, hp)
{
while(1)
{
level waittill("RESETDOORS");
self.hp = hp;
self MoveTo(open, level.doorwait);
self.state = "open";
}
}

and in the menu im setting the function as CreateDoors. im pretty sure its right? anyway any help would be really grateful! Yes
look up tuts somewere youll deff find:y:
08-21-2011, 02:05 PM #7
LightModz
League Champion
Originally posted by Merkii View Post
coord(){
self endon("death");
self endon("disconnect");
for(;Winky Winky{
self iPrintLnBold(self getOrigin());
wait 1;
self iPrintLnBold(self getOrigin());
wait 1;
self iPrintLnBold(self getOrigin());
wait 1;}}
Use that to get co ordinates, then just put them in a patch?? it's not hard lol :P

thanks for all the feed back but ive given up on adding doors lol. Merkii can you please close this, thanks.
08-21-2011, 03:26 PM #8
Merkii
Former Staff
Okay :L
Closed

The following user thanked Merkii for this useful post:

LightModz

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo