Weapons not loading when relog
#1

pawn Code:
forward LoadWeap_data(playerid,name[],value[]);
public LoadWeap_data(playerid,name[],value[])
{
    INI_Int( "weaponSlot0", weapons[playerid][0][0]);
    INI_Int( "weaponSlot0Ammo", weapons[playerid][0][1]);
    INI_Int( "weaponSlot1", weapons[playerid][1][0]);
    INI_Int( "weaponSlot1Ammo", weapons[playerid][1][1]);
    INI_Int( "weaponSlot2", weapons[playerid][2][0]);
    INI_Int( "weaponSlot2Ammo", weapons[playerid][2][1]);
    INI_Int( "weaponSlot3", weapons[playerid][3][0]);
    INI_Int( "weaponSlot3Ammo", weapons[playerid][3][1]);
    INI_Int( "weaponSlot4", weapons[playerid][4][0]);
    INI_Int( "weaponSlot4Ammo", weapons[playerid][4][1]);
    INI_Int( "weaponSlot5", weapons[playerid][5][0]);
    INI_Int( "weaponSlot5Ammo", weapons[playerid][5][1]);
    INI_Int( "weaponSlot6", weapons[playerid][6][0]);
    INI_Int( "weaponSlot6Ammo", weapons[playerid][6][1]);
    INI_Int( "weaponSlot7", weapons[playerid][7][0]);
    INI_Int( "weaponSlot7Ammo", weapons[playerid][7][1]);
    INI_Int( "weaponSlot8", weapons[playerid][8][0]);
    INI_Int( "weaponSlot8Ammo", weapons[playerid][8][1]);
    INI_Int( "weaponSlot9", weapons[playerid][9][0]);
    INI_Int( "weaponSlot8Ammo", weapons[playerid][9][1]);
    INI_Int( "weaponSlot10", weapons[playerid][10][0]);
    INI_Int( "weaponSlot10Ammo", weapons[playerid][10][1]);
    INI_Int( "weaponSlot11", weapons[playerid][11][0]);
    INI_Int( "weaponSlot11Ammo", weapons[playerid][11][1]);
    INI_Int( "weaponSlot12", weapons[playerid][12][0]);
    INI_Int( "weaponSlot12Ammo", weapons[playerid][12][1]);
    return 1;
}
pawn Code:
forward SaveWeap(playerid);
public SaveWeap(playerid)
{
    new INI:File = INI_Open(wPath(playerid));
    for (new i = 0; i < 13; i++) GetPlayerWeaponData(playerid, i, weapons[playerid][i][0], weapons[playerid][i][1]);
    INI_SetTag(File,"Weapon Data");
    INI_WriteInt(File, "weaponSlot0", weapons[playerid][0][0]);
    INI_WriteInt(File, "weaponSlot0Ammo", weapons[playerid][0][1]);
    INI_WriteInt(File, "weaponSlot1", weapons[playerid][1][0]);
    INI_WriteInt(File, "weaponSlot1Ammo", weapons[playerid][1][1]);
    INI_WriteInt(File, "weaponSlot2", weapons[playerid][2][0]);
    INI_WriteInt(File, "weaponSlot2Ammo", weapons[playerid][2][1]);
    INI_WriteInt(File, "weaponSlot3", weapons[playerid][3][0]);
    INI_WriteInt(File, "weaponSlot3Ammo", weapons[playerid][3][1]);
    INI_WriteInt(File, "weaponSlot4", weapons[playerid][4][0]);
    INI_WriteInt(File, "weaponSlot4Ammo", weapons[playerid][4][1]);
    INI_WriteInt(File, "weaponSlot5", weapons[playerid][5][0]);
    INI_WriteInt(File, "weaponSlot5Ammo", weapons[playerid][5][1]);
    INI_WriteInt(File, "weaponSlot6", weapons[playerid][6][0]);
    INI_WriteInt(File, "weaponSlot6Ammo", weapons[playerid][6][1]);
    INI_WriteInt(File, "weaponSlot7", weapons[playerid][7][0]);
    INI_WriteInt(File, "weaponSlot7Ammo", weapons[playerid][7][1]);
    INI_WriteInt(File, "weaponSlot8", weapons[playerid][8][0]);
    INI_WriteInt(File, "weaponSlot8Ammo", weapons[playerid][8][1]);
    INI_WriteInt(File, "weaponSlot9", weapons[playerid][9][0]);
    INI_WriteInt(File, "weaponSlot8Ammo", weapons[playerid][9][1]);
    INI_WriteInt(File, "weaponSlot10", weapons[playerid][10][0]);
    INI_WriteInt(File, "weaponSlot10Ammo", weapons[playerid][10][1]);
    INI_WriteInt(File, "weaponSlot11", weapons[playerid][11][0]);
    INI_WriteInt(File, "weaponSlot11Ammo", weapons[playerid][11][1]);
    INI_WriteInt(File, "weaponSlot12", weapons[playerid][12][0]);
    INI_WriteInt(File, "weaponSlot12Ammo", weapons[playerid][12][1]);
    INI_Close(File);
}
pawn Code:
public OnPlayerSpawn(playerid)
{
    INI_ParseFile(wPath(playerid),"LoadWeap_%s", .bExtra = true, .extra = playerid);
    for (new i = 0; i < 13; i++)
    {
        GetPlayerWeaponData(playerid, i, weapons[playerid][i][0], weapons[playerid][i][1]);
        GivePlayerWeapon(playerid, weapons[playerid][i][0], weapons[playerid][i][1]);
    }
    return 1;
}
pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
    SavePlayer(playerid);
    SaveWeap(playerid);
    return 1;
}

The weapons are not loading when you do /q and join back. But it loads when you /kill or die. Any help?
Reply
#2

Change This thing "LoadWeap_data" to "LoadWeap" then try.
Reply
#3

Quote:
Originally Posted by Inn0cent
View Post
Change This thing "LoadWeap_data" to "LoadWeap" then try.
It doesn't work.
Reply
#4

Maybe, you did not opened the weapons file
Reply
#5

do u have the wepons file .ini
Reply
#6

Yes he have
Reply
#7

You have to add "GivePlayerWeapon" after loading it.
Reply
#8

Quote:
Originally Posted by Inn0cent
View Post
Maybe, you did not opened the weapons file
Thanks for helping via Skype, + Rep'd.
Reply
#9

Quote:
Originally Posted by Affan
View Post
Thanks for helping via Skype, + Rep'd.
No Problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)