All pastes #954071 Raw Edit

killer

public text v1 · immutable
#954071 ·published 2008-03-23 17:10 UTC
rendered paste body
//KILLER SOURCE EDITED BY NEWANGELUS

//LIBRERIE
#include <a_samp>
#include "dini"
#include "dudb"
#include "dutils"
#include "dutils2"


#define COLOR_SYSTEM 0xF5FF9FAA
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1


//Save
new PLAYERLIST_authed[MAX_PLAYERS];

//SCORE
new killer[2][MAX_PLAYERS];

//TIME
new gRoundTime = 1200000;					// Round time - 20 mins
//new gRoundTime = 900000;					// Round time - 15 mins
//new gRoundTime = 600000;					// Round time - 10 mins
//new gRoundTime = 300000;					// Round time - 5 mins
//new gRoundTime = 120000;					// Round time - 2 mins
//new gRoundTime = 60000;					// Round time - 1 min

//INFO POSPLAYER
enum PlayerSpawnInfo {
	Float:PlayerX,
	Float:PlayerY,
	Float:PlayerZ,
	Float:PlayerAngle
}
//RANDOM SPAWN
new Float:gRandomSpawns[][PlayerSpawnInfo] =
{
	{2544.5032,	2805.8840,	19.9922,	257.5800},
	{2556.2554,	2832.5313,	19.9922,	1.9000},
	{2561.9175,	2848.5532,	19.9922,	256.6609},
	{2613.9866,	2848.4475,	19.9922,	102.2487},
	{2611.5500,	2845.7542,	16.7020,	87.5428},
	{2545.9243,	2839.1824,	10.8203,	176.2378},
	{2647.6553,	2805.0278,	10.8203,	285.1536},
	{2672.9387,	2800.3374,	10.8203,	60.4288},
	{2672.8306,	2792.1057,	10.8203,	121.8451},
	{2647.7834,	2697.5884,	19.3222,	353.1684},
	{2654.5427,	2720.3474,	19.3222,	303.5359},
	{2653.2063,	2738.2432,	19.3222,	342.1389},
	{2641.1350,	2703.2019,	25.8222,	191.6982},
	{2599.1304,	2700.7249,	25.8222,	76.3487},
	{2606.1384,	2721.5237,	25.8222,	261.2564},
	{2597.3745,	2748.0884,	23.8222,	273.2050},
	{2595.0657,	2776.6729,	23.8222,	254.3630},
	{2601.3640,	2777.8101,	23.8222,	253.4439},
	{2584.3940,	2825.1748,	27.8203,	244.5475},
	{2631.8110,	2834.2593,	40.3281,	213.2975},
	{2632.2852,	2834.9390,	122.9219,	197.6725},
	{2646.1997,	2817.7070,	36.3222,	182.0474},
	{2685.8875,	2816.6575,	36.3222,	129.9525},
	{2691.1233,	2787.7883,	59.0212,	208.0777},
	{2717.8071,	2771.3464,	74.8281,	72.3429},
	{2695.2622,	2699.5488,	22.9472,	66.3686},
	{2688.8206,	2689.0039,	28.1563,	14.8979},
	{2655.0229,	2650.6807,	36.9154,	341.8097},
	{2570.4668,	2701.2876,	22.9507,	204.0154},
	{2498.9915,	2704.6204,	10.9844,	168.9241},
	{2524.1584,	2743.3735,	10.9917,	150.3771},
	{2498.3167,	2782.3357,	10.8203,	251.7015},
	{2504.5142,	2805.9763,	14.8222,	108.6137},
	{2522.2144,	2814.7087,	24.9536,	265.9478},
	{2510.6292,	2849.6384,	14.8222,	191.4991},
	{2618.2646,	2720.8005,	36.5386,	346.6828},
	{2690.9980,	2741.9060,	19.0722,	91.6099}
};
//INFO POS PICKUP
enum PickupSpawnInfo {
	Float:PickupX,
	Float:PickupY,
	Float:PickupZ
}


new Float:gSniperPickups[][PickupSpawnInfo] =
{
	{2629.6345,	2732.8936,	36.5386},
	{2635.4575,	2767.9346,	25.8222},
	{2685.5012,	2746.6240,	20.3222},
	{2668.6201,	2767.9753,	17.6896},
	{2553.7502,	2754.9238,	10.8203},
	{2524.9805,	2817.3428,	10.8203},
	{2564.5159,	2823.4812,	12.7568},
	{2594.1836,	2821.1226,	12.7647},
	{2601.4983,	2769.2195,	25.8222}
};

