Weaponsystem don't load
#9

Quote:
Originally Posted by Hashski
Посмотреть сообщение
Save the weapons at GMX.
Saving works but the loading of the weapons doesn't work that is so weird, everything works good.
Now I made this:
Very simpel and everything works accept after /rcon gmx.

What is this problem that it would'nt load @ /rcon gmx.

pawn Код:
public OnPlayerConnect(playerid)
{
    AlreadyGiveWeapons[playerid] = false;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    SaveWeaponsToFile(playerid);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if (!AlreadyGiveWeapons[playerid]) SetTimerEx("LoadWeaponsToFile",250,false,"i",playerid);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    AlreadyGiveWeapons[playerid] = false;
    SaveWeaponsToFile(playerid);
    return 1;
}
SaveWeaponsToFile(playerid)
{
    new i, path[50], weaponid, ammo;
    path = GetPlayerFormattedName(playerid);
    if (!dini_Exists(path)) dini_Create(path);
    for (i=0; i<13; i++)
    {
        GetPlayerWeaponData(playerid,i,weaponid,ammo);
        format(string,sizeof(string),"Weapon - %d",i);
        dini_IntSet(path,string,weaponid);
        format(string,sizeof(string),"AmmoID - %d",i);
        dini_IntSet(path,string,ammo == 65535 ? 0 : ammo);
    }
}

forward LoadWeaponsToFile(playerid);
public LoadWeaponsToFile(playerid)
{
    new i, path[50], weaponid, ammo;
    path = GetPlayerFormattedName(playerid);
    ResetPlayerWeapons(playerid);
    for (i=0; i<13; i++)
    {
        format(string,sizeof(string),"Weapon - %d",i);
        weaponid = dini_Int(path,string);
        format(string,sizeof(string),"AmmoID - %d",i);
        ammo = dini_Int(path,string);
        GivePlayerWeapon(playerid,weaponid,ammo);
    }
    AlreadyGiveWeapons[playerid] = true;
}
#define PATH "Weapons"  //  Folder where players data saved
new bool:AlreadyGiveWeapons[MAX_PLAYERS];
Reply


Messages In This Thread
Weaponsystem don't load - by jorambo - 15.03.2011, 17:27
Re: Weaponsystem don't load - by Jochemd - 15.03.2011, 17:29
Re: Weaponsystem don't load - by jorambo - 15.03.2011, 17:32
Re: Weaponsystem don't load - by Jochemd - 15.03.2011, 17:34
Re: Weaponsystem don't load - by jorambo - 15.03.2011, 17:39
Re: Weaponsystem don't load - by Jochemd - 15.03.2011, 17:41
Re: Weaponsystem don't load - by jorambo - 16.03.2011, 20:58
Re: Weaponsystem don't load - by Hashski - 16.03.2011, 21:01
Re: Weaponsystem don't load - by jorambo - 16.03.2011, 21:22
Re: Weaponsystem don't load - by Hashski - 16.03.2011, 22:16

Forum Jump:


Users browsing this thread: 2 Guest(s)