Y.ini Problem -
gekas - 29.05.2014
Helloo I add a register system on my Server but death's doesend saved allso and Kill's.
I add Onplayerdeath.
PHP код:
pInfo[killerid][Kills]++;
pInfo[playerid][Deaths]++;
All work perfectly but dont save kills and Death's
PHP код:
public loadaccount_user(playerid, name[], value[])
{
INI_String("Password", pInfo[playerid][Pass],129); /*we will use INI_String to load user's password.
("Password",.. will load user's password inside of user's path. 'pInfo[playerid][Pass]',...We have defined our user's variable above called, pInfo. Now it's time to use it here to load user's password. '129',... 129 is a length of a hashed user's password. Whirlpool will hash 128 characters + NULL*/
INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);/*We will use INI_Int to load user's admin level. INI_Int stands for INI_Integer. This load an admin level. */
INI_Int("VIPLevel",pInfo[playerid][VIPlevel]);//As explained above
INI_Int("Money",pInfo[playerid][Money]); //As explained above
INI_Int("Scores",pInfo[playerid][Scores]);//As explained above
INI_Int("Kills",pInfo[playerid][Kills]);//As explained above
INI_Int("Deaths",pInfo[playerid][Deaths]);//As explained above
return 1;
}
Re: Y.ini Problem -
Dignity - 29.05.2014
loadaccount_user LOADS the files, it doesn't save them. Show me what you use to save them.
Re: Y.ini Problem -
gekas - 29.05.2014
PHP код:
enum PlayerInfo
{
Pass[129], //User's password
Adminlevel, //User's admin level
VIPlevel, //User's vip level
Money, //User's money
Scores, //User's scores
Kills, //User's kills
Deaths //User's deaths
}
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
new INI:file = INI_Open(Path(playerid)); //will open their file
INI_SetTag(file,"Player's Data");//We will set a tag inside of user's account called "Player's Data"
INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]); //If you've set his/her admin level, then his/her admin level will be saved inside of his/her account
INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);//As explained above
INI_WriteInt(file,"Money",GetPlayerMoney(playerid));//We will save his money inside of his account
INI_WriteInt(file,"Scores",GetPlayerScore(playerid));//We will save his score inside of his account
INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);//As explained above
INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);//As explained above
INI_Close(file);//Now after we've done saving their data, we now need to close the file
KillTimer(timer2);
KillTimer(timer1);
return 1;
}
public OnPlayerConnect(playerid)
{
SetPlayerColor(playerid, COLOR_DEAD);
SetPlayerMapIcon(playerid,12,1685.3970,1448.0449,10.7700,5,0); //airport
SetPlayerMapIcon(playerid,11,2207.1448,1674.9552,20.3906,25,0); // caligulas
SetPlayerMapIcon(playerid,10,2013.7827,1007.5895,39.0911,43,0); // four dragons
SetPlayerMapIcon(playerid,9,1661.2365,2241.8606,18.4302,44,0); // redsands
SetPlayerMapIcon(playerid,8,2415.6001,1123.7019,10.8203,30,0); // cityhall
SetPlayerMapIcon(playerid,7,1607.4890,1820.8252,10.8280,22,0); // hospital
SetPlayerMapIcon(playerid,6,2289.5242,2437.1992,46.9775,30,0); // LVPD
TextDrawShowForPlayer(playerid, Textdraw2);
Jailed[playerid] = false;
canarrestagain[playerid] = true;
playerspawned[playerid] = false;
escaped[playerid] = false;
waitrobstore[playerid] = false;
isafk[playerid] = false;
canrobciv[playerid] = true;
canesc[playerid] = true;
canrapeciv[playerid] = true;
canbeair[playerid] = false;
canbehealed[playerid] = false;
canrobdrag[playerid] = false;
canrobsand[playerid] = false;
canrobburger[playerid] = false;
canrobstrip[playerid] = false;
canrobcluck[playerid] = false;
canrobammu[playerid] = false;
canrobbinco[playerid] = false;
canrobpizza[playerid] = false;
canrobburger2[playerid] = false;
SendClientMessage(playerid, 0xFF8000FF, "Welcome to Crazymax Cops and Robbers!!");
SendClientMessage(playerid, 0x0000FFFF, "This is Not a Deathmatch Server, use /pc, /rules and /cmds !!");
new name[MAX_PLAYER_NAME]; //Making a new variable called 'name'. name[MAX_PLAYER_NAME] is created so we can use it to get player's name.
GetPlayerName(playerid,name,sizeof(name)); //Get player's name
if(fexist(Path(playerid))) /* Check if the connected user is registered or not. fexist stands for file exist. So if file exist in the files(Path(playerid)),*/
{// then
INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid); //Will load user's data using INI_Parsefile.
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");/*A dialog with input style will appear so you can insert your password to login.*/
}
return 1;
Re: Y.ini Problem -
Dignity - 29.05.2014
I don't see why it doesn't save it. Did you try this?
pawn Код:
pInfo[killerid][Kills] += 1;
pInfo[playerid][Deaths] += 1;
Re: Y.ini Problem -
gekas - 29.05.2014
Doesent Work
Re: Y.ini Problem -
gekas - 29.05.2014
Help mee please
Re: Y.ini Problem -
Dignity - 29.05.2014
Show me your OnPlayerDeath callback please, and also, how do you test the script? By yourself or with a friend?
Besides, you know the rules well enough, don't bump your thread before 48 hours have passed.
Re: Y.ini Problem -
gekas - 30.05.2014
I test it from myself. Help mee.
PHP код:
public OnPlayerDeath(playerid, killerid, reason)
{
pInfo[killerid][Kills] += 1;
pInfo[playerid][Deaths] += 1;
new string[128], gunname[32], fName[MAX_PLAYER_NAME], sName[MAX_PLAYER_NAME];
if(killerid == INVALID_PLAYER_ID)
{
if(suicide[playerid] == false)
{
if(newlife[playerid] == false)
{
if(rapetodeath[playerid] == false)
{
if ((reason == 255) || (killerid == 255))
{
GetPlayerName(playerid,sName,MAX_PLAYER_NAME);
GetPlayerName(playerid,sName,MAX_PLAYER_NAME);
format(string,sizeof(string),"%s [%i] Has Died.",sName,playerid);
SendClientMessageToAll(0xBB0000FF,string);
GivePlayerMoney(playerid,-10000);
}
}
else
{
rapetodeath[playerid] = false;
}
}
else
{
GetPlayerName(playerid,sName,MAX_PLAYER_NAME);
format(string, sizeof(string), "%s [%i] Has used the command /newlife to pick a new skin.",sName,playerid);
SendClientMessageToAll(COLOR_PINK,string);
newlife[playerid] = false;
}
}
else
{
GetPlayerName(playerid,sName,MAX_PLAYER_NAME);
format(string, sizeof(string), "%s [%i] Has used the command /kill to suicide.",sName,playerid);
SendClientMessageToAll(COLOR_PINK,string);
suicide[playerid] = false;
}
}
else
{
if(gTeam[playerid] == TEAM_CIVILIAN && gTeam[killerid] == TEAM_COPS)
{
if(GetPlayerWantedLevel(playerid) == 0)
{
SetPlayerScore(killerid, GetPlayerScore(killerid)-1);
SendClientMessage(killerid,COLOR_RED,"Dont kill innocent people!!");
SendClientMessage(killerid,COLOR_BLUE,"Dont kill innocent people!!");
GivePlayerMoney(killerid, -10000);
SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
unfair[playerid] = true;
}
if(GetPlayerWantedLevel(playerid) <= 3 && GetPlayerWantedLevel(playerid) >= 1)
{
SendClientMessage(killerid,COLOR_RED,"Don't kill innocent suspects, Ticket them!");
SetPlayerScore(killerid, GetPlayerScore(killerid)-1);
GivePlayerMoney(killerid, -5000);
SendClientMessage(killerid,COLOR_BLUE,"Don't kill innocent suspects, Ticket them!");
}
if(GetPlayerWantedLevel(playerid) >= 4 && GetPlayerWantedLevel(playerid) <= 8)
{
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
GetPlayerName(playerid,sName,18);
GetPlayerName(killerid,fName,18);
format(string, sizeof(string), "Suspect %s [%i] has been taken down by officer %s [%i]",sName,playerid,fName,killerid);
SendClientMessageToAll(0x80FF00FF,string);
SendClientMessage(killerid,0xFFCC00FF,"Good job! you have killed a warrant criminal.");
GivePlayerMoney(killerid, 10000);
gojail1[playerid] = true;
}
if(GetPlayerWantedLevel(playerid) >= 9)
{
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
GetPlayerName(playerid,sName,18);
GetPlayerName(killerid,fName,18);
format(string, sizeof(string), "Most wanted %s [%i] has been taken down by officer %s [%i]",sName,playerid,fName,killerid);
SendClientMessageToAll(0x80FF00FF,string);
SendClientMessage(killerid,0xFFCC00FF,"Excellent job! you have killed a most wanted criminal.");
GivePlayerMoney(killerid, 10000);
gojail2[playerid] = true;
}
}
if(gTeam[playerid] == TEAM_CIVILIAN && gTeam[killerid] == TEAM_CIVILIAN || gTeam[playerid] == TEAM_COPS && gTeam[killerid] == TEAM_CIVILIAN)
{
if(rapetodeath[playerid] == true)
{
}
else
{
GetWeaponName(reason,gunname,sizeof(gunname));
GetPlayerName(playerid,sName, MAX_PLAYER_NAME);
GetPlayerName(killerid,fName,MAX_PLAYER_NAME);
format(string,sizeof(string),"%s [%i] Has Been Killed by %s [%i] with %s.",sName,playerid,fName,killerid,gunname);
SendClientMessageToAll(0xBB0000FF,string);
format(string,sizeof(string),"(MURDER) You Have Killed %s [%i]. The cops will be searching for you.",sName,playerid);
SendClientMessage(killerid, COLOR_ORANGE,string);
SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid)+4);
format(string,sizeof(string),"(MUDRDER) %s [%i] Has Been Murdered by %s [%i] with %s",sName,playerid,fName,killerid,gunname);
CopRadio(COLOR_BLUE, string);
GivePlayerMoney(playerid,-10000);
}
}
if(gTeam[playerid] == TEAM_COPS && gTeam[killerid] == TEAM_COPS)
{
SetPlayerScore(killerid, GetPlayerScore(killerid)-1);
SendClientMessage(killerid,0xFF0000FF,"Don't kill your team mates!!");
SendClientMessage(killerid,COLOR_BLUE,"Don't kill your team mates!!");
GivePlayerMoney(killerid,-10000);
unfair[playerid] = true;
}
}
if(gojail1[playerid] == true && GetPlayerWantedLevel(playerid) == 0)
{
gojail1[playerid] = false;
}
if(gojail2[playerid] == true && GetPlayerWantedLevel(playerid) == 0)
{
gojail2[playerid] = false;
}
playerspawned[playerid] = false;
Jailed[playerid] = false;
isafk[playerid] = false;
canrobdrag[playerid] = false;
canrobsand[playerid] = false;
canrobcalg[playerid] = false;
canrobburger[playerid] = false;
canrobstrip[playerid] = false;
canrobcluck[playerid] = false;
canrobammu[playerid] = false;
canrobbinco[playerid] = false;
canrobpizza[playerid] = false;
canrobburger2[playerid] = false;
KillTimer(timer1);
KillTimer(timer2);
SendDeathMessage(killerid,playerid,reason);
SetPlayerScore(playerid, GetPlayerScore(playerid)-1);
return 1;
}
Re: Y.ini Problem -
Dignity - 30.05.2014
Does anything save at all?
Re: Y.ini Problem -
gekas - 30.05.2014
All work's But he dont add Kills and deaths.
When i login in y.ini have this
PHP код:
[Player's Data]
Password = C91DF73E7704DA5647541716E26AF2C71F0372BDD7EA6651FC4DC96834BCE6F8570BEA8D74E7803512060F2717B7D58B2E0AFBBA65A4F09CA4814BF583298A74
AdminLevel = 0
VIPLevel = 0
Money = 49100
Scores = -6
Kills = 0
Deaths = 0