Raised This Month: $ Target: $400
 0% 

Some problem in my plugin (may be Two Dimensional Arrays problem)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-14-2014 , 16:38   Re: Some problem in my plugin (may be Two Dimensional Arrays problem)
Reply With Quote #1

I think that this serip is the problem, because you get the IP of everyone (with index 0) and I think this can't be don..
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 06-14-2014 , 17:10   Re: Some problem in my plugin (may be Two Dimensional Arrays problem)
Reply With Quote #2

Quote:
Originally Posted by Flick3rR View Post
I think that this serip is the problem, because you get the IP of everyone (with index 0) and I think this can't be don..
getting index 0's ip gets the server's ip
can't understand code or whether op wants that or not but it should help
to get all ips use a loop
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
ryo89589
Member
Join Date: Aug 2011
Old 06-14-2014 , 22:04   Re: Some problem in my plugin (may be Two Dimensional Arrays problem)
Reply With Quote #3

Quote:
Originally Posted by Flick3rR View Post
I think that this serip is the problem, because you get the IP of everyone (with index 0) and I think this can't be don..
Quote:
Originally Posted by aron9forever View Post
getting index 0's ip gets the server's ip
can't understand code or whether op wants that or not but it should help
to get all ips use a loop
Let me give you a new one:
PHP Code:
#include <amxmodx>
#include <amxmisc>
 
#define PLUGIN_NAME "Beta Server System"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "ryo89589"
 
new plugin_enabledpip[65][22]
 
public 
plugin_init()
{
 
register_plugin(PLUGIN_NAME,PLUGIN_VERSION,PLUGIN_AUTHOR)
 
plugin_enabled register_cvar("amx_betasys""0")
 
register_concmd("amx_addpass""addpass"ADMIN_RCON"<playername|auth> - add specified player as a pass user")
 
register_concmd("amx_delpass""delpass"ADMIN_RCON"<playername|auth> - delete specified player as a pass user")
}
 
public 
client_authorized(id)
 return 
get_pcvar_num(plugin_enabled) ? checkUser(id) : PLUGIN_CONTINUE
 
public delayed_kick(user[])
 
server_cmd("kick #%d"user[0])
 
public 
checkUser(id)
{
 new 
serip[22], userip[22]
 
get_user_ip(0seripcharsmax(serip), 1)
 
get_user_ip(iduseripcharsmax(userip), 1)
 
 if( 
equal(useripserip21) || equal(userippip[0], 21) )
  return 
PLUGIN_HANDLED
 
 
new userid[3]
 
userid[0] = get_user_userid(id)
 
set_task(0.1"delayed_kick"0userid1)
 
 return 
PLUGIN_CONTINUE
}
 
public 
addpass(idlevelcid)
{
 if (!
cmd_access(idlevelcid2))
  return 
PLUGIN_HANDLED
 
 
new name[33], ip[22], arg[33]
 
read_argv(1arg32)
 
get_user_name(idnamecharsmax(name))
 
get_user_ip(idipcharsmax(ip))
 
 if( !
equal(argpip[0], 21) )
  
copy(pip[0], charsmax(arg), arg)
 
 return 
PLUGIN_HANDLED
}
 
public 
delpass(idlevelcid)
{
 if (!
cmd_access(idlevelcid2))
  return 
PLUGIN_HANDLED
 
 
new name[33], ip[22], arg[22]
 
read_argv(1argcharsmax(arg))
 
get_user_name(idnamecharsmax(name))
 
get_user_ip(idipcharsmax(ip))
 
 if( 
equal(argpip[0], 21) )
  
copy(pip[0], 0"")
 
 return 
PLUGIN_HANDLED

This adds "equal(userip, serip, 21)" only.

The problem still exists.

When I use amx_addpass added the player as a pass user, this is no problem.
Players can enter the server.

When I add multiple ip in the database, the problems will arise.
Only the latest IP can pass.
Also, when I delete an ip , all pass user's IP will be affect.
So, I think "addpass" & "delpass" There are some problems.
Please help me to check. Thank you!!

Last edited by ryo89589; 06-14-2014 at 23:09.
ryo89589 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 21:17.


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