AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Plugin needs fixing (https://forums.alliedmods.net/showthread.php?t=10333)

philman213 02-16-2005 01:13

Plugin needs fixing
 
Okay my current plugin, originally by SpaceDude doesnt want to work.
It went from a sma for amx, to a sma for amxx. I had to edit a included file from the vexd to just xtrafun. Okay so I compiled, it works, but gives me a warning. I ignore it. I get the amxx, and I put everything In the right place. I also know that my plugins.ini, and everything else should be setup correctly.

So I run my dedicated server on my computer and the server works, amxx works, but the grab command wont. Is there something wrong with my script?

http://www.intrinic.com/jedi_force_grab.sma

nightscreem 02-16-2005 06:59

yhea the problem is
you have this
Quote:

#include <amxmod>
#include <amxmodx>
#include <xtrafun>
and it need to be this
Quote:

#include <amxmodx>
#include <xtrafun>
and download xtrafun from here
http://amxmod.net/forums/viewtopic.php?t=10714

XxKpAznGuyxX 02-16-2005 08:38

need to change the <xtrafun> to cstrike or engine (forgot). you cann't have xtrafun module in AMXMODX.

NiGHTFiRE 02-16-2005 09:04

its
 
#include <xtrafun> is in AMXX #include <engine>

NiGHTFiRE 02-16-2005 09:07

it
 
if you change that the code should be
Quote:

#include <amxmod>
#include <amxmodx>
#include <engine>

new grabbed[33]
new grablength[33]
new bool:grabmodeon[33]
new velocity_multiplier

public grabtask(parm[])
{
new id = parm[0]
new targetid, body
if (!grabbed[id])
{
get_user_aiming(id, targetid, body)
if (targetid)
{
set_grabbed(id, targetid)
}
}
if (grabbed[id])
{
new origin[3], look[3], direction[3], moveto[3], grabbedorigin[3], velocity[3], length

if (!is_user_alive(grabbed[id]))
{
release(id)
return
}

get_user_origin(id, origin, 1)
get_user_origin(id, look, 3)
get_user_origin(grabbed[id], grabbedorigin)

direction[0]=look[0]-origin[0]
direction[1]=look[1]-origin[1]
direction[2]=look[2]-origin[2]
length = get_distance(look,origin)
if (!length) length=1 // avoid division by 0

moveto[0]=origin[0]+direction[0]*grablength[id]/length
moveto[1]=origin[1]+direction[1]*grablength[id]/length
moveto[2]=origin[2]+direction[2]*grablength[id]/length

velocity[0]=(moveto[0]-grabbedorigin[0])*velocity_multiplier
velocity[1]=(moveto[1]-grabbedorigin[1])*velocity_multiplier
velocity[2]=(moveto[2]-grabbedorigin[2])*velocity_multiplier

set_user_velocity(grabbed[id], velocity)
}
}

public grab_toggle(id)
{
if (grabmodeon[id])
release(id)
else
grab(id)
return PLUGIN_HANDLED
}

public grab(id)
{
if (!(get_user_flags(id)&ADMIN_SLAY))
{
client_print(id,print_notify,"[AMX] You have no access to that command")
return PLUGIN_HANDLED
}
if (!grabmodeon[id])
{
new targetid, body
new parm[1]
parm[0] = id
velocity_multiplier = get_cvar_num("sv_grabforce")
grabmodeon[id]=true
set_task(0.1, "grabtask", 100+id, parm, 1, "b")
get_user_aiming(id, targetid, body)
if (targetid)
{
set_grabbed(id, targetid)
}
else
{
client_print(id,print_notify,"[AMX] Searching for a target")
}
}
return PLUGIN_HANDLED
}

public release(id)
{
if (!(get_user_flags(id)&ADMIN_SLAY))
{
client_print(id,print_notify,"[AMX] You have no access to that command")
return PLUGIN_HANDLED
}
if (grabmodeon[id])
{
grabmodeon[id]=false
if (grabbed[id])
{
new targname[32]
set_user_gravity(grabbed[id])
set_user_rendering(grabbed[id])
get_user_name(grabbed[id],targname,31)
client_print(id,print_notify,"[AMX] You have released %s", targname)
}
else
{
client_print(id,print_notify,"[AMX] No target found")
}
grabbed[id]=0
remove_task(100+id)
}
return PLUGIN_HANDLED
}

public spec_event(id)
{
new targetid = read_data(2)

if (targetid < 1 || targetid > 32)
return PLUGIN_CONTINUE

if (grabmodeon[id] && !grabbed[id])
{
set_grabbed(id, targetid)
}
return PLUGIN_CONTINUE
}

public set_grabbed(id, targetid)
{
new origin1[3], origin2[3], targname[32]
get_user_origin(id, origin1)
get_user_origin(targetid, origin2)
grabbed[id]=targetid
grablength[id]=get_distance(origin1,origin2)
set_user_gravity(targetid,0.001)
set_user_rendering(targetid,kRenderFxGlowShel l,10,145,245, kRenderNormal, 0)
get_user_name(targetid,targname,31)
client_print(id,print_notify,"[AMX] You have grabbed onto %s", targname)
}


public plugin_init()
{
register_plugin("Jedi Force Grab","1.1","SpaceDude")
register_cvar("sv_grabforce","8")
register_clcmd("grab_toggle","grab_toggle",AD MIN_SLAY,"press once to grab and again to release")
register_clcmd("+grab","grab",ADMIN_SLAY,"bin d a key to +grab")
register_clcmd("-grab","release",ADMIN_SLAY)
register_event("StatusValue","spec_event","be ","1=2")
}
I'm not sure though why amxmod is ni this.

nightscreem 02-16-2005 09:11

you can use xtrafun for amxx
but engine is the same
try this .sma
i tryed to compile it with the web compiler and it works
try it if it's works on cs don't really know

NiGHTFiRE 02-16-2005 09:12

i think bailopan wants to use engine

philman213 02-16-2005 20:24

1 Attachment(s)
I did what you guys said to do, only have include amxmodx and engine, and I got +4 errors, and still have the 1 warning.


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

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