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

Solved How to store Global Variables for every player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SkinnyBruv
AlliedModders Donor
Join Date: Feb 2013
Location: Straya
Old 01-25-2017 , 22:33   How to store Global Variables for every player
Reply With Quote #1

Howdy guys,

Im creating a few plugins for my server and they are MySQL Based. Its like a group system
So when a player joins the server. Im just wondering if you could obtain say there Name, SteamID, Level and Rank (from MYSQL), and store these in a variable. And only call this once. And then when you want to update them. Just update them.

Otherwise i have to lookup MySQL data everytime they wanna do something like; invite a friend to there Group, Create a group, Check to see whos online in there group





EDITED: Do Variables like
new gRank[255]; // GroupRank

Store a variable for every person that joins the server. Or only one person at a time?
Any workarounds?
__________________
www.ancientgaming.net is my story.
Everything happens for a reason.
Nothing is random...
#Do you even AGN...

Last edited by SkinnyBruv; 01-25-2017 at 22:54. Reason: Adding Information
SkinnyBruv is offline
Send a message via Skype™ to SkinnyBruv
headline
SourceMod Moderator
Join Date: Mar 2015
Old 01-25-2017 , 22:52   Re: How to store Global Variables for every player
Reply With Quote #2

PHP Code:
int ga_iLevel[MAXPLAYERS 1];
int ga_iRank[MAXPLAYERS 1];
char ga_sName[MAXPLAYERS 1][MAX_NAME_LENGTH];
char ga_sPlayerName[MAXPLAYERS 1][MAX_NAME_LENGTH]; 
And just use their client index as the array index.

PHP Code:
public void OnClientConnected(int client)
{
     
ga_iLevel[client] = 0;


Last edited by headline; 01-25-2017 at 22:53.
headline is offline
SkinnyBruv
AlliedModders Donor
Join Date: Feb 2013
Location: Straya
Old 01-25-2017 , 22:54   Re: How to store Global Variables for every player
Reply With Quote #3

Quote:
Originally Posted by Headline View Post
PHP Code:
int ga_iLevel[MAXPLAYERS 1];
int ga_iRank[MAXPLAYERS 1];
char ga_sName[MAXPLAYERS 1][MAX_NAME_LENGTH];
char ga_sPlayerName[MAXPLAYERS 1][MAX_NAME_LENGTH]; 
And just use their client index as the array index.

PHP Code:
public void OnClientConnected(int client)
{
     
ga_iLevel[client] = 0;

Thanks mate, Legend!
__________________
www.ancientgaming.net is my story.
Everything happens for a reason.
Nothing is random...
#Do you even AGN...
SkinnyBruv is offline
Send a message via Skype™ to SkinnyBruv
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 18:47.


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