AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Create a room? (https://forums.alliedmods.net/showthread.php?t=163194)

Simba 07-27-2011 16:41

Create a room?
 
How can I create a "room" at the given x/y/z coordinates with a fixed size to which I can teleport players (for a knife duel)? :)

hornet 07-28-2011 02:16

Re: Create a room?
 
It's not exactly a very realistic idea. I doubt anyone would want to make the models for each wall.
Perhaps you could try taking a look at the knife duel plugin and change the opponent distance check to check the distance from where you and your opponent started, so effectively you'd have an invisible wall around the players.

Simba 07-28-2011 07:38

Well I just want to make simple walls with one color or a transparent box. I've been searching the forums and found this (edited a little):
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <engine>

public plugin_init() {
    
register_clcmd("create""create")
}

public 
create(id) {
new 
sx[8], sy[8], sz[8]
new 
Float:origin[3]
read_argv(1,sx,7)
read_argv(2,sy,7)
read_argv(3,sz,7)
origin[0] = str_to_float(sx)
origin[1] = str_to_float(sy)
origin[2] = str_to_float(sz)
new 
ent create_entity("info_target");
entity_set_string(entEV_SZ_classname"safebox_blue");
entity_set_int(entEV_INT_solidSOLID_BBOX);
entity_set_int(entEV_INT_movetypeMOVETYPE_FLY);
entity_set_origin(entorigin);

new 
Float:mins[3] = {-255.0, -115.0, -71.0}
new 
Float:maxs[3] = {255.0115.071.0}

entity_set_size(entminsmaxs);

mins[0] = origin[0] - 255.0;
mins[1] = origin[1] - 115.0;
mins[2] = origin[2] - 71.0;

maxs[0] = origin[0] + 255.0;
maxs[1] = origin[1] + 115.0;
maxs[2] = origin[2] + 71.0;

message_begin(MSG_BROADCASTSVC_TEMPENTITY);
write_byte(TE_BOX);
write_coord(floatround(mins[0])); // boxmins
write_coord(floatround(mins[1]));
write_coord(floatround(mins[2]));
write_coord(floatround(maxs[0])); // boxmaxs
write_coord(floatround(maxs[1]));
write_coord(floatround(maxs[2]));
write_short(999999); // life in 0.1 s
write_byte(255); // r
write_byte(0); // g
write_byte(0); // b
message_end();


It creates a box with no walls, only the edges:

http://i46.servimg.com/u/f46/15/56/01/28/untitl11.jpg

But the server crashes when I touch it or shoot at it. :(

wrecked_ 07-28-2011 08:05

Re: Create a room?
 
Quote:

Originally Posted by Simba (Post 1520267)
But the server crashes when I touch it or shoot at it. :(

Show us the think forward for the entity.

Simba 07-28-2011 08:20

Re: Create a room?
 
There isn't any. That is the whole code.

SnoW 07-28-2011 09:25

Re: Create a room?
 
There is two ways to do this. You can make one entity which you let only the two players to get inside ( it is solid for others ) or make solid entities for each wall. The question is do you want the knife fighting players to be able to leave the room and do you want that everyone sees the room walls? I would like to see some real models and solid walls, but it is you who needs to get the model.

Exolent[jNr] 07-28-2011 10:05

Re: Create a room?
 
Your code will only create a solid box, not 6 walls where players can run inside.
You should give the entity a model as well.

Simba 07-28-2011 10:34

Quote:

Originally Posted by Exolent[jNr] (Post 1520362)
Your code will only create a solid box, not 6 walls where players can run inside.
You should give the entity a model as well.

How can I make an empty box? Is making 6 separate walls the only way to do it? And why does my code crash the server?

Exolent[jNr] 07-28-2011 10:35

Re: Create a room?
 
Quote:

Originally Posted by Simba (Post 1520390)
How can I make an empty box? Is making 6 separate walls the only way to do it? And why does my code crash the server?

You have to use 6 separate walls since hollow entities aren't possible.

Your code crashes the server most likely because there is no model.


All times are GMT -4. The time now is 00:58.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.