Raised This Month: $51 Target: $400
 12% 

Limit weapon via IP.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Voltron
Senior Member
Join Date: Jun 2007
Location: Above the battlefield.
Old 06-16-2010 , 10:32   Limit weapon via IP.
Reply With Quote #1

Hi all,

I'm trying to implement a system on my server where if a player gets 8 kills in a row they will only be able to use the dual elites for the rest of that map.
So I don't need the players IP or Steam ID saved to a file...just kept in memory so if the player rejoins the map the server will remember that their weapons are limited.

If I want to do this using a players IP address, would I have to use a dynamic array?
__________________

Last edited by Voltron; 06-16-2010 at 10:39.
Voltron is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 06-16-2010 , 11:26   Re: Limit weapon via IP.
Reply With Quote #2

Use SteamID. You can use normal arrays, however it will be restricted to the amount of SteamIDs equal to the size of array. You should use the dynamic ones in this case.
__________________
hleV is offline
Voltron
Senior Member
Join Date: Jun 2007
Location: Above the battlefield.
Old 06-16-2010 , 23:42   Re: Limit weapon via IP.
Reply With Quote #3

Quote:
Originally Posted by hleV View Post
Use SteamID. You can use normal arrays, however it will be restricted to the amount of SteamIDs equal to the size of array. You should use the dynamic ones in this case.
Could you give me some example code?

I just need to know how to store the SteamID in an array. And how I would check to see if a players SteamID is in that array.
__________________
Voltron is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-17-2010 , 09:42   Re: Limit weapon via IP.
Reply With Quote #4

Quote:
Originally Posted by Voltron View Post
Could you give me some example code?
Using CellArray
PHP Code:
// Create Array
new Array:array = ArrayCreate(34);


// Store SteamID
new authid[34];
get_user_authid(idauthidcharsmax(authid));
ArrayPushString(array, authid);


// See if SteamID exists
new authid[34];
new 
bool:found false;
new 
k;
new 
size ArraySize(array);
while (
size)
{
    
ArrayGetString(array, k++, authidcharsmax(authid));
    if (
equal(authid"STEAM_0:1:16"))
    {
        
found true;
        break;
    }
}
if (
found)
    
// SteamID found
else
    
// SteamID not found 
Not tested, but should work. There are might be more efficient ways, but this should at least point you in the right direction
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-17-2010 , 10:34   Re: Limit weapon via IP.
Reply With Quote #5

Yami, Trie would be perfect for this situation, lazy to write example, but he can search around and find what he wants
__________________
xPaw is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-17-2010 , 10:35   Re: Limit weapon via IP.
Reply With Quote #6

Upgrade your nosteam server so you can use steamids
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-17-2010 , 12:11   Re: Limit weapon via IP.
Reply With Quote #7

Quote:
Originally Posted by xPaw View Post
Yami, Trie would be perfect for this situation, lazy to write example, but he can search around and find what he wants
Never used Trie. What are the benefits?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-17-2010 , 13:44   Re: Limit weapon via IP.
Reply With Quote #8

Quote:
Originally Posted by YamiKaitou View Post
Never used Trie. What are the benefits?
Just compare to this:

Code:
new Trie:g_tSteamIds; // init g_tSteamIds = TrieCreate( ); // end TrieDestroy( g_tSteamIds ); // add TrieSetString( g_tSteamIds, "STEAM_0:1:16", 1 ); // Hi bailopan! // check TrieKeyExists( g_tSteamIds, "STEAM_0:1:16" ); // delete TrieDeleteKey( g_tSteamIds, "STEAM_0:1:16" );
__________________
xPaw is offline
Voltron
Senior Member
Join Date: Jun 2007
Location: Above the battlefield.
Old 06-17-2010 , 21:38   Re: Limit weapon via IP.
Reply With Quote #9

Quote:
Originally Posted by ConnorMcLeod View Post
Upgrade your nosteam server so you can use steamids
It's a hybrid server so I can use SteamIDs too.

xPaw, this is the first I've heard of Trie. Interesting.

And thanks for the response guys. I was gonna give you good karma but it looks like it's been removed. lol
__________________
Voltron is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-17-2010 , 21:44   Re: Limit weapon via IP.
Reply With Quote #10

Quote:
Originally Posted by Voltron View Post
It's a hybrid illegal server so I can use SteamIDs too.
__________________
fysiks 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 06:19.


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