AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Redirection by Origin (https://forums.alliedmods.net/showthread.php?t=26938)

Rolling735 04-11-2006 16:28

Redirection by Origin
 
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.

p3tsin 04-11-2006 17:31

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 :)

Rolling735 04-11-2006 17:45

thanks
 
Thanks for the help, and i would like to use a .ini but i am not sure how to do it.

p3tsin 04-11-2006 17:51

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 }


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

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