11.09.2012, 13:53
PHP код:
#include <a_samp>
#include <YSI\y_ini>
#define IGSave "%s.ini"
forward Load(playerid, name[], value[]);
enum pInfo
{
Owner,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
public Load(playerid, name[], value[])
{
INI_Int("Owner", PlayerInfo[playerid][Owner]);
return 1;
}
stock OwnerPath(playerid)
{
new str[128],name[24];
GetPlayerName(playerid,name,24);
format(str,sizeof(str),IGSave,name);
return str;
}
public OnPlayerConnect(playerid)
{
SendClientMessage(playerid,COLOR_LIGHTBLUE,"This server use rumen98's IG Company System check /igchelp");
new uFile[35];
format(uFile, 35, IGSave, OwnerPath(playerid));
INI_ParseFile(uFile,"Load",.bExtra = true, .extra = playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new sFile[35];
format(sFile, 35, IGSave, OwnerPath(playerid));
new INI:OwnerFile = INI_Open(sFile);
INI_WriteInt(OwnerFile, "Owner", PlayerInfo[playerid][Owner]);
INI_Close(OwnerFile);
return 1;}
COMMAND:joinigc(playerid,params[])
{
if(PlayerInfo[playerid][Owner] == 1)
return SendClientMessage(playerid, COLOR_RED, "You already owner of IG Company.");
if(GetPlayerMoney(playerid) <= joinprice) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash!");
PlayerInfo[playerid][Owner] = 1;
GivePlayerMoney(playerid,-joinprice);
SendClientMessage(playerid, 0xFFFFFF, "You are now owner of IG Company!");
return 1;}
first join and buy Owner level 1 and then reconect from Owner = 1 is Owner = 0 why ?