I need help [xd]
#6

Quote:
Originally Posted by ProjectGANTON
Посмотреть сообщение
Dude, use mysql. Is better for weapons.
Then, here's a Filterscript that save weapons in Dini. (Is a FS, don't add this code in the GM.)
PHP код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT
 
#include <a_samp>
#include <dini>
#include <dudb>
#include <sscanf2>
 
new file[256];
 
 
enum WepData
{
        
Weapon1,
        
Weapon1a,
        
Weapon2,
        
Weapon2a,
        
Weapon3,
        
Weapon3a,
        
Weapon4,
        
Weapon4a,
        
Weapon5,
        
Weapon5a,
        
Weapon6,
        
Weapon6a,
        
Weapon7,
        
Weapon7a,
        
Weapon8,
        
Weapon8a,
        
Weapon9,
        
Weapon9a,
        
Weapon10,
        
Weapon10a,
        
Weapon11,
        
Weapon11a,
        
Weapon12,
        
Weapon12a,
}
 
new 
WeaponInfo[MAX_PLAYERS][WepData];
 
#if defined FILTERSCRIPT
 
public OnFilterScriptInit()
{
        print(
"\n--------------------------------------");
        print(
" Weapon Saver/Loader.");
        print(
"--------------------------------------\n");
        return 
1;
}
 
public 
OnFilterScriptExit()
{
        return 
1;
}
 
#else
 
main()
{
        print(
"\n----------------------------------");
        print(
" Blank Gamemode by your name here");
        print(
"----------------------------------\n");
}
 
#endif
 
 
public OnPlayerConnect(playerid)
{
        new 
name[MAX_PLAYER_NAME];
        
GetPlayerName(playeridnamesizeof(name));
        
format(filesizeof(file), "weapons/%s.ini"name);
    if (!
dini_Exists(file))
    {
                
dini_Create(file);
                
dini_IntSet(file"Weapon1",WeaponInfo[playerid][Weapon1] = 0);
                
dini_IntSet(file"Weapon1a",WeaponInfo[playerid][Weapon1a] = 0);
                
dini_IntSet(file"Weapon2",WeaponInfo[playerid][Weapon2] = 0);
                
dini_IntSet(file"Weapon2a",WeaponInfo[playerid][Weapon2a] = 0);
                
dini_IntSet(file"Weapon3",WeaponInfo[playerid][Weapon3] = 0);
                
dini_IntSet(file"Weapon3a",WeaponInfo[playerid][Weapon3a] = 0);
                
dini_IntSet(file"Weapon4",WeaponInfo[playerid][Weapon4] = 0);
                
dini_IntSet(file"Weapon4a",WeaponInfo[playerid][Weapon4a] = 0);
                
dini_IntSet(file"Weapon5",WeaponInfo[playerid][Weapon5] = 0);
                
dini_IntSet(file"Weapon5a",WeaponInfo[playerid][Weapon5a] = 0);
                
dini_IntSet(file"Weapon6",WeaponInfo[playerid][Weapon6] = 0);
                
dini_IntSet(file"Weapon6a",WeaponInfo[playerid][Weapon6a] = 0);
                
dini_IntSet(file"Weapon7",WeaponInfo[playerid][Weapon7] = 0);
                
dini_IntSet(file"Weapon7a",WeaponInfo[playerid][Weapon7a] = 0);
                
dini_IntSet(file"Weapon8",WeaponInfo[playerid][Weapon8] = 0);
                
dini_IntSet(file"Weapon8a",WeaponInfo[playerid][Weapon8a] = 0);
                
dini_IntSet(file"Weapon9",WeaponInfo[playerid][Weapon9] = 0);
                
dini_IntSet(file"Weapon9a",WeaponInfo[playerid][Weapon9a] = 0);
                
dini_IntSet(file"Weapon10",WeaponInfo[playerid][Weapon10] = 0);
                
dini_IntSet(file"Weapon10a",WeaponInfo[playerid][Weapon10a] = 0);
                
dini_IntSet(file"Weapon11",WeaponInfo[playerid][Weapon11] = 0);
                
dini_IntSet(file"Weapon11a",WeaponInfo[playerid][Weapon11a] = 0);
                
dini_IntSet(file"Weapon12",WeaponInfo[playerid][Weapon12] = 0);
                
dini_IntSet(file"Weapon12a",WeaponInfo[playerid][Weapon12a] = 0);
        }
        else
        {
                
WeaponInfo[playerid][Weapon1] = dini_Int(file"Weapon1");
                
WeaponInfo[playerid][Weapon1a] = dini_Int(file"Weapon1a");
                
WeaponInfo[playerid][Weapon2] = dini_Int(file"Weapon2");
                
WeaponInfo[playerid][Weapon2a] = dini_Int(file"Weapon2a");
                
WeaponInfo[playerid][Weapon3] = dini_Int(file"Weapon3");
                
WeaponInfo[playerid][Weapon3a] = dini_Int(file"Weapon3a");
                
WeaponInfo[playerid][Weapon4] = dini_Int(file"Weapon4");
                
WeaponInfo[playerid][Weapon4a] = dini_Int(file"Weapon4a");
                
WeaponInfo[playerid][Weapon5] = dini_Int(file"Weapon5");
                
WeaponInfo[playerid][Weapon5a] = dini_Int(file"Weapon5a");
                
WeaponInfo[playerid][Weapon6] = dini_Int(file"Weapon6");
                
WeaponInfo[playerid][Weapon6a] = dini_Int(file"Weapon6a");
                
WeaponInfo[playerid][Weapon7] = dini_Int(file"Weapon7");
                
WeaponInfo[playerid][Weapon7a] = dini_Int(file"Weapon7a");
                
WeaponInfo[playerid][Weapon8] = dini_Int(file"Weapon8");
                
WeaponInfo[playerid][Weapon8a] = dini_Int(file"Weapon8a");
                
WeaponInfo[playerid][Weapon9] = dini_Int(file"Weapon9");
                
WeaponInfo[playerid][Weapon9a] = dini_Int(file"Weapon9a");
                
WeaponInfo[playerid][Weapon10] = dini_Int(file"Weapon10");
                
WeaponInfo[playerid][Weapon10a] = dini_Int(file"Weapon10a");
                
WeaponInfo[playerid][Weapon11] = dini_Int(file"Weapon11");
                
WeaponInfo[playerid][Weapon11a] = dini_Int(file"Weapon11a");
                
WeaponInfo[playerid][Weapon12] = dini_Int(file"Weapon12");
                
WeaponInfo[playerid][Weapon12a] = dini_Int(file"Weapon12a");
        }
        return 
1;
}
 
