Raised This Month: $ Target: $400
 0% 

save a id when client connect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
liryck
Senior Member
Join Date: Mar 2007
Location: Venezuela
Old 03-05-2010 , 22:15   save a id when client connect
Reply With Quote #1

hi there i want to save ID when client connect and doesn't change it just save it to show a menu.

and always check if that ID ( player ) is still in the server if not get a random ID.

what don't know at moment is to save id that doesn't change.
liryck is offline
Send a message via MSN to liryck
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 03-05-2010 , 22:24   Re: save a id when client connect
Reply With Quote #2

?
Code:
new tempid public client_connect( id )     tempid = id
Need to be a little more specific.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
liryck
Senior Member
Join Date: Mar 2007
Location: Venezuela
Old 03-05-2010 , 22:55   Re: save a id when client connect
Reply With Quote #3

i think in this, if i made it has u said it will changed when other player connect?

PHP Code:
public client_connect(id){
    
player++
    if(
player == 1){
        
p_id id
    
}
}
// a server with 10 slot.   the variable player should be 1 again when 9 ppl leave?
public client_disconnect(id){
   
player--

the next point is that p_id show it a menu i can make this?
PHP Code:
register_clcmd"say .scrim","ShowMenu",p_id"Shows The menu" 

Last edited by liryck; 03-05-2010 at 22:59.
liryck is offline
Send a message via MSN to liryck
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 03-05-2010 , 22:59   Re: save a id when client connect
Reply With Quote #4

So you're trying to just get the first person that joins the server and display a menu to them?

EDIT: Here's my interpretation of what you're doing. new players

Code:
new tempid public plugin_init() {     register_plugin( "Firsy Player Menu", VERSION, "Wrecked" ) // :avast:         register_clcmd( "say /menudisp", "CMD_DispMenu" ) } public client_connect( id ) {     players++         if( players == 1 )         tempid = id } public client_disconnect( id ) {     players-- } public CMD_DispMenu( id ) {     if( id == tempid )         menu_display( id, yourmenu, 0 )             else         print_chat( id, print_chat, "You're not the first player!" ) }
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT

Last edited by wrecked_; 03-05-2010 at 23:03.
wrecked_ is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-05-2010 , 23:19   Re: save a id when client connect
Reply With Quote #5

Code:
#include < amxmodx > new g_iFirstPlayer; public plugin_init( ) {     register_clcmd( "say .scrim", "CmdScrim" ); } public client_putinserver( iPlayer ) {     if( !g_iFirstPlayer )     {         g_iFirstPlayer = iPlayer;                 PrintAllow( );     } } public client_disconnect( iPlayer ) {     if( iPlayer == g_iFirstPlayer )     {         g_iFirstPlayer = -1;         set_task( 2.0, "TaskChooseNewPlayer" );     } } public TaskChooseNewPlayer( ) {     new iPlayers[ 32 ], iNum;     get_players( iPlayers, iNum, "ch" );         g_iFirstPlayer = iNum ? iPlayers[ random( iNum ) ] : 0;         PrintAllow( ); } public CmdScrim( iPlayer ) {     if( iPlayer == g_iFirstPlayer )     {         // this player can say .scrim     }     else     {         client_print( iPlayer, print_chat, "You are not allowed to use this command." );     } } PrintAllow( ) {     client_print( g_iFirstPlayer, print_chat, "You are allowed to use .scrim command." ); }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
liryck
Senior Member
Join Date: Mar 2007
Location: Venezuela
Old 03-05-2010 , 23:35   Re: save a id when client connect
Reply With Quote #6

can u explain me what's this make
PHP Code:
g_iFirstPlayer iNum iPlayersrandomiNum ) ] : 0
i know that it take another player but whats mean ? between iNum and iPlayers and the 0 at the end
liryck is offline
Send a message via MSN to liryck
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 03-05-2010 , 23:37   Re: save a id when client connect
Reply With Quote #7

https://forums.alliedmods.net/showthread.php?t=79543
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Old 03-05-2010, 23:37
Exolent[jNr]
This message has been deleted by Exolent[jNr]. Reason: wrecked_ provided good example and explanation.
liryck
Senior Member
Join Date: Mar 2007
Location: Venezuela
Old 03-06-2010 , 11:28   Re: save a id when client connect
Reply With Quote #8

fix it

Last edited by liryck; 03-06-2010 at 11:34. Reason: nvm i think i fix it
liryck is offline
Send a message via MSN to liryck
liryck
Senior Member
Join Date: Mar 2007
Location: Venezuela
Old 03-06-2010 , 12:52   Re: save a id when client connect
Reply With Quote #9

ok i have another question. i have this, the player choose a map right? i call this funct for the changemap and i set a bool to true.

my question is when the map change the bool will be true or it will be false?


PHP Code:
new boolnewmap false

public changelevel(){
    
ChangeMap( );
    
newmap true

liryck is offline
Send a message via MSN to liryck
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-06-2010 , 12:55   Re: save a id when client connect
Reply With Quote #10

Quote:
Originally Posted by liryck View Post
ok i have another question. i have this, the player choose a map right? i call this funct for the changemap and i set a bool to true.

my question is when the map change the bool will be true or it will be false?


PHP Code:
new boolnewmap false

public changelevel(){
    
ChangeMap( );
    
newmap true

The entire plugin will reload at mapchange so all variables will return to default value..so false. If you want to save data between mapchanges you will need some kind of storage mechanism (files, nvault, SQL, etc)
__________________
Bugsy is offline
Reply


Thread Tools
Display Modes

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 08:38.


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