new Member[MAX_PLAYERS];
new Leader[MAX_PLAYERS];
new request[MAX_PLAYERS];
new IsRequesting[MAX_PLAYERS];
new Score[MAX_PLAYERS];
new Jail[MAX_PLAYERS];
enum pInfo
{
Pass,
Money,
Admin,
Level,
Vip,
Spawn,
};
public OnPlayerRegister(playerid, password[])
{
if(IsPlayerConnected(playerid))
{
new file[64];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(file, sizeof(file), "/Users/%s.ini", playername3);
if(dini_Exists(file))
{
return SendClientMessage(playerid,COLOR_GREY,"This account is already registered.");
}
else
{
dini_Create(file);
new password2 = num_hash(password);
PlayerInfo[playerid][Pass] = password2;
dini_IntSet(file, "Password",password2);
dini_IntSet(file, "Member", Member[playerid]);
dini_IntSet(file, "Leader", Leader[playerid]);
dini_IntSet(file, "Status", IsInOrg[playerid]);
dini_IntSet(file, "Request", request[playerid]);
dini_IntSet(file, "IsRequesting", IsRequesting[playerid]);
dini_IntSet(file, "Score", Score[playerid]);
dini_IntSet(file, "Jail", Jail[playerid]);
ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,""ALB"Bun Venit",""ALB"Account succesfully registred!\n"ALB"Type your password here to log-in","Log-in","Quit");
}
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new file[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"/Users/%s.ini",name);
if(dini_Exists(file))
{
dini_IntSet(file, "Member", Member[playerid]);
dini_IntSet(file, "Leader", Leader[playerid]);
dini_IntSet(file, "Status", IsInOrg[playerid]);
dini_IntSet(file, "Request", request[playerid]);
dini_IntSet(file, "IsRequesting", IsRequesting[playerid]);
dini_IntSet(file, "Score", Score[playerid]);
dini_IntSet(file, "Jail", Jail[playerid]);
}
gPlayerLogged[playerid] = 0;
new playername3[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
switch(reason)
{
case 0: format(string, sizeof(string), "%s has left the server. (Lost Connection)", playername3);
case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", playername3);
case 2: format(string, sizeof(string), "%s has left the server. (Kicked)", playername3);
}
SendClientMessageToAll(0x33CCFFAA, string);
return 1;
}
public OnPlayerLogin(playerid,password[])
{
new file[64];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(file, sizeof(file), "/Users/%s.ini", playername3);
if (dini_Exists(file))
{
new password2 = num_hash(password);
if(dini_Int(file,"Password") == password2)
{
Member[playerid] = dini_Int(file, "Member");
Leader[playerid] = dini_Int(file,"Leader");
IsInOrg[playerid] = dini_Int(file,"Status");
IsLaw[playerid] = dini_Int(file,"Law");
request[playerid] = dini_Int(file,"Request");
IsRequesting[playerid] = dini_Int(file,"Isrequesting");
SetPlayerScore(playerid, dini_Int(file,"Score"));
Jail[playerid] = dini_Int(file, "Jail");
}
else
{
gPlayerLogTries[playerid] += 1;
ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,""ALB"Once againg!",""ALB"You have typed a wrong password\n"ALB"Type your password here to log-in!","Log-in","Quit");
if(gPlayerLogTries[playerid] == 3) { Kick(playerid); }
return 1;
}
}
SpawnPlayer(playerid);
return 1;
}
new PlayerData[MAX_PLAYERS][pInfo];
// To Save:
dini_IntSet(file, "Level", PlayerData[playerid][Level]);
pawn Code:
|
new PlayerData[MAX_PLAYERS][pInfo];
pwn(46) : error 017: undefined symbol "pInfo"
pwn(46) : error 009: invalid array size (negative, zero or out of bounds)
pwn(441) : error 028: invalid subscript (not an array or too many subscripts): "Level"
pwn(441) : warning 215: expression has no effect
pwn(441) : error 001: expected token: ";", but found "]"
pwn(441) : error 029: invalid expression, assumed zero
pwn(441) : fatal error 107: too many error messages on one line
new PlayerData[MAX_PLAYERS][pInfo]
Level[playerid] = dini_Int(file, "Level");
enum pInfo
{
Admin
}
new PlayerData[MAX_PLAYERS][pInfo]; // Remember that this variable MUST be below the enum!
dini_IntSet(file, "Admin", PlayerData[playerid][Admin]);
PlayerData[playerid][Admin] = dini_Int(file, "Admin");
public OnPlayerConnect(playerid)
{
PlayerData[playerid][Admin] = 0;
return 1;
}
Well i used level because didn't noticed you had 'Admin'. Also, you are misinterpreting the usage of enums and variables.
Let's start: pawn Code:
pawn Code:
pawn Code:
pawn Code:
|