05.09.2014, 09:26
(
Последний раз редактировалось jimis; 05.09.2014 в 09:33.
Причина: forget to set pwn
)
hi guys, with a little help i have create the following but it has a problem. when i connect to the game i type /skata1 and then mitsos = 1 , when i disconnect it save tha on the player name's file (i opened the file on scriptfiles and i saw mitsos =1) .But when i connect again and type /sta then its says me that MIT: 0. I checked th player file again to make sure that mitsos = 1 and it was 1. So, the problem is that it does NOT load the player file. Something wrong with parse file??
PHP код:
#include <a_samp>
#include <YSI\y_ini>
#include <zcmd>
#define COLOR_BLUE 0x0000FFAA
native WP_Hash(buffer[], len, const str[]);
enum playerInfo
{
Score,
Money,
Deaths,
Mitsos
}
new
pInfo[MAX_PLAYERS][playerInfo]
;
stock playerPath(playerid)
{
new
string[128],
pName[MAX_PLAYER_NAME]
;
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "Fakelos/%s.ini", pName);
return string;
}
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
forward loadAccount_User(playerid, name[], value[]);
public loadAccount_User(playerid, name[], value[])
{
INI_Int("Score", pInfo[playerid][Score]);
INI_Int("Money", pInfo[playerid][Money]);
INI_Int("Deaths", pInfo[playerid][Deaths]);
INI_Int("Mitsos", pInfo[playerid][Mitsos]);
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
if(fexist(playerPath(playerid)))
{
INI_ParseFile(playerPath(playerid), "loadAccount_%s", .bExtra = true, .extra = playerid);
SendClientMessage(playerid, COLOR_BLUE, "prwto einai");
}
else
{
new
INI:File = INI_Open(playerPath(playerid))
;
INI_SetTag(File, "statistics");
INI_WriteInt(File, "Score", 0);
INI_WriteInt(File, "Money", 0);
INI_WriteInt(File, "Deaths", 0);
INI_WriteInt(File, "Mitsos", 0);
INI_Close(File);
pInfo[playerid][Score] = 0;
pInfo[playerid][Money] = 0;
pInfo[playerid][Deaths] = 0;
pInfo[playerid][Mitsos] = 0;
SendClientMessage(playerid, COLOR_BLUE, "else mpike");
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new
INI:File = INI_Open(playerPath(playerid))
;
INI_SetTag(File, "statistics");
INI_WriteInt(File, "Score", GetPlayerScore(playerid));
INI_WriteInt(File, "Money", GetPlayerMoney(playerid));
INI_WriteInt(File, "Deaths", pInfo[playerid][Deaths]);
INI_WriteInt(File, "Mitsos", pInfo[playerid][Mitsos]);
INI_Close(File);
return 1;
}
CMD:sta(playerid, params[])
{
new
string[128]
;
format(string, sizeof(string), "Your stats are: MIT: %d", pInfo[playerid][Mitsos]);
SendClientMessage(playerid, -1, string);
return 1;
}
CMD:skata1(playerid, params[])
{
pInfo[playerid][Mitsos] = 1;
return 1;
}
CMD:naf(playerid, params[])
{
pInfo[playerid][Mitsos] = 0;
return 1;
}