AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how to hold user ip/authid/userid in plugin ?? (https://forums.alliedmods.net/showthread.php?t=144400)

reinert 12-03-2010 11:53

how to hold user ip/authid/userid in plugin ??
 
Hey, I would like to make a plugin that gives an advertisement messages...

PHP Code:

like msgShown[33] = 0;

swtich(msgShown[id]){
   case 
0client_print(idprint_chat"ad number 1"msgShown[id]++;
   case 
1client_print(idprint_chat"ad number 2"msgShown[id]++;
   case 
2client_print(idprint_chat"ad number 3"msgShown[id]++;
   case 
3client_print(idprint_chat"ad number 4"msgShown[id]++;


But if user disconnects, the messages will be shown from start...

These 4 messages should be displayed in order within 1 map :]

Should it look like:

PHP Code:

new userid get_user_userid(id);

client_print(useridprint_chat"ad number 1"msgShown[userid]++; 


fysiks 12-03-2010 13:41

Re: how to hold user ip/authid/userid in plugin ??
 
If they disconnect then there is no point in trying to send them a message. You cannot use a userid in place of a player entity index.

reinert 12-04-2010 01:50

Re: how to hold user ip/authid/userid in plugin ??
 
I mean reconnecting instead of disconnecting...

By the way, it's just an example with ads, I've other idea ;)

Exolent[jNr] 12-04-2010 02:12

Re: how to hold user ip/authid/userid in plugin ??
 
You can use Tries to save player data by their name/authid/ip/userid (string format).

reinert 12-04-2010 02:28

Re: how to hold user ip/authid/userid in plugin ??
 
Um is there another way ? Because tries saves for longer time than 1 map :). I would like to make very simple plugin, that just gives warnings, for example after 3rd warning u get kick, and I want to save warning numbers for player, because when he comes back. if he gets 1 warning more, he will be banned...

4 warnings - kick
player connects again, he still have 4 warnings, so 1 more, banned ! :)

Exolent[jNr] 12-04-2010 02:31

Re: how to hold user ip/authid/userid in plugin ??
 
Tries do not save over map.

reinert 12-04-2010 02:52

Re: how to hold user ip/authid/userid in plugin ??
 
Ok...

Maybe an example ? (This http://forums.alliedmods.net/showthread.php?t=74753 tutorial didn't me explain anything ;D)

Exolent[jNr] 12-04-2010 03:00

Re: how to hold user ip/authid/userid in plugin ??
 
Quote:

Originally Posted by reinert (Post 1362620)
Ok...

Maybe an example ? (This http://forums.alliedmods.net/showthread.php?t=74753 tutorial didn't me explain anything ;D)

That's not a Trie tutorial. That's a custom include that enhances features for Tries.

reinert 12-04-2010 03:20

Re: how to hold user ip/authid/userid in plugin ??
 
So I didn't found real tutorial over snippets/tutorials... Could someone give me an example ?

fysiks 12-04-2010 18:24

Re: how to hold user ip/authid/userid in plugin ??
 
I think this is all that you will need:

PHP Code:

new Trie:g_tTrieName

public plugin_init()
{
    
g_tTrieName TrieCreate()
}

// ...

    // set the value
    
TrieSetCell(g_tTrieNameszAuthID1)

// ...

    // get the value
    
new currentvalue
    
if( TrieGetCell(g_tTrieNameszAuthIDcurrentvalue) )
    {
        
SteamID found in Triecurrentvalue is . . . the current value :)
    } 



All times are GMT -4. The time now is 11:24.

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