Help in my Skill system
#7

hello again guys... i had try the FS but if i join it not give me weapons at spawn, every time i join the server the file of my name on scriptfiles reset... why?

Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <a_samp> // This includes a_samp from pawno/include/
#include <Dini>      // This include is use for saving data's
#include <Dutils>   // This include is used for some important function
#include <Dudb>   //  This include is used for hashing password

#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 savefolder "/skills/%s.ini" // This defines the file name and folder

#pragma unused ret_memcpy // This avoid the ret_memcpy warning

new Killz[MAX_PLAYERS];       // We have used this variable because to save the kills of the player
new Skillz_Weap[MAX_PLAYERS];  // Same on here

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif

public OnPlayerRequestClass(playerid, classid)
{
	return 1;
}

public OnPlayerConnect(playerid)
{
    new pname[128];  // This get's the length of the player name
    new file[128];        // This get's the lenght of the file
    GetPlayerName(playerid, pname, sizeof(pname)); // This get's the player name with the lenght of the player name
    format(file, sizeof(file), savefolder,pname); // This describe's where to save and how to save it
    if(!dini_Exists(file)) { // If the file exist
        dini_Create(file); // Create the file
        dini_IntSet(file, "Kills", Killz[playerid]); // Set's "Kills"
        dini_IntSet(file, "Skill_Weap", Skillz_Weap[playerid]); // Set's "Skill_Weap"
        // and at last this set's the value which were on the file
    }
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new pname[128]; // The name length
    new file[128]; // The file length
    GetPlayerName(playerid, pname, sizeof(pname)); //  This get's the player name with the name length
    format(file, sizeof(file), savefolder,pname); // Formatting file
    if(!dini_Exists(file)) { // If the file exist
    }
    else
	{ // if not
        dini_IntSet(file, "Kills", Killz[playerid]);  // This get the kills
        dini_IntSet(file, "Skill_Weap", Skillz_Weap[playerid]); // This get the Skill_Weap
    }
	return 1;
}

public OnPlayerSpawn(playerid)
{
    if(Killz[playerid]==10)
    {
        Skillz_Weap[playerid] ++;
		// The death value will be increased
        if(Killz[playerid]==20)
        {
             Skillz_Weap[playerid] ++; // The death value will be increased
             if(Killz[playerid]==30)
             {
                   Skillz_Weap[playerid] ++;
				   GivePlayerWeapon(playerid,35,20); // The death value will be increased
			 }
		}
	}
	if(Skillz_Weap[playerid]>=1)
	{
         GivePlayerWeapon(playerid,42,100);
         if(Skillz_Weap[playerid]>=2)
         {
               GivePlayerWeapon(playerid,39,15);
               if(Skillz_Weap[playerid]==3)
               {
                      GivePlayerWeapon(playerid,35,15);
			   }
		 }
	}
	return 1;
}

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

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
	return 1;
}

public OnPlayerUpdate(playerid)
{
	return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}
Reply


Messages In This Thread
Help in my Skill system - by DarK_FeneR - 13.05.2014, 11:57
Re: Help in my Skill system - by ball - 13.05.2014, 12:06
Re: Help in my Skill system - by rumen98 - 13.05.2014, 12:08
Re: Help in my Skill system - by DarK_FeneR - 13.05.2014, 12:09
Re: Help in my Skill system - by Konstantinos - 13.05.2014, 12:14
Re: Help in my Skill system - by DarK_FeneR - 13.05.2014, 12:16
Re: Help in my Skill system - by DarK_FeneR - 13.05.2014, 12:51
Re: Help in my Skill system - by rumen98 - 13.05.2014, 12:53
Re: Help in my Skill system - by Parallex - 13.05.2014, 12:56
Re: Help in my Skill system - by DarK_FeneR - 13.05.2014, 13:06

Forum Jump:


Users browsing this thread: 4 Guest(s)