I've a problem to load player scriptfiles of my skill FS when restart my GM help...
#1

Hello,
I write the tird time here for the same problem:
My fs not load the files on scriptfiles of the player skill: (kills, skill points, weapon skill and armour skill)

The fs consist in a "skill system" where if you have got skill points can upgrade your level skills:
-------------------------------------
10 Kills = 1 Skill Point
-------------------------------------
Weapon skill (at spawn server give):
-level 1: fire extinguisher (100 ammo)
-level 2: C4 (15 ammo)
-level 3: bazooka (15 ammo)
-------------------------------------
Armour skill (at spawn server give):
-level 1: 10% armour
-level 2: 20% armour
-level 3: 30% armour
-level 4: 40% armour
-level 5: 50% armour
-level 6: 60% armour
-level 7: 70% armour
-level 8: 80% armour
-level 9: 90% armour
-level 10: 100% armour

Code Filterscript:
Код:
// Weapon skills by DarK_FeneR
#define FILTERSCRIPT

#include <a_samp>
#include <Dini>
#include <Dutils>
#include <Dudb>

#define COLOR_RED   0xFF0000FF
#define COLOR_BLUE   0x0004FFFF
#define COLOR_GREEN   0x00FF55FF
#define COLOR_YELLOW   0xEAFF00FF
#define COLOR_ORANGE   0xFFB300FF
#define COLOR_BLACK   0x000000FF
#define COLOR_WHITE   0xFFFFFFFF

#define DIALOG_SKILLS 15

#define savefolder "skills/%s.ini" //save skills folder

#pragma unused ret_memcpy

new Killz[MAX_PLAYERS]; //kills count
new Skillz_Pt[MAX_PLAYERS]; //skill points
new Skillz_Weap[MAX_PLAYERS]; //Level weapon skill
new Skillz_Armour[MAX_PLAYERS]; //Level armour skill

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print("Weapon Skill FS by DarK_FeneR LOADED");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
    print("\n--------------------------------------");
	print("Weapon Skill FS by DarK_FeneR UNLOADED");
	print("--------------------------------------\n");
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print("Weapon Skill FS by DarK_FeneR");
	print("----------------------------------\n");
}

#endif

public OnPlayerConnect(playerid)
{
    new pname[128];
    new file[128];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(file, sizeof(file), savefolder,pname);
    if(!dini_Exists(file))
	{
        dini_Create(file);
        dini_IntSet(file, "Kills", Killz[playerid]);
        dini_IntSet(file, "Skill_Pt", Skillz_Pt[playerid]);
        dini_IntSet(file, "Skill_Weap", Skillz_Weap[playerid]);
		dini_IntSet(file, "Skill_Armo", Skillz_Armour[playerid]);
    }
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new pname[128];
    new file[128];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(file, sizeof(file), savefolder,pname);
    if(!dini_Exists(file))
	{
    }
    else
	{
        dini_IntSet(file, "Kills", Killz[playerid]);
        dini_IntSet(file, "Skill_Pt", Skillz_Pt[playerid]);
        dini_IntSet(file, "Skill_Weap", Skillz_Weap[playerid]);
        dini_IntSet(file, "Skill_Armo", Skillz_Armour[playerid]);
    }
	return 1;
}

