AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   set/get_user_origin problem (https://forums.alliedmods.net/showthread.php?t=24525)

[ --<-@ ] Black Rose 02-25-2006 11:20

set/get_user_origin problem
 
ok guys... need help with this script...
it suppose to move slowly forward ( the same way as the player is aiming ) but it teleports you over the hole map in one second :S
and its not any problem with set task is to fast... its the set/get_user_origin() and/or origin[1]++ i think

heres the scripts
Code:
#include <amxmodx> #include <fun> #define PLUGIN "CageCMD" #define VERSION "1.0" #define AUTHOR "[ --<-@ ]" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_clcmd("+cagecmd", "start_cmd")     register_clcmd("-cagecmd", "stop_cmd")         cmd_ad() } public start_cmd(id) {         new mapname[32]     get_mapname( mapname, 31 )     if ( ! equali( mapname, "surf_ski") ) {         return PLUGIN_HANDLED     }     set_task( 0.1, "move_forward", id, _, _, "b")         return PLUGIN_CONTINUE } public stop_cmd(id) {         remove_task(id)     } public move_forward(id) {         new origin[3]         get_user_origin(id, origin, 3)         origin[1]++         set_user_origin(id, origin)     } public cmd_ad() {         new mapname[32]     get_mapname( mapname, 31 )     if ( ! equali( mapname, "surf_ski") ) {         return PLUGIN_HANDLED     }         client_print( 0, print_chat, "to get out of jail use +cagecmd")     client_print( 0, print_chat, "please bind it using: bind key ^"+cagecmd^"")         set_task( 60.0, "cmd_ad", 0 )         return PLUGIN_CONTINUE }

VEN 02-25-2006 11:28

Here:
Code:
    get_user_origin(id, origin, 3)

Code:
// amxmodx.inc /* Gets origin from player. * Modes: <b><font color="green">* 0 - current position.</font></b> * 1 - position from eyes (weapon aiming). * 2 - end position from player position. <b><font color="red">* 3 - end position from eyes (hit point for weapon). </font></b> * 4 - position of last bullet hit (only CS). */ native get_user_origin(index, origin[3], mode = 0);

Also better check mapname only once in plugin init. If map equal your map name then set ad. task and register +/- commands.

[ --<-@ ] Black Rose 02-25-2006 11:32

ok with some thinking i understand that the origin that was saved was the one on aiming point... i thought it was players location but in the direction he was looking... :oops:

so you're telling me i should do
Code:
get_user_origin(id, origin, 0)
?

how would you make him move forward... in the direction of players eyes? not the direction of the map's "forward"

VEN 02-25-2006 11:44

http://forums.alliedmods.net/showthread.php?t=23403
http://forums.alliedmods.net/showthread.php?t=23469

[ --<-@ ] Black Rose 02-25-2006 11:57

thank you VEN! :D


All times are GMT -4. The time now is 20:24.

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