Quote:
Originally Posted by xganyx
Yeah I made this
pawn Код:
forward LoadUser_data(playerid,name[],value[]); public LoadUser_data(playerid,name[],value[]) { INI_Int("Password",pInfo[playerid][Pass]); INI_Int("WazzAdmin",pInfo[playerid][WazzAdmLevel]); INI_Int("WazzVip",pInfo[playerid][WazzVIPLevel]); INI_Int("Warn",pInfo[playerid][Warn]); INI_Int("Banned",pInfo[playerid][Banned]); INI_Int("Freeze",pInfo[playerid][Freeze]); INI_Int("Cash",pInfo[playerid][Cash]); INI_Int("Kills",pInfo[playerid][Kills]); INI_Int("Deaths",pInfo[playerid][Deaths]); return 1; }
|
This initializes the items in the player's .ini file under the "data" tag ( "[data]" ) into the player's pInfo variable. That is the function of INI_Int, INI_String, etc.. It takes the item in the player account file and put it into the player's pInfo variable. So all you need to do now is make sure this code is put in OnPlayerConnect:
pawn Код:
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
Next, you can use it after the line such as:
pawn Код:
if ( pInfo[playerid][Banned] == 1 ) return Kick(playerid);
So your full code should be something like this:
pawn Код:
public OnPlayerConnect(playerid)
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid) // Load all the playerid's data into that playerid's pInfo. This line will jump into every "LoadUser_%s" function such as your "LoadUser_data" in my quote above. (%s is the TAG, so "LoadUser_data" means it will load the data under "[data]" tag in that player's file only.)
if ( pInfo[playerid][Banned] == 1 ) return Kick(playerid); // If in his .ini file, the full line of "Banned =" under the "[data]" tag is "Banned = 1", so we kick him.
return 1;
}