public 
OnPlayerDisconnect(playeridreason)
{
        return 
1;
}
 
public 
OnPlayerSpawn(playerid)
{
        
GivePlayerWeapon(playeridWeaponInfo[playerid][Weapon1], WeaponInfo[playerid][Weapon1a]);
        
GivePlayerWeapon(playeridWeaponInfo[playerid][Weapon2], WeaponInfo[playerid][Weapon2a]);
        
GivePlayerWeapon(playeridWeaponInfo[playerid][Weapon3], WeaponInfo[playerid][Weapon3a]);
        
GivePlayerWeapon(playeridWeaponInfo[playerid][Weapon4], WeaponInfo[playerid][Weapon4a]);
        
GivePlayerWeapon(playeridWeaponInfo[playerid][Weapon5], WeaponInfo[playerid][Weapon5a]);
        
GivePlayerWeapon(playeridWeaponInfo[playerid][Weapon6], WeaponInfo[playerid][Weapon6a]);
        
GivePlayerWeapon(playeridWeaponInfo[playerid][Weapon7], WeaponInfo[playerid][Weapon7a]);
        
GivePlayerWeapon(playeridWeaponInfo[playerid][Weapon8], WeaponInfo[playerid][Weapon8a]);
        
GivePlayerWeapon(playeridWeaponInfo[playerid][Weapon9], WeaponInfo[playerid][Weapon9a]);
        
GivePlayerWeapon(playeridWeaponInfo[playerid][Weapon10], WeaponInfo[playerid][Weapon10a]);
        
GivePlayerWeapon(playeridWeaponInfo[playerid][Weapon11], WeaponInfo[playerid][Weapon11a]);
        
GivePlayerWeapon(playeridWeaponInfo[playerid][Weapon12], WeaponInfo[playerid][Weapon12a]);
        
SetTimerEx("save"2000true"i"playerid);
        return 
1;
}
 
