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

Best method to saving player data?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 08-06-2013 , 05:13   Best method to saving player data?
Reply With Quote #1

I'm sort of new to this concept so bear with me. I'm currently coding a system for my Jailbreak plugin which gives off a timer and a ban function once the timer reaches it's limit. I'm currently attempting to figure out a method to saving the client's information so if they disconnect, the plugin bans them anyways.

Any methods I can use? I'm not sure how to do this properly.

Goal: A timer is created with client's info, bans them at the end of the timer and bans them if they disconnect.

Any ideas? Thanks,
- Jack
Drixevel is offline
TheGodKing
BANNED
Join Date: Dec 2012
Location: PrintToChatAll("Aus
Old 08-06-2013 , 05:55   Re: Best method to saving player data?
Reply With Quote #2

This plugin determines who it is going to ban and waits for 3 map changes before doing so.
Dissecting the plugin will give you a method to accomplish your wish.

https://forums.alliedmods.net/showthread.php?t=181455

Last edited by TheGodKing; 08-08-2013 at 02:54.
TheGodKing is offline
blaacky
Senior Member
Join Date: Oct 2012
Old 08-06-2013 , 05:55   Re: Best method to saving player data?
Reply With Quote #3

I hope this makes sense.

PHP Code:
if(/*Client's steamid is queued to be banned*/)
{
    if(
IsClientInGame(client))
    {
        
KickClient(client);
    }
    
    
// Add client to ban list here

blaacky is offline
necavi
Veteran Member
Join Date: Sep 2010
Old 08-06-2013 , 06:06   Re: Best method to saving player data?
Reply With Quote #4

Personally, for something so simple I'd just use Get/SetClientCookie.
necavi is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 08-06-2013 , 09:21   Re: Best method to saving player data?
Reply With Quote #5

If you don't need to kickban them you can create a datapack timer with the steamid.
You can also saves all timers in a global array of maxclients size and on disconnect check for != INVALID_HANDLE in which case you could kill the timer, then set it to INVALID_HANDLE and perform the ban / call the timer callback manually.
Dr. Greg House is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 08-06-2013 , 19:19   Re: Best method to saving player data?
Reply With Quote #6

Clientprefs
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 08-06-2013 , 19:45   Re: Best method to saving player data?
Reply With Quote #7

do a CreateDataTimer and pass their userid as well as their steam. When the timer expires, check for the client being in-game, if so you can Kick/Ban, otherwise just manually ban the steam.
__________________
thetwistedpanda is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 08-07-2013 , 01:03   Re: Best method to saving player data?
Reply With Quote #8

Code:
Function(client)
{
    new Handle:packet=CreateDataPack();
    WritePackCell(packet, client);
    CreateTimer(30.0, TimerName, packet, TIMER_FLAG_NO_MAPCHANGE);
}

public Action:TimerName(Handle:timer, any:data)
{
    ResetPack(data);
    new client = ReadPackCell(data);
    CloseHandle(data);
    if (client > 0 && IsClientInGame(client))
    {
        //Ban the Client
    }
    else
    {
        //Ban the client longer due to disconnect?
    }
}
Would something like this work? Doesn't seem to work properly for me.

- Jack
Drixevel is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 08-07-2013 , 01:34   Re: Best method to saving player data?
Reply With Quote #9

Besides the fact that you should indeed use a userid for this, I'm not sure you can pass a handle as the "any"-parameter, furthermore there is a function for datapack-timers which automatically creates a timer handle for you and stores it in a given handle variable, regardless of the fact that you do not need a datapack for passing only 1 value.
Dr. Greg House is offline
ShufflexDD
Senior Member
Join Date: Apr 2011
Location: :noitaɔo˩
Old 08-07-2013 , 03:25   Re: Best method to saving player data?
Reply With Quote #10

if u need to ban them in the same round, use bool arrays(or datapacks), if no, so use sql database.
__________________

⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈
Check this website and find out how many functions
it has working with game server together.
ShufflexDD is offline
Send a message via ICQ to ShufflexDD Send a message via Skype™ to ShufflexDD
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 02:44.


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