Raised This Month: $ Target: $400
 0% 

Solved Problerm with autokick


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 07-26-2020 , 10:45   Re: Problerm with autokick
Reply With Quote #2

1. You don't need a semicolon after preprocessors.
2. Indent your code proprely.
3. Check for player IP while is connecting.
Code:
#include <amxmodx> #include <amxmisc> #pragma semicolon 1 #define zIP    "178.138.33.138" public client_connect( id ) {     new szIP[40], players[32], num;     get_user_ip ( id, szIP, charsmax(szIP) , 1 ); // Get player's IP, without port.     if(equal(szIP, zIP)  )     {         server_cmd( "kick #%d ^"Bye loser^"", get_user_userid( id ) );     }     //else // You don't need an 'esle' situation, cuz you're stopping the function.     return PLUGIN_HANDLED; }

Your code is kicking all players, because...:
Code:
if( !task_exists( id + 1337 ) && !equal(szIP, "zIP")  ) // Checking if the task don't exists and  player's IP is not equal whit "zIP" ??? You defined zIP before, as constant, why you use it like a string?     {         set_task( 30.0, "task_NextPlayer", id + 1337 );     }

Code:
public task_NextPlayer( id ) {     id -= 1337; // If you remove task, then your condition from putinserver phase will be false     if( !is_user_connected( id ) )         return;         server_cmd( "kick #%d ^"Bye loser^"", get_user_userid( id ) );     }
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]

Last edited by Shadows Adi; 07-26-2020 at 18:45. Reason: Added explaination why his code isn't workin'
Shadows Adi is offline
 



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 13:48.


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