Weapons problem
#10

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
As easy as it sounds:

Код:
SavePlayerWeaponData(playerid) // save the data on disconnect
{
	new 
		weaponid,
		ammo,
		string[10]
	;

	for (new i = 0; i != 13; i++)
	{
		GetPlayerWeaponData(playerid, i, weaponid, ammo);

		if(!weaponid)
			continue;

		format(string, sizeof (string), "Gun%02i", i);
		INI_WriteInt(File, string, weaponid);

		format(string, sizeof (string), "Ammo%02i", i)
	    INI_WriteInt(File, string, ammo);
	}
}

// Load the data on first spawn

	new 
		weaponid,
		ammo,
		string[10]
	;

	for (new i = 0; i != 13; i++)
	{
		format(string, sizeof (string), "Gun%02i", i);
		INI_Int(string, weaponid);
		format(string, sizeof (string), "Ammo%02i", i)
	    INI_Int(string, ammo);

	    GivePlayerWeapon(playerid, weaponid, ammo);
	}
}
So, I created the stock. Added it OnPlayerDisconnect as it follows:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(PlayerInfo[playerid][Registered])
    {
        if(Spawned[playerid])
        {
            SaveUser(playerid);
        }
    }
    new string[128];
    switch(reason)
    {
        case 0: format(string,sizeof string,"%s left the server. (Lost Connection)", RemoveUnderScore(playerid));
        case 1: format(string,sizeof string,"%s left the server.", RemoveUnderScore(playerid));
        case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)", RemoveUnderScore(playerid));
    }
    CloseMessage(playerid, GREY, string);
    SendAdminMessage(GREY, string);
    SavePlayerWeaponData(playerid);
    ResetPlayerWeapons(playerid);
    return 1;
}
It gave me the following errors:
pawn Код:
(1038) : error 017: undefined symbol "File"
(1041) : error 001: expected token: ";", but found "-identifier-"
(1041) : error 017: undefined symbol "File"
The lines 1038, 1041
pawn Код:
format(string, sizeof (string), "Gun%02i", i);
        INI_WriteInt(File, string, weaponid); // 1038

        format(string, sizeof (string), "Ammo%02i", i)
        INI_WriteInt(File, string, ammo); // 1041
Reply


Messages In This Thread
Weapons problem - by benjaminjones - 01.09.2015, 06:14
Re: Weapons problem - by Sanady - 01.09.2015, 06:19
Re: Weapons problem - by benjaminjones - 01.09.2015, 06:32
Re: Weapons problem - by Evocator - 01.09.2015, 07:11
Re: Weapons problem - by benjaminjones - 01.09.2015, 08:11
Re: Weapons problem - by MarvinPWN - 01.09.2015, 08:40
Re: Weapons problem - by benjaminjones - 01.09.2015, 09:28
Re: Weapons problem - by Evocator - 01.09.2015, 09:44
Re: Weapons problem - by MarvinPWN - 01.09.2015, 09:50
Re: Weapons problem - by benjaminjones - 02.09.2015, 05:29

Forum Jump:


Users browsing this thread: 1 Guest(s)