AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Someone give this plugin a home (https://forums.alliedmods.net/showthread.php?t=1190)

IceMouse[WrG] 04-18-2004 18:14

Someone give this plugin a home
 
I was writing a plugin and all was going good. Then I finished, fixed the few compiler errors, and went to test it out.
It gave me a bad load. So I went to switch a few things around, and nothing seemed to work. So I'm going to do the IceMouse thing, and give up. I'll let someone else work on it, and do whatever they please with it.
All it is, is the beginning what would have been a small conversion of EntMod(By Drunken_F00l)
So if you want to take it off my hands, then just say you will. I'll happily answer any questions about the source you have, and offer ideas of where to go from there if you fix it
Code:
#include <amxmodx> #include <amxmisc> #include <engine> //#define VELOCITY new PLUGIN[] = "EntMod"; new VERSION[] = "1.0BETA"; new AUTHOR[] = "IceMouse"; new grabbed[33] = {0,...}; new Float:grablength[33] = {0.0,...}; #if defined VELOCITY     new graboldmove[33] = {0,...};     new graboldsolid[33] = {0,...}; #endif new rndTaskID; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR);     register_clcmd("+grabent", "BeginEntGrab", ADMIN_LEVEL_A, " - Grab an entity");     register_clcmd("-grabent", "EndEntGrab");     register_clcmd("+pushent", "BeginEntPush", ADMIN_LEVEL_A, " - Push the currently held entity away");     register_clcmd("-pushent", "EndEntPush");     register_clcmd("+pullent", "BeginPullEnt", ADMIN_LEVEL_A, " - Pull the currently held entity close");     register_clcmd("-pullent", "EndEntPull");     register_clcmd("use_ent","cmdUseEnt",ADMIN_LEVEL_A," - Use the entity you are looking at");     register_cvar("amxx_movestrength","25");     rndTaskID = (random_num(35,3500)*random_num(3,18))%random_num(59, 293); } public client_connect(id) {     #if defined VELOCITY         if(grabbed[id] > 0)         {             entity_set_int(grabbed[id],EV_INT_movetype,graboldmove[id]);             entity_set_int(grabbed[id],EV_INT_solid,graboldsolid[id]);         }         graboldmove[id] = 0;         graboldsolid[id] = 0;     #endif     grabbed[id] = 0;     grablength[id] = 0.0;     return PLUGIN_CONTINUE; } public client_disconnect(id) {     #if defined VELOCITY         if(grabbed[id] > 0)         {             entity_set_int(grabbed[id],EV_INT_movetype,graboldmove[id]);             entity_set_int(grabbed[id],EV_INT_solid,graboldsolid[id]);         }         graboldmove[id] = 0;         graboldsolid[id]=0;     #endif     grabbed[id] = 0;     grablength[id] = 0.0;     return PLUGIN_CONTINUE; } public BeginEntGrab(id,level,cid) {     if(!cmd_access(id,level,cid,1))     {         client_print(id,print_console,"You do not have access to this command");         return PLUGIN_HANDLED;     }     grabbed[id] = -1;     return PLUGIN_HANDLED; } public EndEntGrab(id,level,cid) {     #if defined VELOCITY         if(grabbed[id] > 0)         {             entity_set_int(grabbed[id],EV_INT_movetype,graboldmove[id]);             entity_set_int(grabbed[id],EV_INT_solid,graboldsolid[id]);         }         graboldmove[id] = 0;         graboldsolid[id]=0;     #endif     grabbed[id] = 0;     grablength[id] = 0.0;     return PLUGIN_HANDLED; } public client_PreThink(id) {     if(grabbed[id] != -1)         return PLUGIN_CONTINUE             new grabEnt;     new Float:Origin[3];     new Float:End[3];     new NmEnd[3];     new Float:Return[3];         entity_get_vector(id,EV_VEC_origin,Origin);     get_user_origin(id,NmEnd,3);     IVecFVec(NmEnd,End);         grabEnt = trace_line(id, Origin, End, Return);     if(!grabEnt)         return PLUGIN_CONTINUE;     grabbed[id] = grabEnt;     #if defined VELOCITY         graboldmove[id] = entity_get_int(id,EV_INT_movetype);         graboldsolid[id] = entity_get_int(id,EV_INT_solid);         entity_set_int(id,EV_INT_solid,SOLID_BBOX);         entity_set_int(id,EV_INT_movetype,MOVETYPE_FLY);     #endif     grablength[id] = vector_distance(Origin, Return);     return PLUGIN_CONTINUE; } public server_frame() {     new a = 1;     for(a = 1; a < 33; a++)     {                 new entid, entGrabber;         new i = 1;         new Float:GrabberOrigin[3];         new Float:GrabbedOrigin[3];         new Float:NewLook[3];         new NmNewLook[3];         new Float:NewLen;         new Float:Vec[3];                 if(grabbed[a] > 0)         {             entid = grabbed[a];             entGrabber = a;         }         else         {             continue;         }                 if(entid < 33 && entid > 0)         {             if(!is_user_alive(entid))             {                 grabbed[a] = 0;                 grablength[a] = 0.0;                 continue;             }         }                         entity_get_vector(entid,EV_VEC_origin,GrabbedOrigin);         entity_get_vector(entGrabber,EV_VEC_origin,GrabberOrigin);         get_user_origin(entGrabber,NmNewLook,3);         IVecFVec(NmNewLook,NewLook);         NewLen = vector_distance(GrabberOrigin,NewLook);         if(NewLen == 0.0)             NewLen = 1.0;                     for(i = 0; i < 3; i++)         {             Vec[i] = (NewLook[i] - GrabberOrigin[i]) * (grablength[entGrabber]/NewLen);             Vec[i] = GrabberOrigin[i] + Vec[i];             #if defined VELOCITY                 Vec[i] = Vec[i] - GrabbedOrigin[i];             #endif         }         #if defined VELOCITY             entity_set_vector(entid, EV_VEC_velocity, Vec);         #else             entity_set_vector(entid, EV_VEC_origin, Vec);         #endif     }     return PLUGIN_CONTINUE; } public BeginEntPull(id,level,cid) {     if(!cmd_access(id,level,cid,1))         return PLUGIN_HANDLED;         if(grabbed[id] > 0)         if(!task_exists(rndTaskID+id))             set_task(0.1, "PullTask", rndTaskID+id, "", 1, "b")         else             client_print(id,print_console,"You are already manipluating an entity!");     else         client_print(id,print_console, "You have no entity to pull!");         return PLUGIN_HANDLED; } public EndEntPull(id,level,cid) {     if(task_exists(rndTaskID+id))         remove_task(rndTaskID+id);     return PLUGIN_HANDLED; } public BeginEntPush(id,level,cid) {     if(!cmd_access(id,level,cid,1))             return PLUGIN_HANDLED;             if(grabbed[id] > 0)         if(!task_exists(rndTaskID+id))             set_task(0.1, "PushTask", rndTaskID+id, "", 1, "b")         else             client_print(id,print_console,"You are already manipulating an entity!");     else         client_print(id,print_console, "You have no entity to push!");             return PLUGIN_HANDLED; } public EndEntPush(id,level,cid) {     if(task_exists(rndTaskID+id))         remove_task(rndTaskID+id);     return PLUGIN_HANDLED; } public PushTask(TaskID) {     new id = TaskID - rndTaskID;     if(grabbed[id] < 1)         remove_task(TaskID);     grablength[id] += get_cvar_num("amxx_movestrength"); } public PullTask(TaskID) {     new id = TaskID - rndTaskID;     if(grabbed[id] < 1)         remove_task(TaskID);     grablength[id] -= get_cvar_num("amxx_movestrength"); } public cmdUseEnt(id,level,cid) {     if(!cmd_access(id,level,cid,1))         return PLUGIN_HANDLED;     new Float:Origin[3];     new NmLook[3];     new Float:Look[3];     new Float:Return[3];     new entid;         entity_get_vector(id,EV_VEC_origin,Origin);     get_user_origin(id,NmLook,3);     IVecFVec(NmLook,Look);         entid = trace_line(id,Origin, Look, Return);     if(!entid)     {         client_print(id,print_console,"You are not looking at an entity");         return PLUGIN_HANDLED;     }     force_use(id,entid);         return PLUGIN_HANDLED; }
It compiles with no errors, and gives a bad load. Good luck!
EDIT: It's also likely to be a silly error(A misspelling or something)... I'm just too lazy to grammar-check

AssKicR 04-18-2004 18:37

damn you... i have secretly been working on this myself :cry: :cry:

IceMouse[WrG] 04-18-2004 18:57

It only took me about 1/2 hour to do this morning
EDIT: And it should drag entities as intended... And everything else should work... With the exception of loading

IceMouse[WrG] 04-18-2004 20:29

I suppose nobody's got the guts to take this one!!!!! :cry:
Oh well I'll add one or two things while it's rotting away

QwertyAccess 04-18-2004 20:33

add e_use

IceMouse[WrG] 04-18-2004 20:34

Thats what I was about to add :D

QwertyAccess 04-18-2004 20:38

plugin looks neat

IceMouse[WrG] 04-18-2004 20:40

I may not leave the best comments, but my names aren't as trivial as some peoples code(OLO)

AssKicR 04-18-2004 20:46

I'l adopt ur plugin if ur giving up =/, but that doesn't sound like u too give up

IceMouse[WrG] 04-18-2004 20:47

Well I'm not going to dwell on it... The majority of the code is there, so if someone gets it to load, then it's basically done... All I know is that this has been asked for A LOT

IceMouse[WrG] 04-18-2004 22:19

Updated with use_ent command

QwertyAccess 04-19-2004 00:27

use_ent has weird ass bugs like it works sometimes and other times it doesnt and says its not an entity.

KiN | SuicideDog 04-19-2004 01:09

this would be cool if you could use this to pull or push the bomb around..

QwertyAccess 04-19-2004 02:27

you can do it if the plugin works right.

IceMouse[WrG] 04-19-2004 07:20

You got it to load, Qwerty?
And theres nothing I can do about that bug... You need to be looking at the entity AS you use it... I could use a task to do it, if you really want it to repeat, so you can click and drag

AssKicR 04-19-2004 10:33

just looked on ur plugin.. fixed some erorrs and discovered the following... even Jedi Force Grab is better than this plugin....

however this one can grab hostages as well as players....

reason for this is that u are setting Velocity.... u should be calculating and setting origin....

IceMouse[WrG] 04-19-2004 16:03

No, velocity is the way to go, especially if I have to use serverframe for this... Because if you set velocity every frame then you don't have to check for wall/player collision in the code, and since it updates itself every frame, it wouln't go too far

And if it only grabs players and hostages, then thats probably AMXX's fault, although I'll bet it grabs whatever entmod did

AssKicR 04-19-2004 16:21

well... you can't set velocity on all ents... they need to be a specific movetype... so origin is the only posible way to go

IceMouse[WrG] 04-19-2004 16:29

Did entmod allow for ents clipping through the wall? If so then I can change it to origin, or set the movetype... I haven't used EntMod in so long, all I remember is that ents moved, and I just chose the use velocity

EDIT: Updated grabbed ents to use MOVETYPE_FLY(No gravity, collisions(And velocity, I hope)) while grabbed, and revert back to old movetype when released

AssKicR 04-19-2004 16:53

Quote:

Originally Posted by IceMouse[WrG
]
EDIT: Updated grabbed ents to use MOVETYPE_FLY(No gravity, collisions(And velocity, I hope)) while grabbed, and revert back to old movetype when released

that won't work either


your hlds will crash with this error "SOLID_BSP without MOVETYPE_PUSH"

IceMouse[WrG] 04-19-2004 16:57

SOLID_BSP without MOVETYPE_PUSH...
Hm... Can I change the SOLID_BSP? If not then I'll just use origin... I just don't think its as good if it clips the walls
EDIT: I know I can change EV_INT_solid, but I was asking if I changed it to that would it create complications?

QwertyAccess 04-19-2004 19:18

trace_line is buggy or force_use because it thinks a func_door is an entity and sometimes not quite alot.

IceMouse[WrG] 04-20-2004 16:09

Updated again... Define VELOCITY at the top and it compiles to use velocity instead of origin(Changes movetype and solid(Don't know if that will cause problems in HL))... Otherwise just sets its origin frame by frame

EDIT: Also fixed -pull/pushent not working


All times are GMT -4. The time now is 07:29.

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