Posts: 1,767
Threads: 124
Joined: Mar 2010
pawn Code:
INI_WriteInt(Account, "Money", GetPlayerMoney(playerid));
INI_WriteInt(Account, "FightStyle", GetPlayerFightingStyle(playerid));
foreach2(w, MAX_WEAPON_SLOTS)
{
GetPlayerWeaponData(playerid, w, PlayerInfo[playerid][Weapons][w], PlayerInfo[playerid][Ammo][w]);
INI_WriteInt(Account, "Weapon", PlayerInfo[playerid][Weapons][w]);
INI_WriteInt(Account, "Ammo", PlayerInfo[playerid][Ammo][w]);
}
INI_Close(Account);
It's saving but Weapon = 0, Ammo = 0. Should save all weapon slots and ammo.
Posts: 1,767
Threads: 124
Joined: Mar 2010
Works correctly but i was need to change variabli str to:
pawn Code:
new wString[10], aString[10];
Okey.. now how to load?
Code:
Weapon_1 = 1
Ammo_1 = 1
Weapon_0 = 0
Ammo_0 = 0
Weapon_22 = 22
Ammo_34 = 34
Weapon_29 = 29
Ammo_120 = 120
Posts: 1,767
Threads: 124
Joined: Mar 2010
Code:
Weapon_0 = 1
Ammo_0 = 1
Weapon_1 = 0
Ammo_1 = 0
Weapon_2 = 22
Ammo_2 = 34
Weapon_3 = 0
Ammo_3 = 0
Weapon_4 = 0
Ammo_4 = 0
Weapon_5 = 31
Ammo_5 = 120
Weapon_6 = 0
Ammo_6 = 0
Weapon_7 = 0
Ammo_7 = 0
Weapon_8 = 0
Ammo_8 = 0
Weapon_9 = 0
Ammo_9 = 0
Weapon_10 = 0
Ammo_10 = 0
Weapon_11 = 0
Ammo_11 = 0
Weapon_12 = 0
Ammo_12 = 0
Now need to load : )
Posts: 1,767
Threads: 124
Joined: Mar 2010
Quote:
Originally Posted by Zh3r0
I'll let ****** now to help you, I have to go to sleep for now, can't write the code to you, however, i know the right code!
|
: D okey thanks for the help and with everything with that shit. Have a good night : ]
pawn Code:
foreach2(w, MAX_WEAPON_SLOTS)
{
new wString[32], aString[32];
format(wString, sizeof(wString), "Weapon_%d", w);
format(aString, sizeof(aString), "Ammo_%d", w);
GivePlayerWeaponEx(playerid, strval(wString), strval(aString));
}
I was try to do something with load but.. sizeof in GivePlayerWeaponEx? it's not corectly for me too.. but i don't know what to do..
P.S
Lag after player logged. After i putted this foreach.
edit://
Not sizeof but strval you idiot! (i'm talking to me.. damn..)
Posts: 1,767
Threads: 124
Joined: Mar 2010
So.. anybody ready to help : D?
Third page + Bump : )
Posts: 1,767
Threads: 124
Joined: Mar 2010
Zh3r0 was helped me with saving weapons. Now i need to load them. Password loging i all okey now : )
Posts: 1,767
Threads: 124
Joined: Mar 2010
You're talking to me about INI_ParseFile? i was made this yesterday:
pawn Code:
foreach2(w, MAX_WEAPON_SLOTS)
{
new wString[32], aString[32];
format(wString, sizeof(wString), "Weapon_%d", w);
format(aString, sizeof(aString), "Ammo_%d", w);
GivePlayerWeaponEx(playerid, strval(wString), strval(aString));
}
But not working.. what need to do with it?
Posts: 1,767
Threads: 124
Joined: Mar 2010
Posts: 1,767
Threads: 124
Joined: Mar 2010
Not working.. is that good?
pawn Code:
function LoadPlayerStats(playerid, name[], value[])
{
if(!strcmp(name, "Money")) GivePlayerMoneyEx(playerid, strval(value));
if(!strcmp(name, "FightStyle")) SetPlayerFightingStyle(playerid, strval(value));
if(!strcmp(name, "Armour")) SetPlayerArmour(playerid, floatstr(value));
foreach2(w, MAX_WEAPON_SLOTS)
{
new string[32];
format(string, sizeof (string), "Weapon_%d", w);
INI_Int(string, PlayerInfo[playerid][Weapons][w]);
format(string, sizeof (string), "Ammo_%d", w);
INI_Int(string, PlayerInfo[playerid][Ammo][w]);
GivePlayerWeaponEx(playerid, PlayerInfo[playerid][Weapons][w], PlayerInfo[playerid][Ammo][w]);
}
return true;
}
Posts: 1,767
Threads: 124
Joined: Mar 2010
You mean this?
pawn Code:
GivePlayerWeaponEx(playerid, strval(PlayerInfo[playerid][Weapons][w]), strval(PlayerInfo[playerid][Ammo][w]));
Not working. And i was try to load on Spawn.. not working too.
Posts: 1,767
Threads: 124
Joined: Mar 2010
Code:
C:\Documents and Settings\Kakarotto\Pulpit\Sa-Mp Serwer 0.3c\gamemodes\pes.pwn(2159) : error 022: must be lvalue (non-constant)
C:\Documents and Settings\Kakarotto\Pulpit\Sa-Mp Serwer 0.3c\gamemodes\pes.pwn(2162) : error 022: must be lvalue (non-constant)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.
pawn Code:
foreach2(w, MAX_WEAPON_SLOTS)
{
new string[32];
format(string, sizeof(string), "Weapon_%d", w);
INI_Int(string, strval(PlayerInfo[playerid][Weapons][w]));
format(string, sizeof(string), "Ammo_%d", w);
INI_Int(string, strval(PlayerInfo[playerid][Ammo][w]));
GivePlayerWeaponEx(playerid, PlayerInfo[playerid][Weapons][w], PlayerInfo[playerid][Ammo][w]);
}
Posts: 1,767
Threads: 124
Joined: Mar 2010
Are you eating from the trough? xD