forward save(playerid);
public 
save(playerid)
{
                new 
name[MAX_PLAYER_NAME];
                
GetPlayerName(playeridnamesizeof(name));
                
format(filesizeof(file), "weapons/%s.ini"name);
                
GetPlayerWeaponData(playerid1WeaponInfo[playerid][Weapon1], WeaponInfo[playerid][Weapon1a]);
                
GetPlayerWeaponData(playerid2WeaponInfo[playerid][Weapon2], WeaponInfo[playerid][Weapon2a]);
                
GetPlayerWeaponData(playerid3WeaponInfo[playerid][Weapon3], WeaponInfo[playerid][Weapon3a]);
                
GetPlayerWeaponData(playerid4WeaponInfo[playerid][Weapon4], WeaponInfo[playerid][Weapon4a]);
                
GetPlayerWeaponData(playerid5WeaponInfo[playerid][Weapon5], WeaponInfo[playerid][Weapon5a]);
                
GetPlayerWeaponData(playerid6WeaponInfo[playerid][Weapon6], WeaponInfo[playerid][Weapon6a]);
                
GetPlayerWeaponData(playerid7WeaponInfo[playerid][Weapon7], WeaponInfo[playerid][Weapon7a]);
                
GetPlayerWeaponData(playerid8WeaponInfo[playerid][Weapon8], WeaponInfo[playerid][Weapon8a]);
                
GetPlayerWeaponData(playerid9WeaponInfo[playerid][Weapon9], WeaponInfo[playerid][Weapon9a]);
                
GetPlayerWeaponData(playerid10WeaponInfo[playerid][Weapon10], WeaponInfo[playerid][Weapon10a]);
                
GetPlayerWeaponData(playerid11WeaponInfo[playerid][Weapon11], WeaponInfo[playerid][Weapon11a]);
                
GetPlayerWeaponData(playerid12WeaponInfo[playerid][Weapon12], WeaponInfo[playerid][Weapon12a]);
                
dini_IntSet(file"Weapon1",WeaponInfo[playerid][Weapon1]);
        
dini_IntSet(file"Weapon1a",WeaponInfo[playerid][Weapon1a]);
        
dini_IntSet(file"Weapon2",WeaponInfo[playerid][Weapon2]);
        
dini_IntSet(file"Weapon2a",WeaponInfo[playerid][Weapon2a]);
        
dini_IntSet(file"Weapon3",WeaponInfo[playerid][Weapon3]);
        
dini_IntSet(file"Weapon3a",WeaponInfo[playerid][Weapon3a]);
        
dini_IntSet(file"Weapon4",WeaponInfo[playerid][Weapon4]);
        
dini_IntSet(file"Weapon4a",WeaponInfo[playerid][Weapon4a]);
            
dini_IntSet(file"Weapon5",WeaponInfo[playerid][Weapon5]);
            
dini_IntSet(file"Weapon5a",WeaponInfo[playerid][Weapon5a]);
            
dini_IntSet(file"Weapon6",WeaponInfo[playerid][Weapon6]);
                
dini_IntSet(file"Weapon6a",WeaponInfo[playerid][Weapon6a]);
        
dini_IntSet(file"Weapon7",WeaponInfo[playerid][Weapon7]);
        
dini_IntSet(file"Weapon7a",WeaponInfo[playerid][Weapon7a]);
            
dini_IntSet(file"Weapon8",WeaponInfo[playerid][Weapon8]);
        
dini_IntSet(file"Weapon8a",WeaponInfo[playerid][Weapon8a]);
        
dini_IntSet(file"Weapon9",WeaponInfo[playerid][Weapon9]);
        
dini_IntSet(file"Weapon9a",WeaponInfo[playerid][Weapon9a]);
        
dini_IntSet(file"Weapon10",WeaponInfo[playerid][Weapon10]);
        
dini_IntSet(file"Weapon10a",WeaponInfo[playerid][Weapon10a]);
        
dini_IntSet(file"Weapon11",WeaponInfo[playerid][Weapon11]);
        
dini_IntSet(file"Weapon11a",WeaponInfo[playerid][Weapon11a]);
        
dini_IntSet(file"Weapon12",WeaponInfo[playerid][Weapon12]);
        
dini_IntSet(file"Weapon12a",WeaponInfo[playerid][Weapon12a]);
        return 
1;

Doesn't work...
Reply


Messages In This Thread
I need help [xd] - by Edii - 18.05.2012, 14:25
AW: I need help [xd] - by Dominik. - 18.05.2012, 14:45
Re: AW: I need help [xd] - by Edii - 18.05.2012, 15:00
Re: I need help [xd] - by Edii - 18.05.2012, 16:04
Re: I need help [xd] - by ProjectGANTON - 18.05.2012, 16:34
Re: I need help [xd] - by Edii - 18.05.2012, 17:36

Forum Jump:


Users browsing this thread: 1 Guest(s)