Raised This Month: $ Target: $400
 0% 

Redirection by Origin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rolling735
Junior Member
Join Date: Sep 2005
Old 04-11-2006 , 16:28   Redirection by Origin
Reply With Quote #1

Code:
#include <amxmodx> public plugin_init() {     register_plugin("teleRedirect","10","MikeRolling")     register_cvar("redir_origin","")    //origin     register_cvar("redir_server","")    //Server redirect } public client_infochanged(id) {     new origin[33],redir[64],server[64]         get_cvar_string("redir_origin",redir,63)     get_cvar_string("redir_server",server,63)         get_user_origin(id,origin[3],mode = 0)     if(equal(origin[3],redir))         client_cmd(id,"connect %s",server)             return PLUGIN_HANDLED }
I want to make it so when a player is in a certin location you are redirected. This is for "The Specialists Mod" thanks.
Rolling735 is offline
Send a message via AIM to Rolling735
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 04-11-2006 , 17:31  
Reply With Quote #2

Code:
new const distance = 100 public client_PreThink(id) {     new Float:pOrig[3], Float:origin[3]     entity_get_vector(id,EV_VEC_origin, pOrig)     new text[32], blaa[3][10]     get_cvar_string("redir_origin", text,31)     parse(text, blaa[0],9, blaa[1],9, blaa[2],9)     for(new i = 0; i < 3; i++) origin[i] = floatstr(blaa[i])     if(vector_distance(pOrig,origin) <= distance) {         new server[32]         get_cvar_string("redir_server", server,31)         client_cmd(id, "connect %s", server)     }     return PLUGIN_CONTINUE }

btw, u sure u want to use cvars for the origin? reading from a file would be better if u have multiple maps on the server
__________________
plop
p3tsin is offline
Rolling735
Junior Member
Join Date: Sep 2005
Old 04-11-2006 , 17:45   thanks
Reply With Quote #3

Thanks for the help, and i would like to use a .ini but i am not sure how to do it.
Rolling735 is offline
Send a message via AIM to Rolling735
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 04-11-2006 , 17:51  
Reply With Quote #4

Code:
#define MAX_ORIGINS 10 new Float:redir_origin[MAX_ORIGINS][3] public plugin_cfg() {     new configsdir[128], filename[192]     get_configsdir(configsdir,127)     format(filename,191, "%s/redir_list.ini", configsdir)     if(!file_exists(filename)) {         log_amx("File not found: %s", filename)         return PLUGIN_CONTINUE     }     new mapname[32]     get_mapname(mapname,31)     new line, data[64], txt     while(read_file(filename,line++,data,63,txt)) {         if(data[0] == ';' || !txt) continue         //if(equal(data,mapname)) ...     }     return PLUGIN_CONTINUE }
__________________
plop
p3tsin is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:42.


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