new Float:gParachutePickups[][PickupSpawnInfo] =
{
	{2632.7573,	2829.8999,	64.3359},
	{2632.3562,	2829.9094,	94.0156},
	{2632.3701,	2829.7065,	122.9219},
	{2719.7905,	2775.7646,	74.8281},
	{2695.8926,2785.2014,59.0212}
};

new Float: gM4Pickups[][PickupSpawnInfo]=
{
 {2591.3149,2636.0310,14.6222},
 {2608.3135,2840.6492,19.9922}
};

new Float: gArmourPickups[][PickupSpawnInfo]=
{
 {2609.6646,2714.7361,36.5386},
 {2543.2439,2847.8376,10.8203},
 {2541.5081,2734.3760,10.8130},
 {2705.2588,2688.5215,12.8222}
};

new Float: gLifePickups[][PickupSpawnInfo]=
{
{2671.3335,2797.2939,17.6896},
{2592.3718,2754.3201,10.9844},
{2554.3894,2838.5964,10.8203},
{2590.6318,2800.9578,10.8203}
};
 




forward GameModeExitFunc();
forward IsNumeric(const string[]);

dcmd_reg(playerid, params[])
{
    if(PLAYERLIST_authed[playerid]) return SystemMessage(playerid, "SEI GIA' LOGGATO.");
    if(udb_Exists(PlayerName(playerid))) return SystemMessage(playerid, "Esiste gi un account con questo nome, digita '/log password'.");
    if(strlen(params) == 0) return SystemMessage(playerid, "[DIGITA]: '/reg password'");
    if(udb_Create(PlayerName(playerid), params)) return SystemMessage(playerid, "Account creato con successo! ATTENZIONE NON DIMENTICARE LA PASSWORD! DIGITA '/log password' adesso!");
    return true;
}



dcmd_log(playerid, params[])
{
    if(PLAYERLIST_authed[playerid]) return SystemMessage(playerid, "SEI GIA' LOGGATO.");
    if(!udb_Exists(PlayerName(playerid))) return SystemMessage(playerid, "L'account non esite, si prega di regisrarsi con '/reg password'.");
    if(strlen(params) == 0) return SystemMessage(playerid, "[DIGITA]: '/log password'");
    if(udb_CheckLogin(PlayerName(playerid), params))
	{
     PLAYERLIST_authed[playerid] = true;
    return SystemMessage(playerid, "SEI LOGGATO CON SUCCESSO! (PREMI -> PER SELEZIONARE IL PERSONAGGIO)");
    }
    return SystemMessage(playerid, "LOGIN FALLITO!");
}
stock SystemMessage(playerid, message[])
{
    if((IsPlayerConnected(playerid)) && (strlen(message) > 0))
	{
    SendClientMessage(playerid, COLOR_SYSTEM, message);
    }
    return 1;
}
stock PlayerName(playerid)
{
    new name[255];
    GetPlayerName(playerid, name, 255);
    return name;
}

