AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Creating Buyzones (https://forums.alliedmods.net/showthread.php?t=50412)

Hawk552 01-25-2007 18:45

Creating Buyzones
 
How would you create a buyzone in a certain spot that can be used? Let's just say for example in a spot where a person spawns, thus something like {-16.0,-16.0,-36.0}/{16.0,16.0,36.}.

I've tried checking if the person is next to it and forcing them to touch, but nothing is happening. I've also tried forcing the status icon, but that also doesn't work.

Here's my code for creating it so far:

Code:
Ent = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))     if(!Ent)         return 0             //new TeamValue[5]     //format(TeamValue,4,"%d",Team + 1)         set_pev(Ent,pev_classname,g_Buyzone)     set_pev(Ent,pev_model,"*19")         //set_kvd(0,KV_ClassName,g_Buyzone)     //set_kvd(0,KV_KeyName,"team")     //set_kvd(0,KV_Value,TeamValue)     //set_kvd(0,KV_fHandled,0)     //dllfunc(DLLFunc_KeyValue,Ent,0)     //set_pev(Ent,pev_movetype,MOVETYPE_PUSH)     set_pev(Ent,pev_team,Team + 1)     dllfunc(DLLFunc_Spawn,Ent)     engfunc(EngFunc_SetOrigin,Ent,Origin)     new Float:Min[3],Float:Max[3]     Min = Origin     Max = Origin     Min[2] -= 36.0     Max[2] += 36.0     for(new Count;Count < 2;Count++)     {         Min[Count] -= 16.0         Max[Count] += 16.0     }         set_pev(Ent, pev_renderfx, kRenderFxNone)     set_pev(Ent, pev_rendercolor, Float:{0.0,255.0,0.0})     set_pev(Ent, pev_rendermode, kRenderNormal)     set_pev(Ent, pev_renderamt, 255.0)         //set_pev(Ent,pev_absmin,Min)     //set_pev(Ent,pev_absmax,Max)     //set_pev(Ent,pev_mins,Min)     //set_pev(Ent,pev_maxs,Max)     //engfunc(EngFunc_SetSize,Ent,Min,Max)     engfunc(EngFunc_SetSize,Ent,Float:{-100.0,-100.0,-36.0},Float:{100.0,100.0,36.0})     set_pev(Ent,pev_solid,SOLID_TRIGGER)     //set_pev(Ent,pev_team,Team + 1)

Very messy, I know.

I also tried the post think thing:

Code:
public ForwardPlayerPostThink(id) {     static Float:Origin[3],Classname[33]     pev(id,pev_origin,Origin)         new Ent,Team = get_user_team(id)         while((Ent = engfunc(EngFunc_FindEntityByString,Ent,"classname",g_Buyzone)) != 0)     {                 if(fm_distance_to_boxent(id,Ent) > 50.0 || pev(Ent,pev_team) != Team)             continue                     client_print(id,print_chat,"Found buyzone")         dllfunc(DLLFunc_Touch,Ent,id)         break     } }

It says "found buyzone" when you're close to one, but it doesn't let you buy.

Hawk552 01-25-2007 18:47

Re: Creating Buyzones
 
Just a couple notes:

The buyzones are made during plugin_precache, and "Team + 1" is because it is passed as a 0 or 1, with 0 being terrorist and CT being 1.

Emp` 01-25-2007 18:50

Re: Creating Buyzones
 
this succesfully creates a buyzone at spawns. perhaps you can manipulate it. http://emp`.ampaste.net/6148

Hawk552 01-25-2007 19:02

Re: Creating Buyzones
 
Quote:

Originally Posted by Emp` (Post 431641)
this succesfully creates a buyzone at spawns. perhaps you can manipulate it. http://emp`.ampaste.net/6148

Umm... I don't think it's that simple...

Cheap_Suit 01-25-2007 20:00

Re: Creating Buyzones
 
I did this before. Setting the size didnt work for me but setting the absmin/max worked.


You can also look at this plugins:
http://forums.alliedmods.net/showthread.php?p=358059
http://forums.alliedmods.net/showthread.php?p=365040



Orangutanz 01-25-2007 20:12

Re: Creating Buyzones
 
Code:
public plugin_precache() {     new gBuy = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "func_buyzone"))     if (gBuy)     {         set_pev(gBuy, pev_team, 1)         dllfunc(DLLFunc_Spawn, gBuy)         engfunc(EngFunc_SetOrigin, gBuy, Float:{1420.0, 705.0, 16.0})         engfunc(EngFunc_SetSize, gBuy, Float:{-128.0, -128.0, -64.0}, Float:{128.0, 128.0, 64.0})     }   }
Creates a buyzone at the ramp (de_dust2) overlooking bombsite A

Hawk552 01-25-2007 20:16

Re: Creating Buyzones
 
Thanks, it works.

jopmako 01-26-2007 01:15

Re: Creating Buyzones
 
If want to let player can buy at any spawn point only
just remove all "func_buyzone" when "func_buyzone" create
then engine will auto support that.

Hawk552 01-26-2007 08:57

Re: Creating Buyzones
 
Quote:

Originally Posted by jopmako (Post 431782)
If want to let player can buy at any spawn point only
just remove all "func_buyzone" when "func_buyzone" create
then engine will auto support that.

No, I don't want to break the original functionality of the map.


All times are GMT -4. The time now is 22:19.

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