It doesnt load the cash,to give it
#1

Код:
#define PATH "/Users/%s.ini"

new pCash[MAX_PLAYERS];

forward LoadUser_data(playerid, name[], value[]);
public LoadUser_data(playerid, name[], value[])
{
	INI_Int("Player Money", pCash[playerid]);

	return 1;
}

stock UserPath(playerid)
{
	new string[128],pName[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pName, sizeof(pName));
	format(string,sizeof(string), PATH, pName);
	return string;
}

main()
{
	print("\n----------------------------------");
	print(" Reg system testing");
	print("----------------------------------\n");
	
	
}


public OnPlayerConnect(playerid)
{
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	new INI:File = INI_Open(UserPath(playerid));
	INI_SetTag(File, "data");
	INI_WriteInt(File, "Player Money", GetPlayerMoney(playerid));
	INI_Close(File);
	return 1;
}

public OnPlayerSpawn(playerid)
{
    if(fexist(UserPath(playerid)))
	{
	    SendClientMessage(playerid, 0xFFF0F0FC, "You're already registered.Your money is saved");
	    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra=true, .extra=playerid);
	    GivePlayerMoney(playerid, pCash[playerid]);

	}
	else
	{
	    SendClientMessage(playerid, 0xFFF0F0FC, "You're not registered.");
	}
	return 1;
}
This is the file where the cash is stored:
Код:
[data]
Player Money = 1000
When you come ingame for first time,it sets the money to 0,but i edited it and set it to 1000,to check if it will load it on next come in game,and give it to player.But it doesn't.I does says you're registered when you come second time,but won't give the cash.
Reply


Messages In This Thread
It doesnt load the cash,to give it - by Tagathron - 01.11.2013, 09:46
Re: It doesnt load the cash,to give it - by RowdyrideR - 01.11.2013, 09:56
Re: It doesnt load the cash,to give it - by Tagathron - 01.11.2013, 09:58
Re: It doesnt load the cash,to give it - by DaniceMcHarley - 01.11.2013, 12:32
Re: It doesnt load the cash,to give it - by Wizzy951 - 01.11.2013, 12:58

Forum Jump:


Users browsing this thread: 1 Guest(s)