//Player info enum
enum pInfo
{
pPass,
pCash,
pAdmin,
pSex,
pAge,
Float:pPos_x,
Float:pPos_y,
Float:pPos_z,
pSkin,
pTeam,
pAccent,
pTutorial,
pJob,
pDlvpkg,
pKills,
pDeaths,
pDead,
pCop,
pLeader,
pPolitician,
pGunPermit,
pBank,
pBanned,
pLevel,
pHours,
pScrapMetal,
pWtest,
pDtest,
pCar,
Float:pCarPos_x,
Float:pCarPos_y,
Float:pCarPos_z,
Float:pCarPos_a,
pCarID,
pRadioFreq,
pRadio,
pJailtime,
pJailed,
pLawLicense,
pAseCertified
}
function SaveAccountStats(playerid)
{
if(Logged[playerid] == 1)
{
new
INI:File = INI_Open(UserPath(playerid))
;
INI_SetTag(File,"data");
PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
PlayerInfo[playerid][pLevel] = GetPlayerScore(playerid);
new
Float:x,
Float:y,
Float:z
;
GetPlayerPos(playerid,x,y,z);
PlayerInfo[playerid][pPos_x] = x;
PlayerInfo[playerid][pPos_y] = y;
PlayerInfo[playerid][pPos_z] = z;
INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Sex",PlayerInfo[playerid][pSex]);
INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
INI_WriteFloat(File,"Pos_x",PlayerInfo[playerid][pPos_x]);
INI_WriteFloat(File,"Pos_y",PlayerInfo[playerid][pPos_y]);
INI_WriteFloat(File,"Pos_z",PlayerInfo[playerid][pPos_z]);
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
INI_WriteInt(File,"Team",PlayerInfo[playerid][pTeam]);
INI_WriteInt(File,"Accent",PlayerInfo[playerid][pAccent]);
INI_WriteInt(File,"Tutorial",PlayerInfo[playerid][pTutorial]);
INI_WriteInt(File, "Job",PlayerInfo[playerid][pJob]);
INI_WriteInt(File, "Dlvpkg",PlayerInfo[playerid][pDlvpkg]);
INI_WriteInt(File, "Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File, "Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File, "Dead",PlayerInfo[playerid][pDead]);
INI_WriteInt(File, "Cop",PlayerInfo[playerid][pCop]);
INI_WriteInt(File, "Leader",PlayerInfo[playerid][pLeader]);
INI_WriteInt(File,"Politician",PlayerInfo[playerid][pPolitician]);
INI_WriteInt(File,"GunPermit",PlayerInfo[playerid][pGunPermit]);
INI_WriteInt(File,"Bank",PlayerInfo[playerid][pBank]);
INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
INI_WriteInt(File,"Hours",PlayerInfo[playerid][pHours]);
INI_WriteInt(File,"ScrapMetal", PlayerInfo[playerid][pScrapMetal]);
INI_WriteInt(File,"Wtest", PlayerInfo[playerid][pWtest]);
INI_WriteInt(File,"Dtest",PlayerInfo[playerid][pDtest]);
INI_WriteInt(File,"Car", PlayerInfo[playerid][pCar]);
INI_WriteFloat(File,"CarPos_x", PlayerInfo[playerid][pCarPos_x]);
INI_WriteFloat(File,"CarPos_y", PlayerInfo[playerid][pCarPos_y]);
INI_WriteFloat(File,"CarPos_z", PlayerInfo[playerid][pCarPos_z]);
INI_WriteFloat(File,"CarPos_a", PlayerInfo[playerid][pCarPos_a]);
INI_WriteInt(File,"CarID", PlayerInfo[playerid][pCarID]);
INI_WriteInt(File,"RadioFreq", PlayerInfo[playerid][pRadioFreq]);
INI_WriteInt(File,"Radio",PlayerInfo[playerid][pRadio]);
INI_WriteInt(File,"Jailtime",PlayerInfo[playerid][pJailtime]);
INI_WriteInt(File,"Jailed",PlayerInfo[playerid][pJailed]);
INI_WriteInt(File,"LawLicense",PlayerInfo[playerid][pLawLicense]);
INI_WriteInt(File,"AseCertified",PlayerInfo[playerid][pAseCertified]);
INI_Close(File);
}
return 1;
}
// next is my login code
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
new
tmp2[ 256 ],
playername2[ MAX_PLAYER_NAME ]
;
GetPlayerName(playerid, playername2, sizeof(playername2));
format(tmp2, sizeof(tmp2), "~w~Welcome ~n~~g~%s", playername2);
GameTextForPlayer(playerid, tmp2, 5000, 1);
GivePlayerCash(playerid, PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
Logged[playerid] ++;
new
Float: X,
Float: Y,
Float: Z
;
X = PlayerInfo[playerid][pPos_x];
Y = PlayerInfo[playerid][pPos_y];
Z = PlayerInfo[playerid][pPos_z];
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], X, Y, Z, 120, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
PlayerInfo[playerid][pCarID] = CreateVehicle(PlayerInfo[playerid][pCar], PlayerInfo[playerid][pCarPos_x], PlayerInfo[playerid][pCarPos_y], PlayerInfo[playerid][pCarPos_z], PlayerInfo[playerid][pCarPos_a], 0, 0, 9999);
SetTimerEx("message", 20000, true, "d" , playerid );
if(PlayerInfo[playerid][pJailtime] >= 2)
{
SetPlayerPos(playerid, 223.4806, 110.8119, 999.0156);
SetPlayerInterior(playerid, 10);
SetTimer("JailTime", 60000, true);
}
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
}
return 1;
}
}
// load user data
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Sex",PlayerInfo[playerid][pSex]);
INI_Int("Age",PlayerInfo[playerid][pAge]);
INI_Float("Pos_x",PlayerInfo[playerid][pPos_x]);
INI_Float("Pos_y",PlayerInfo[playerid][pPos_y]);
INI_Float("Pos_z",PlayerInfo[playerid][pPos_z]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Team",PlayerInfo[playerid][pTeam]);
INI_Int("Accent",PlayerInfo[playerid][pAccent]);
INI_Int("Tutorial",PlayerInfo[playerid][pTutorial]);
INI_Int("Job", PlayerInfo[playerid][pJob]);
INI_Int("Dlvpkg", PlayerInfo[playerid][pDlvpkg]);
INI_Int("Kills", PlayerInfo[playerid][pKills]);
INI_Int("Deaths", PlayerInfo[playerid][pDeaths]);
INI_Int("Dead",PlayerInfo[playerid][pDead]);
INI_Int("Cop",PlayerInfo[playerid][pCop]);
INI_Int("Leader",PlayerInfo[playerid][pLeader]);
INI_Int("Politician",PlayerInfo[playerid][pPolitician]);
INI_Int("GunPermit", PlayerInfo[playerid][pGunPermit]);
INI_Int("Bank", PlayerInfo[playerid][pBank]);
INI_Int("Banned", PlayerInfo[playerid][pBanned]);
INI_Int("Level",PlayerInfo[playerid][pLevel]);
INI_Int("Hours",PlayerInfo[playerid][pHours]);
INI_Int("ScrapMetal",PlayerInfo[playerid][pScrapMetal]);
INI_Int("Wtest", PlayerInfo[playerid][pWtest]);
INI_Int("Dtest", PlayerInfo[playerid][pDtest]);
INI_Int("Car", PlayerInfo[playerid][pCar]);
INI_Float("CarPos_x", PlayerInfo[playerid][pCarPos_x]);
INI_Float("CarPos_y", PlayerInfo[playerid][pCarPos_y]);
INI_Float("CarPos_z", PlayerInfo[playerid][pCarPos_z]);
INI_Float("CarPos_a", PlayerInfo[playerid][pCarPos_a]);
INI_Int("CarID", PlayerInfo[playerid][pCarID]);
INI_Int("RadioFreq",PlayerInfo[playerid][pRadioFreq]);
INI_Int("Radio",PlayerInfo[playerid][pRadio]);
INI_Int("Jailtime",PlayerInfo[playerid][pJailtime]);
INI_Int("Jailed",PlayerInfo[playerid][pJailed]);
INI_Int("LawLicense",PlayerInfo[playerid][pLawLicense]);
INI_Int("AseCertified",PlayerInfo[playerid][pAseCertified]);
return 1;
}
// my register code
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering...","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Sex",0);
INI_WriteInt(File,"Age",0);
INI_WriteFloat(File,"Pos_x",0);
INI_WriteFloat(File,"Pos_y",0);
INI_WriteFloat(File,"Pos_z",0);
INI_WriteInt(File,"Skin",0);
INI_WriteInt(File,"Team",0);
INI_WriteInt(File,"Accent",0);
INI_WriteInt(File,"Tutorial",0);
INI_WriteInt(File, "Job", 0);
INI_WriteInt(File, "Dlvpkg", 0);
INI_WriteInt(File, "Kills", 0);
INI_WriteInt(File, "Deaths", 0);
INI_WriteInt(File, "Dead", 0);
INI_WriteInt(File, "Cop", 0);
INI_WriteInt(File, "Leader", 0);
INI_WriteInt(File, "Politician",0);
INI_WriteInt(File, "GunPermit",0);
INI_WriteInt(File, "Bank",2500);
INI_WriteInt(File, "Banned",0);
INI_WriteInt(File, "Level",1);
INI_WriteInt(File, "Hours",0);
INI_WriteInt(File, "ScrapMetal",0);
INI_WriteInt(File, "Wtest",0);
INI_WriteInt(File, "Dtest", 0);
INI_WriteInt(File, "Car", 0);
INI_WriteFloat(File, "CarPos_x", 0);
INI_WriteFloat(File, "CarPos_y", 0);
INI_WriteFloat(File, "CarPos_z", 0);
INI_WriteFloat(File, "CarPos_a", 0);
INI_WriteInt(File, "CarID", 0);
INI_WriteInt(File, "RadioFreq", 0);
INI_WriteInt(File, "Radio", 0);
INI_WriteInt(File, "Jailtime", 0);
INI_WriteInt(File, "Jailed", 0);
INI_WriteInt(File, "LawLicense", 0);
INI_WriteInt(File, "AseCertified", 0);
INI_Close(File);
SetPlayerScore(playerid, 1);
SetPlayerColor(playerid, 0xFFFFFFFF);
ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_MSGBOX, "- Sex -","What gender are you?","Male","Female");
}
}
if(fexsist == 0)
if(fexsist == 0)
I assume you use something similar to
pawn Код:
pawn Код:
|
public OnPlayerConnect(playerid)
{
gOoc[ playerid ] = 0; Logged[ playerid ] = 0;
// Reset stats!
PlayerInfo[ playerid ][ pCash ] = 0;
PlayerInfo[ playerid ][ pAdmin ] = 0;
PlayerInfo[ playerid ][ pSex ] = 0;
PlayerInfo[ playerid ][ pAge ] = 0;
PlayerInfo[ playerid ][ pPos_x ] = 0.0;
PlayerInfo[ playerid ][ pPos_y ] = 0.0;
PlayerInfo[ playerid ][ pPos_z ] = 0.0;
PlayerInfo[ playerid ][ pSkin ] = 0;
PlayerInfo[ playerid ][ pTeam ] = 0;
PlayerInfo[ playerid ][ pAccent ] = 0;
PlayerInfo[ playerid ][ pTutorial ] =0;
PlayerInfo[ playerid ][ pJob ] =0;
PlayerInfo[ playerid ][ pDlvpkg ] =0;
PlayerInfo[ playerid ][ pKills ] =0;
PlayerInfo[ playerid ][ pDeaths ] =0;
PlayerInfo[ playerid ][ pDead ] =0;
PlayerInfo[ playerid ][ pCop ] =0;
PlayerInfo[ playerid ][ pLeader ] =0;
PlayerInfo[ playerid ][ pPolitician ] =0;
PlayerInfo[ playerid ][ pGunPermit ] =0;
PlayerInfo[ playerid ][ pBank ] = 0;
PlayerInfo[ playerid ][ pHours ] =0;
PlayerInfo[ playerid ][ pLevel ] =0;
PlayerInfo[ playerid ][ pScrapMetal ] =0;
PlayerInfo[ playerid ][ pCar ] =0;
PlayerInfo[ playerid ][ pCarPos_x ] = 0.0;
PlayerInfo[ playerid ][ pCarPos_y ] = 0.0;
PlayerInfo[ playerid ][ pCarPos_z ] = 0.0;
PlayerInfo[ playerid ][ pCarPos_a ] = 0.0;
PlayerInfo[playerid][pCarID] = -1;
PlayerInfo[playerid][pRadioFreq] = -1;
PlayerInfo[playerid][pRadio] = 0;
pTazer[playerid] = 0;
pTazed[playerid] = 0;
pCuffed[playerid] = 0;
RemoveBuildingForPlayer(playerid, 1885, 310.1250, -166.2109, 998.5547, 0.25);
RemoveBuildingForPlayer(playerid, 1885, 315.2422, -169.8984, 998.5547, 0.25);
RemoveBuildingForPlayer(playerid, 18105, 312.9844, -163.2500, 1000.5547, 0.25);
RemoveBuildingForPlayer(playerid, 1886, 318.8047, -158.9297, 1003.2266, 0.25);
if(fexist(UserPath(playerid)))
{
if(PlayerInfo[playerid][pBanned] > 0)
{
SendClientMessage(playerid, COLOR_BAN, " You are banned from this server you can appeal this by visiting changeme ");
BanEx(playerid, "trying to log into a banned account");
}
else
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Basic Roleplay","Type your password below to login:","Login","Quit");
}
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Basic Roleplay","Type your password below to register a new account:","Register","Quit");
}
return 1;
}