Raised This Month: $ Target: $400
 0% 

some advices and corrections?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 06-16-2012 , 17:57   some advices and corrections?
Reply With Quote #1

Alright before you read this code, i am relatively at new coding. I have intermediate (maybe a bit more) knowledge in c++, but i want to learn amxx scripting. I have had this idea for a while about his plugin.
It basically on command searches for players with the same ip. And by cvar, blackout (mp_fadetoblack like function) those players when dead.

NOTE: i am pretty aware that this plugin might have a lot of bad written stuff but you gotta learn someday also i couldn't test it all by myself, and that's why i came to you guys for help
I put a lot of comments so i don't forget (force of habit )

Now on to the code
EDIT: code removed

I appreciate any help from anyone, thank you
P.S.: i just wanted to thank MPNumB a lot, he has been very kind to me in helping me immensly with this

I am planning on releasing this plugin as soon as it becomes stable.
If you have any questions about a part of the code, let me know

Last edited by n0br41ner; 06-17-2012 at 21:04. Reason: updated the code
n0br41ner is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 06-16-2012 , 18:22   Re: some advices and corrections?
Reply With Quote #2

PHP Code:
for(new 1g_iMaxPlayersi++) 
-->
PHP Code:
for(new 1<= g_iMaxPlayersi++) 
--------------------------------------------------------
PHP Code:
g_iMaxPlayers clamp(get_maxplayers(), 132); 
-->
PHP Code:
g_iMaxPlayers get_maxplayers(); 
--------------------------------------------------------
PHP Code:
get_user_ip(ig_iPlayersIP[i], 151); 
-->
PHP Code:
get_user_ip(ig_iPlayersIP[i], charsmaxg_iPlayersIP[ ] ) , 1); 
--------------------------------------------------------
PHP Code:
for(new 032i++) {
    
g_bSameIPs[i] = false;
}    

// Looping through all players and comparing IPs
for(new 133i++) {
    if(
i%!=0) {
        for(new 
115j++) {
            
// If IP does not match, set bFound as false
            
if(g_iPlayersIP[j][j] != g_iPlayersIP[j+1][j]) {
                
bFound false;
            }    
        }
    
        
// If bFound is true, change g_bSameIPs accordingly
        
if(bFound) {
            
iFoundCounter++;
            
g_bSameIPs[i]     = true;
            
g_bSameIPs[i++] = true;
        }
    }

-->
PHP Code:
// Looping through all players and comparing IPs
for(new 1<= g_iMaxPlayersi++) {
    if( 
is_user_connected) )
    {
        
g_bSameIPs[i] = false;
        if(
i%!=0) {
            for(new 
115j++) {
                
// If IP does not match, set bFound as false
                
if(g_iPlayersIP[j][j] != g_iPlayersIP[j+1][j]) {
                    
bFound false;
                }    
            }
        
            
// If bFound is true, change g_bSameIPs accordingly
            
if(bFound) {
                
iFoundCounter++;
                
g_bSameIPs[i]     = true;
                
g_bSameIPs[i++] = true;
            }
        }
    }

And the same corrections from the other loops...
__________________

Last edited by Neeeeeeeeeel.-; 06-16-2012 at 18:26.
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 06-16-2012 , 18:29   Re: some advices and corrections?
Reply With Quote #3

[php]for(new i = 1; i <= g_iMaxPlayers; i++) [php]
thank you i have missed that

PHP Code:
g_iMaxPlayers clamp(get_maxplayers(), 132); 
i think thats better since if max_players is lower than 1 it returns 1
and if its bigger than 32 it returns 32
m i wrong?

PHP Code:
get_user_ip(ig_iPlayersIP[i], charsmaxg_iPlayersIP[ ] ) , 1); 
thank you again

PHP Code:
// Looping through all players and comparing IPs
for(new 1<= g_iMaxPlayersi++) {
    if( 
is_user_connected)
    {
        
g_bSameIPs[i] = false;
        if(
i%!=0) {
            for(new 
115j++) {
                
// If IP does not match, set bFound as false
                
if(g_iPlayersIP[j][j] != g_iPlayersIP[j+1][j]) {
                    
bFound false;
                }    
            }
        
            
// If bFound is true, change g_bSameIPs accordingly
            
if(bFound) {
                
iFoundCounter++;
                
g_bSameIPs[i]     = true;
                
g_bSameIPs[i++] = true;
            }
        }
    }

fixed

ill fix the code in a moment
EDIT: code updated

Last edited by n0br41ner; 06-16-2012 at 18:36.
n0br41ner is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-16-2012 , 18:53   Re: some advices and corrections?
Reply With Quote #4

Quote:
Originally Posted by n0br41ner View Post
PHP Code:
g_iMaxPlayers clamp(get_maxplayers(), 132); 
i think thats better since if max_players is lower than 1 it returns 1
and if its bigger than 32 it returns 32
m i wrong?
You are right, but max players will always be 1 to 32 since that is the only available range for CS.
Therefore, there's no reason to make that check.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 06-16-2012 , 18:54   Re: some advices and corrections?
Reply With Quote #5

By hard coding servers are able to go up to several hundred of players
At least that's what I herd, and I think I saw such a server back in the days

Last edited by n0br41ner; 06-16-2012 at 18:55.
n0br41ner is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-16-2012 , 18:59   Re: some advices and corrections?
Reply With Quote #6

Quote:
Originally Posted by n0br41ner View Post
By hard coding servers are able to go up to several hundred of players
At least that's what I herd, and I think I saw such a server back in the days
It's not possible to have more than 32 players in a CS 1.6 or valid HL1 game.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 06-16-2012 , 19:02   Re: some advices and corrections?
Reply With Quote #7

Since it won't Make a difference, I removed that piece
Any other corrections?

Last edited by n0br41ner; 06-16-2012 at 19:03.
n0br41ner is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 06-16-2012 , 19:30   Re: some advices and corrections?
Reply With Quote #8

PHP Code:
Print(iPlayerID); 
I think that's not possible...

To show into server console:
PHP Code:
console_printid"%d"iPlayerID ); 
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 06-16-2012 , 19:53   Re: some advices and corrections?
Reply With Quote #9

Why isn't it possible, I'm passing the I'd of the player who used the command in order to print it in their console of the players who have the same ip.

What's the difference between console_print() and client_print( , print_console, ) ???
n0br41ner is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 06-16-2012 , 22:27   Re: some advices and corrections?
Reply With Quote #10

Quote:
Originally Posted by n0br41ner View Post
Why isn't it possible, I'm passing the I'd of the player who used the command in order to print it in their console of the players who have the same ip.

What's the difference between console_print() and client_print( , print_console, ) ???
But there is not any native called "Print" in amxmodx.

At least in functionality, there is no difference.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
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 06:16.


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