main()
{
	print("\n----------------------------------");
	print("  KILLER SCORE! By Newangelus");
	print("----------------------------------\n");
}
public OnPlayerConnect(playerid){
	SendClientMessage(playerid, 0xFFFFFFAA, "=============================");
	SendClientMessage(playerid, 0xFFFFFFAA, "     WELCOME TO KILLER BETA");
	SendClientMessage(playerid, 0xFFFFFFAA, "=============================");
	SendClientMessage(playerid, 0xFFFFFFAA, ".:GM realizzata da Newangelus:.");
	GameTextForPlayer(playerid, "WELCOME TO KILLER", 5000, 1);
	return 1;
}
public OnGameModeInit()
{

	SetGameModeText("KILLER SCORE!");
	ShowPlayerMarkers(1);
	ShowNameTags(1);
	SetWorldTime(0);
if(!dini_Exists("scoreboard.ini"))dini_Create("scoreboard.ini");
	AddPlayerClass(162, 0.0, 0.0, 0.0, 0.0, 34, 500, 24, 10000, 26, 10000);
	AddPlayerClass(255, 0.0, 0.0, 0.0, 0.0, 34, 500, 24, 10000, 26, 10000);
	AddPlayerClass(0, 0.0, 0.0, 0.0, 0.0, 34, 500, 24, 10000, 26, 10000);
	AddPlayerClass(106, 0.0, 0.0, 0.0, 0.0, 34, 500, 24, 10000, 26, 10000);
	AddPlayerClass(178, 0.0, 0.0, 0.0, 0.0, 34, 500, 24, 10000, 26, 10000);
	AddPlayerClass(285, 0.0, 0.0, 0.0, 0.0, 34, 500, 24, 10000, 26, 10000);
 	AddPlayerClass(281, 0.0, 0.0, 0.0, 0.0, 34, 500, 24, 10000, 26, 10000);
	// Loop through the pickups
	new i, j;
	for (i = 0, j = sizeof(gSniperPickups); i < j; i++)
	{
		AddStaticPickup(358, 15,
			gSniperPickups[i][PickupX],
			gSniperPickups[i][PickupY],
			gSniperPickups[i][PickupZ]);
	}
	for (i = 0, j = sizeof(gParachutePickups); i < j; i++)
	{
		AddStaticPickup(371, 15,
			gParachutePickups[i][PickupX],
			gParachutePickups[i][PickupY],
			gParachutePickups[i][PickupZ]);
	}

	for (i = 0, j = sizeof(gArmourPickups); i < j; i++)
	{
		AddStaticPickup(1242,15,
			gArmourPickups[i][PickupX],
			gArmourPickups[i][PickupY],
			gArmourPickups[i][PickupZ]);
	}
	for (i = 0, j = sizeof(gLifePickups); i < j; i++)
	{
		AddStaticPickup(1240,15,
			gLifePickups[i][PickupX],
			gLifePickups[i][PickupY],
			gLifePickups[i][PickupZ]);
	}

		for (i = 0, j = sizeof(gM4Pickups); i < j; i++)
	{
		AddStaticPickup(356,15,
			gM4Pickups[i][PickupX],
			gM4Pickups[i][PickupY],
			gM4Pickups[i][PickupZ]);
	}
	SetTimer("GameModeExitFunc", gRoundTime, 0);
	
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	if(PLAYERLIST_authed[playerid] == false){
		SystemMessage(playerid, "Non verrai spawnato fino a che non avrai fatto login! '/log password'");
	}else{
		SetPlayerPos(playerid, 2495.0449, 2773.0566, 10.8158);
		SetPlayerFacingAngle(playerid, 88.0);
		SetPlayerCameraPos(playerid, 2490.9556, 2773.1326, 10.7968);
		SetPlayerCameraLookAt(playerid, 2495.0449, 2773.0566, 10.8158);
	}
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	ResetSpawnInfo(playerid);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	new string[256];
	killer[0][killerid]++;
	killer[1][playerid]++;
	
new name[MAX_PLAYER_NAME];
format(name,sizeof(name),"<%s>",PlayerName(playerid)),
dini_Set("scoreboard.ini",name,"<%d> - <%d>",killer[0][playerid]++,killer[1][playerid]),
format(name,sizeof(name),"<%s>",PlayerName(killerid)),
dini_Set("scoreboard.ini",name,"<%d> - <%d>",killer[0][killerid],killer[1][playerid]++);

	SendDeathMessage(killerid, playerid, reason);
	SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
	ResetSpawnInfo(playerid);

	return 1;
}

ResetSpawnInfo(playerid)
{
	new rand = random(sizeof(gRandomSpawns));
	new skin;
	skin=GetPlayerSkin(playerid);
	SetSpawnInfo(playerid, 0,skin,
					gRandomSpawns[rand][PlayerX],
					gRandomSpawns[rand][PlayerY],
					gRandomSpawns[rand][PlayerZ],
					gRandomSpawns[rand][PlayerAngle],
				 34, 500, 24, 10000, 26, 10000);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(log, 3, cmdtext);
    dcmd(reg, 3, cmdtext);
    return false;
}

public OnPlayerDisconnect(playerid)
{
	return 1;
}
public IsNumeric(const string[])
{
	for (new i = 0, j = strlen(string); i < j; i++)
	if (string[i] > '9' || string[i] < '0')
    return 0;
	return 1;
}
public GameModeExitFunc() { GameModeExit(); }