Detaljan opis problema:znaÄi namjestio sam da kad se igraÄ registrira dobije 3 oružja,no na spawnu ih nedobije i kad izaÄ‘e iz servera u user fileu se samo nadupisuje o.O
Dio skripte:
enum pInfo
{
pPassword,
pKills,
pDeaths,
pAdmin,
pMoney,
pScore,
pOnline,
pMember,
pLeader,
pWep1,
pWep2,
pWep3
}
forward LoadUserData(playerid, name[], value[]);
public LoadUserData(playerid, name[], value[])
{
INI_String("Password", PlayerInfo, 129);
INI_Int("Admin", PlayerInfo);
INI_Int("Money", PlayerInfo);
INI_Int("Score", PlayerInfo);
INI_Int("Kills", PlayerInfo);
INI_Int("Deaths", PlayerInfo);
INI_Int("Online", PlayerInfo);
INI_Int("Weapon 1", PlayerInfo);
INI_Int("Weapon 2", PlayerInfo);
INI_Int("Weapon 3", PlayerInfo);
return 1;
}
OnPlayerRegister(playerid, password[])
{
new
hashPassword,
uFile;
format(uFile, 35, USER_FILE, GetName(playerid));
new
INI:playerFile = INI_Open(uFile);
WP_Hash(hashPassword, 129, password);
INI_WriteString(playerFile, "Password", hashPassword);
INI_WriteInt(playerFile, "Admin", 0);
INI_WriteInt(playerFile, "Money", 200);
INI_WriteInt(playerFile, "Score", 0);
INI_WriteInt(playerFile, "Kills", 0);
INI_WriteInt(playerFile, "Deaths", 0);
INI_WriteInt(playerFile, "Online", 0);
INI_WriteInt(playerFile, "Weapon 1", 24);
INI_WriteInt(playerFile, "Weapon 2", 29);
INI_WriteInt(playerFile, "Weapon 3", 34);
INI_Close(playerFile);
SetPVarInt(playerid, "Registered", 1);
SetPVarInt(playerid, "Logged", 1);
return 1;
}
OnPlayerLogin(playerid, password[])
{
new
hashPassword,
uFile;
format(uFile, 35, USER_FILE, GetName(playerid));
INI_ParseFile(uFile, "LoadUserData", .bExtra = true, .extra = playerid);
WP_Hash(hashPassword, 129, password);
if(strcmp(PlayerInfo, hashPassword, false))
{
{
SetPVarInt(playerid, "Logged", 1);
}
}
return 1;
}
OnPlayerLogout(playerid)
{
new
uFile;
format(uFile, 35, USER_FILE, GetName(playerid));
new
INI:playerFile = INI_Open(uFile);
INI_WriteInt(playerFile, "Admin", PlayerInfo);
INI_WriteInt(playerFile, "Money", GetPlayerMoney(playerid));
INI_WriteInt(playerFile, "Score", GetPlayerScore(playerid));
INI_WriteInt(playerFile, "Kills", PlayerInfo);
INI_WriteInt(playerFile, "Deaths", PlayerInfo);
INI_WriteInt(playerFile, "Online", PlayerInfo);
INI_WriteInt(playerFile, "Weapon 1", PlayerInfo);
INI_WriteInt(playerFile, "Weapon 2", PlayerInfo);
INI_WriteInt(playerFile, "Weapon 3", PlayerInfo);
INI_Close(playerFile);
return 1;
}
public OnPlayerSpawn(playerid)
{
new wep1 = PlayerInfo;
new wep2 = PlayerInfo;
new wep3 = PlayerInfo;
GivePlayerWeapon(playerid, wep1, 5000);
GivePlayerWeapon(playerid, wep2, 5000);
GivePlayerWeapon(playerid, wep3, 5000);
return 1;
}Neke slike/video za lakse dobivanje pomoci(neobavezno): http://prntscr.com/ahv1n