public OnPlayerSpawn(playerid)
{
    if(Killz[playerid]==10)//every 10 kills, give you 1 skill point
    {
        Skillz_Pt[playerid] ++; //give +1 skill point
		Killz[playerid]=0; //reset kills to 0
	}
	if(Skillz_Weap[playerid]>=1) //if you have got level 1 of Weapon Skill
	{
         GivePlayerWeapon(playerid,42,100); //give fire exting with 100 ammo, too
         if(Skillz_Weap[playerid]>=2) //if you have got level 2 of Weapon Skill
         {
               GivePlayerWeapon(playerid,39,15); //give C4 with 15 ammo, too
               if(Skillz_Weap[playerid]==3) //if you have got level 3 of Weapon Skill
               {
                      GivePlayerWeapon(playerid,35,15); //give bazooka with 15 ammo
			   }
		 }
 }
	if(Skillz_Armour[playerid]>=1) //if you have got level 1 of Armour Skill
	{
         SetPlayerArmour(playerid,10); //give 10% armour
	}
	if(Skillz_Armour[playerid]>=2) //if you have got level 1 of Armour Skill
	{
         SetPlayerArmour(playerid,20); //give 20% armour
	}
	if(Skillz_Armour[playerid]>=3) //if you have got level 1 of Armour Skill
	{
         SetPlayerArmour(playerid,30); //give 30% armour
	}
	if(Skillz_Armour[playerid]>=4) //if you have got level 1 of Armour Skill
	{
         SetPlayerArmour(playerid,40); //give 40% armour
	}
	if(Skillz_Armour[playerid]>=5) //if you have got level 1 of Armour Skill
	{
         SetPlayerArmour(playerid,50); //give 50% armour
	}
	if(Skillz_Armour[playerid]>=6) //if you have got level 1 of Armour Skill
	{
         SetPlayerArmour(playerid,60); //give 60% armour
	}
	if(Skillz_Armour[playerid]>=7) //if you have got level 1 of Armour Skill
	{
         SetPlayerArmour(playerid,70); //give 70% armour
	}
	if(Skillz_Armour[playerid]>=8) //if you have got level 1 of Armour Skill
	{
         SetPlayerArmour(playerid,80); //give 80% armour
	}
	if(Skillz_Armour[playerid]>=9) //if you have got level 1 of Armour Skill
	{
         SetPlayerArmour(playerid,90); //give 90% armour
	}
	if(Skillz_Armour[playerid]>=10) //if you have got level 1 of Armour Skill
	{
         SetPlayerArmour(playerid,100); //give 100% armour
	}
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmdtext, "/skills", true) == 0)
    {
        ShowPlayerDialog(playerid,DIALOG_SKILLS,DIALOG_STYLE_LIST,"Skill Menu","Armi\nVita","OK","ANNULLA"); //skills dialog
        return 1;
    }
    if(strcmp(cmdtext, "/skillspt", true) == 0) 
    {
		if(IsPlayerAdmin(playerid))//if you are rcon admin
		{
            Skillz_Pt[playerid] = Skillz_Pt[playerid] + 5; //give you +5 skill points
            SendClientMessage(playerid,COLOR_GREEN,"[SKILL]Hai ricevuto 5 Punti SKill"); //skill point received
        }
        else
        {
            SendClientMessage(playerid,COLOR_GREEN,"[SKILL]Devi essere Rcon Admin per questo comando"); //Message "haven't permission to use this command"
		}
		return 1;
    }
	return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(listitem == 0)
	{
        if(Skillz_Pt[playerid]>=1)//if you have got 1 or more skill points
        {
			 if(Skillz_Weap[playerid]<=2)//if weapon skill are < or = 2
			 {
			      Skillz_Pt[playerid] --; //take 1 skill point
			      Skillz_Weap[playerid] ++; //Weapon skill level increase
                  SendClientMessage(playerid,COLOR_GREEN,"[SKILL]Hai uppato la Skill Armi di 1 livello"); //success upgrade
			 }
			 else
			 {
                  SendClientMessage(playerid,COLOR_GREEN,"[SKILL]Hai gia la Skill al Massimo!"); //Maximum Skill
			 }
		}
		else
		{
             SendClientMessage(playerid,COLOR_RED,"[SKILL]Non hai abbastanza Punti Skill per Uppare!");//Haven't got enough Skill point
		}
	}
    if(listitem == 1)
	{
        if(Skillz_Pt[playerid]>=1)//If they have more or equal to the price.
        {
			 if(Skillz_Armour[playerid]<=9)
			 {
			      Skillz_Pt[playerid] --; //take 1 skill point
			      Skillz_Armour[playerid] ++; //Armour skill level increase
                  SendClientMessage(playerid,COLOR_GREEN,"[SKILL]Hai uppato la Skill Armatura di 1 livello"); //success upgrade
			 }
			 else
			 {
                  SendClientMessage(playerid,COLOR_GREEN,"[SKILL]Hai gia la Skill al Massimo!");//Maximum Skill
			 }
		}
		else
		{
             SendClientMessage(playerid,COLOR_RED,"[SKILL]Non hai abbastanza Punti Skill per Uppare!"); //haven't got Enough Skill point
		}
	}
	return 1;
}


public OnPlayerDeath(playerid, killerid, reason)
{
    Killz[killerid] ++; // The killer value will be increased
	return 1;
}
Reply
#2

You are not even loading the stats u only check if the player is registered if not u create him a new account
pawn Код:
public OnPlayerConnect(playerid)
{
    new pname[128];
    new file[128];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(file, sizeof(file), savefolder,pname);
    if(!dini_Exists(file))
    {
        dini_Create(file);
        dini_IntSet(file, "Kills", Killz[playerid]);
        dini_IntSet(file, "Skill_Pt", Skillz_Pt[playerid]);
        dini_IntSet(file, "Skill_Weap", Skillz_Weap[playerid]);
        dini_IntSet(file, "Skill_Armo", Skillz_Armour[playerid]);
    }
    else
    {
        Killz[playerid] = dini_Int(file, "Kills");
        Skillz_Pt[playerid] = dini_Int(file, "Skill_Pt");
        Skillz_Weap[playerid] = dini_Int(file, "Skill_Weap");
        Skillz_Armour[playerid] = dini_Int(fild, "Skill_Armo");
    }
    return 1;
}
P.S Havent tested it
Reply
#3

Quote:
Originally Posted by JFF
Посмотреть сообщение
You are not even loading the stats u only check if the player is registered if not u create him a new account
pawn Код:
public OnPlayerConnect(playerid)
{
    new pname[128];
    new file[128];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(file, sizeof(file), savefolder,pname);
    if(!dini_Exists(file))
    {
        dini_Create(file);
        dini_IntSet(file, "Kills", Killz[playerid]);
        dini_IntSet(file, "Skill_Pt", Skillz_Pt[playerid]);
        dini_IntSet(file, "Skill_Weap", Skillz_Weap[playerid]);
        dini_IntSet(file, "Skill_Armo", Skillz_Armour[playerid]);
    }
    else
    {
        Killz[playerid] = dini_Int(file, "Kills");
        Skillz_Pt[playerid] = dini_Int(file, "Skill_Pt");
        Skillz_Weap[playerid] = dini_Int(file, "Skill_Weap");
        Skillz_Armour[playerid] = dini_Int(fild, "Skill_Armo");
    }
    return 1;
}
P.S Havent tested it
I've try it, but i have got the same problem
Reply
#4

someone help me please?
Reply
#5

Thanks for help -_-'
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)