problem
#1

can anyone help me
how to make when player die, he cant respawn and play anymore?
i tryed something but it didn't work
i deleted ResetSpawn(playerid); in public OnPlayerDeath
and set camera
and if player die, he cant move 5 seconds and watching on camera, and after that he respawn again and can play
sorry for my bad english

Код:
/*******************************

 *                             *

 *     Minigun Madness         *

 *                  By Mike    *

 *******************************/



#include <a_samp>
#define LIGHTBLUE    0x0BBF6AA


//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
#define COLOR_RED   0xFF0000AA
#define GREEN_COLOR 0x33AA33AA
//Killing ranks

	new First[MAX_PLAYERS];
	new Double[MAX_PLAYERS];
	new Spree[MAX_PLAYERS];
	new Four[MAX_PLAYERS];
    new Dominat[MAX_PLAYERS];
    new Rampage[MAX_PLAYERS];
    new Monster[MAX_PLAYERS];
    new Six[MAX_PLAYERS];
    new GameMinutes =4;
	new GameSeconds =59;
	new GameTimer;
	new Text:Textdraw0;
	forward GameModeExitFunc(playerid);forward GameTime(playerid);
enum PlayerSpawnInfo {

	Float:PlayerX,

	Float:PlayerY,

	Float:PlayerZ,

	Float:PlayerAngle

}
new
	Text: text_Top5[2]
;

enum rankingEnum
{
    player_Score,
    player_ID
}
forward GameModeExitFunc();
new Float:gRandomSpawns[][PlayerSpawnInfo] =

{

	{2438.1831,-2081.0149,15.1404,	257.5800},

	{2445.3403,-2135.0852,17.2712,	1.9000},

	{2536.3120,-2106.9167,16.9806,	256.6609},

	{2628.6028,-2107.5850,16.9531,	102.2487},

	{2644.1399,-2073.1821,26.5938,290.8389},

	{2702.0427,-2137.7957,13.5469,351.2893},

	{2631.6548,-2136.7273,13.5469,337.1892},

 {2591.0518,-2076.9182,10.4889,254.4919},

	{2609.1064,-2018.6389,3.8594,186.8112}


};




//////////////////////////////

//  BEGIN THE ACTUAL CODE!  //

//////////////////////////////



main()

{

	print("\n----------------------------------");

	print("  Survivor \n GM NO: 25");

	print("----------------------------------\n");

}


public OnPlayerConnect(playerid)
{

    GameTextForPlayer(playerid,"~r~Survivor!",3000,1);
	SetPlayerWeather(playerid,20);

	return 1;
}

public OnGameModeInit()

{
    SetTimer("BlueTeam",297000,0);
	for(new i;i<15;++i)
	{
	    SendClientMessageToAll(GREEN_COLOR," ");
	}
	SetGameModeText("Survivor");


	EnableStuntBonusForAll(0);
	AllowInteriorWeapons(0);
	DisableInteriorEnterExits();

    text_Top5[0] = TextDrawCreate(79.000000, 135.000000, "Top 5");
	TextDrawAlignment(text_Top5[0], 2);
	TextDrawBackgroundColor(text_Top5[0], 255);
	TextDrawFont(text_Top5[0], 1);
	TextDrawLetterSize(text_Top5[0], 0.280000, 1.499999);
	TextDrawColor(text_Top5[0], -1);
	TextDrawSetOutline(text_Top5[0], 0);
	TextDrawSetProportional(text_Top5[0], 1);
	TextDrawSetShadow(text_Top5[0], 0);

	text_Top5[1] = TextDrawCreate(16.000000, 135.000000, " ");
	TextDrawBackgroundColor(text_Top5[1], 255);
	TextDrawFont(text_Top5[1], 1);
	TextDrawLetterSize(text_Top5[1], 0.200000, 0.999999);
	TextDrawColor(text_Top5[1], -1);
	TextDrawSetOutline(text_Top5[1], 0);
	TextDrawSetProportional(text_Top5[1], 1);
	TextDrawSetShadow(text_Top5[1], 0);
	TextDrawUseBox(text_Top5[1], 1);
	TextDrawBoxColor(text_Top5[1], 150);
	TextDrawTextSize(text_Top5[1], 143.000000, 20.000000);
	UsePlayerPedAnims();
	UsePlayerPedAnims();

    GameTimer = SetTimer("GameTime",1000,1);


 	Textdraw0 = TextDrawCreate(586.000000, 43.000000,"5:00");
    TextDrawAlignment(Textdraw0,2);
    TextDrawBackgroundColor(Textdraw0,0x000000ff);
    TextDrawFont(Textdraw0,3);
    TextDrawLetterSize(Textdraw0,0.499999,2.000000);
    TextDrawColor(Textdraw0,0xffffffff);
    TextDrawSetOutline(Textdraw0,1);
    TextDrawSetProportional(Textdraw0,1);
    TextDrawSetShadow(Textdraw0,1);



	AddPlayerClass(128, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);

    CreateObject(3095, 1573.8614501953, -3670.4621582031, 0, 0, 0, 0);
    CreateObject(3095, 1564.9597167969, -3670.4118652344, 0, 0, 0, 0);
    CreateObject(3095, 1556.1469726563, -3670.3837890625, 0, 0, 0, 0);
    CreateObject(3095, 1547.2318115234, -3670.3298339844, 0, 0, 0, 0);
    CreateObject(3095, 1538.2629394531, -3670.3269042969, 0, 0, 0, 0);
    CreateObject(3095, 1538.2224121094, -3679.2045898438, 0, 0, 0, 0);
    CreateObject(3095, 1538.1817626953, -3688.0661621094, 0, 0, 0, 0);
    CreateObject(3095, 1538.1108398438, -3696.9802246094, 0, 0, 0, 0);
    CreateObject(3095, 1538.0952148438, -3705.7548828125, 0, 0, 0, 0);
    CreateObject(3095, 1547.060546875, -3705.7641601563, 0, 0, 0, 0);
    CreateObject(3095, 1556.0493164063, -3705.8046875, 0, 0, 0, 0);
    CreateObject(3095, 1564.9997558594, -3705.8186035156, 0, 0, 0, 0);
    CreateObject(3095, 1573.9145507813, -3705.8500976563, 0, 0, 0, 0);
    CreateObject(3095, 1573.8656005859, -3679.4013671875, 0, 0, 0, 0);
    CreateObject(3095, 1573.8671875, -3688.3984375, 0, 0, 0, 0);
    CreateObject(3095, 1573.8911132813, -3697.0224609375, 0, 0, 0, 0);
    CreateObject(3095, 1547.1561279297, -3696.7563476563, 0, 0, 0, 0);
    CreateObject(3095, 1556.1551513672, -3696.8210449219, 0, 0, 0, 0);
    CreateObject(3095, 1565.1307373047, -3696.8684082031, 0, 0, 0, 0);
    CreateObject(3095, 1564.8587646484, -3687.9702148438, 0, 0, 0, 0);
    CreateObject(3095, 1564.8753662109, -3678.9968261719, 0, 0, 0, 0);
    CreateObject(3095, 1555.9946289063, -3679.3671875, 0, 0, 0, 0);
    CreateObject(3095, 1547.1447753906, -3679.34375, 0, 0, 0, 0);
    CreateObject(3095, 1555.9664306641, -3688.0859375, 0, 0, 0, 0);
    CreateObject(3095, 1547.1535644531, -3687.9665527344, 0, 0, 0, 0);
    CreateObject(974, 1574.6573486328, -3674.4321289063, 3.3331060409546, 0, 0, 357.5);
    CreateObject(974, 1571.2325439453, -3671.0458984375, 3.3331060409546, 0, 359.75, 91);
    CreateObject(629, 1546.3612060547, -3677.4936523438, 0.55536550283432, 0, 0, 0);
    CreateObject(617, 1553.23046875, -3684.302734375, 0.55536550283432, 0, 0, 0);
    CreateObject(629, 1548.9611816406, -3689.9587402344, 0.55536550283432, 0, 0, 0);
    CreateObject(821, 1570.7553710938, -3666.7045898438, 2.5975437164307, 0, 0, 0);
    CreateObject(821, 1567.4537353516, -3682.4387207031, 2.5975437164307, 0, 0, 0);
    CreateObject(821, 1557.3806152344, -3674.7487792969, 2.5975437164307, 0, 0, 0);
    CreateObject(821, 1540.5306396484, -3671.7551269531, 2.5975437164307, 0, 0, 0);
    CreateObject(821, 1539.4581298828, -3701.806640625, 2.5975437164307, 0, 0, 0);
    CreateObject(821, 1555.8796386719, -3700.3610839844, 2.5975437164307, 0, 0, 0);
    CreateObject(822, 1547.9951171875, -3699.3720703125, 2.8073163032532, 0, 0, 0);
    CreateObject(3279, 1539.1228027344, -3699.8234863281, 0.55536550283432, 0, 0, 0);
    CreateObject(13367, 1550.0197753906, -3699.669921875, 12.549252510071, 0, 0, 0);
    CreateObject(1225, 1566.0502929688, -3701.0366210938, 0.96112048625946, 0, 0, 0);
    CreateObject(1225, 1572.5584716797, -3667.4594726563, 0.96112048625946, 0, 0, 0);
    CreateObject(1225, 1539.0710449219, -3702.5217285156, 2.3118205070496, 0, 0, 0);
    CreateObject(1225, 1538.9652099609, -3703.6892089844, 2.382577419281, 0, 0, 0);
    CreateObject(1225, 1536.3642578125, -3696.9985351563, 6.1329956054688, 0, 0, 0);
    CreateObject(1225, 1539.4073486328, -3699.396484375, 8.6393165588379, 0, 0, 0);
    CreateObject(1225, 1538.9951171875, -3697.2465820313, 14.113077163696, 0, 0, 0);
    CreateObject(1225, 1549.9996337891, -3699.568359375, 23.917491912842, 0, 0, 0);
    CreateObject(1225, 1537.8815917969, -3698.2766113281, 17.03924369812, 0, 0, 0);
    CreateObject(1225, 1540.8511962891, -3701.5871582031, 17.03924369812, 0, 0, 0);
    CreateObject(1225, 1540.2385253906, -3671.0234375, 0.96112048625946, 0, 0, 0);
    CreateObject(3374, 1565.4838867188, -3701.1125488281, 2.0493421554565, 0, 0, 0);
    CreateObject(982, 1548.1173095703, -3680.4809570313, 1.238920211792, 0, 0, 0);
    CreateObject(3095, 2289.2727050781, -3528.6022949219, 0, 0, 0, 0);
    CreateObject(974, 2288.1306152344, -3524.3259277344, 3.3331060409546, 0, 0, 0);
    CreateObject(974, 2290.7282714844, -3524.3095703125, 3.3331060409546, 0, 0, 359);
    CreateObject(974, 2288.0627441406, -3532.9799804688, 3.3331060409546, 0, 0, 0);
    CreateObject(974, 2290.5500488281, -3533.0212402344, 3.3331060409546, 0, 0, 0);
    CreateObject(974, 2284.9533691406, -3527.5744628906, 3.3331060409546, 0, 1, 91.25);
    CreateObject(974, 2284.9892578125, -3529.8132324219, 3.3331060409546, 0, 0, 92);
    CreateObject(974, 2293.6850585938, -3527.6271972656, 3.3331060409546, 0, 0, 89.5);
    CreateObject(974, 2293.6706542969, -3530.0649414063, 3.3331060409546, 0, 0, 88);
    CreateObject(10558, 2291.6967773438, -3528.7136230469, 5.9578542709351, 0, 90, 0);
    CreateObject(10558, 2287.8559570313, -3528.6081542969, 6.0361156463623, 0, 270.25024414063, 359.75024414063);
    CreateObject(10558, 2285.2856445313, -3528.4445800781, 5.6251163482666, 0, 274.50012207031, 1);
    CreateObject(3524, 2288.7507324219, -3528.9235839844, 8.9175434112549, 0, 0, 0);
    CreateObject(3525, 2292.5715332031, -3524.333984375, 2.870236158371, 0, 0, 0);
    CreateObject(3525, 2286.7160644531, -3524.3181152344, 3.149676322937, 0, 0, 0);
    CreateObject(3528, 2284.9692382813, -3528.6645507813, 3.4445490837097, 0, 0, 0);
    CreateObject(1225, 2289.5451660156, -3526.7863769531, 0.96112048625946, 0, 0, 0);
    CreateObject(1225, 2288.6352539063, -3530.828125, 0.96112048625946, 0, 0, 0);
    CreateObject(1225, 2292.4360351563, -3531.5476074219, 0.96112048625946, 0, 0, 0);
    CreateObject(3524, 1588.0869140625, -3644.5173339844, 43.045677185059, 0, 0, 146);



	// Loop through the pickups




	SetTimer("GameModeExitFunc", gRoundTime, 0);



	return 1;

}



public OnPlayerRequestClass(playerid, classid)

{
	SetPlayerInterior(playerid,11);
	SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
    SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
	SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);
	SetPlayerFacingAngle(playerid,0.0);

	return 1;

}
forward BlueTeam();
public BlueTeam( )
{
    GameTextForAll("~g~Map Time ~r~Has Passed!!",3000,3);
	SetTimer("GameModeExitFunc",3000,0);

}


public OnPlayerRequestSpawn(playerid)

{

	ResetSpawnInfo(playerid);

	return 1;

}
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(!strcmp(cmdtext, "/shop", true))
    {
    SendClientMessage(playerid,0xff0010ff,"***Shop Disabled in This Mission***");
    return 1;
    }
	return SendClientMessage(playerid,COLOR_RED,"Unknown Command Use /help For All Commands");
}

public OnPlayerDeath(playerid, killerid, reason)

{
    SetPlayerWantedLevel(playerid, 0);

	SendDeathMessage(killerid, playerid, reason);

	SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);

    GivePlayerMoney(killerid,1000);
    GivePlayerMoney(playerid,-500);

    TextDrawHideForPlayer(playerid, text_Top5[0]);
	TextDrawHideForPlayer(playerid, text_Top5[1]);
    SetPlayerCameraPos(playerid,1592.4226,-3637.0891,49.1796);
	SetPlayerCameraLookAt(playerid,1559.1970,-3682.4658,1.5554);
	SendClientMessage(playerid, COLOR_RED, "You are on the sky...");

    //Killing ranks

	First[killerid] ++;
	First[playerid] = 0;

	Spree[killerid] ++;
	Spree[playerid] = 0;

	Double[killerid] ++;
	Double[playerid] = 0;

	Dominat[killerid] ++;
	Dominat[playerid] = 0;

	Rampage[killerid] ++;
	Rampage[playerid] = 0;

	Monster[killerid] ++;
	Monster[playerid] = 0;

    Six[killerid] ++;
	Six[playerid] = 0;

	Four[killerid] ++;
	Four[playerid] = 0;

    if(First[killerid] == 1)
	{
 	SetPlayerWantedLevel(killerid, 1);

 	}
	if(Double[killerid] == 2)
	{
	new str2[128];
	new kname[MAX_PLAYER_NAME];
	GetPlayerName(killerid,kname,sizeof(kname));
	format(str2,sizeof(str2), " %s(%d) Double Killing",kname,killerid);
	GameTextForAll(str2,4000,3);
	SendClientMessageToAll(LIGHTBLUE,str2);
    SetPlayerWantedLevel(killerid, 2);
	}
	if(Spree[killerid] == 3)
	{
	new str2[128];
	new kname[MAX_PLAYER_NAME];
	GetPlayerName(killerid,kname,sizeof(kname));
	format(str2,sizeof(str2), " %s(%d) Killing Spree",kname,killerid);
	GameTextForAll(str2,4000,3);
	SendClientMessageToAll(LIGHTBLUE,str2);
    SetPlayerWantedLevel(killerid, 3);
    GivePlayerMoney(killerid,3000);
	}
	if(Four[killerid] == 4)
	{
    SetPlayerWantedLevel(killerid, 4);
	}
	if(Dominat[killerid] == 5)
	{
	new str2[128];
	new kname[MAX_PLAYER_NAME];
	GetPlayerName(killerid,kname,sizeof(kname));
	format(str2,sizeof(str2), " %s(%d) Dominating",kname,killerid);
	GameTextForAll(str2,4000,3);
	SendClientMessageToAll(LIGHTBLUE,str2);
    SetPlayerWantedLevel(killerid, 5);
    GivePlayerMoney(killerid,5000);
	}
	if(Six[killerid] == 6)
	{
    SetPlayerWantedLevel(killerid, 6);
	}
	if(Rampage[killerid] == 8)
	{
	new str2[128];
	new kname[MAX_PLAYER_NAME];
	GetPlayerName(killerid,kname,sizeof(kname));
	format(str2,sizeof(str2), " %s(%d) Rampage Killing",kname,killerid);
	GameTextForAll(str2,4000,3);
	SendClientMessageToAll(LIGHTBLUE,str2);
    SetPlayerWantedLevel(killerid, 6);
    GivePlayerMoney(killerid,8000);
	}

	if(Monster[killerid] == 12)
	{
	new str2[128];
	new kname[MAX_PLAYER_NAME];
	GetPlayerName(killerid,kname,sizeof(kname));
	format(str2,sizeof(str2), " %s(%d) Monster Killing",kname,killerid);
	GameTextForAll(str2,4000,3);
	SendClientMessageToAll(LIGHTBLUE,str2);
    SetPlayerWantedLevel(killerid, 6);
    GivePlayerMoney(killerid,12000);
	}
	return 1;

}

public GameTime()
{
    if(GameSeconds || GameMinutes)
    {
        GameSeconds--;
        if(GameSeconds <= -1)
        {
            GameMinutes--;
            GameSeconds=59;
        }
        new TimeString[256];
        format(TimeString,sizeof(TimeString),"~b~%02d~y~:~r~%02d",GameMinutes,GameSeconds);
        TextDrawSetString(Textdraw0,TimeString);
    }

    return 1;
}
ResetSpawnInfo(playerid)

{

	new rand = random(sizeof(gRandomSpawns));

	SetSpawnInfo(playerid, 255, 128,

					gRandomSpawns[rand][PlayerX],

					gRandomSpawns[rand][PlayerY],

					gRandomSpawns[rand][PlayerZ],

					gRandomSpawns[rand][PlayerAngle],

					24, 500, 31, 500, 27, 500);

}
public OnPlayerUpdate(playerid)
{   new
			playerScores[MAX_PLAYERS][rankingEnum],
			index
		;
    for(new i; i != MAX_PLAYERS; ++i)
		{
			if(IsPlayerConnected(i) && !IsPlayerNPC(i))
			{
				playerScores[index][player_Score] = GetPlayerScore(i);
				playerScores[index++][player_ID] = i;
			}
		}
	GetPlayerHighestScores(playerScores, 0, index);

    new
			score_Text[256] = "~n~",
			player_Name[20]
		;
    for(new i; i < 5; ++i)
		{
			if(i < index)
			{
				GetPlayerName(playerScores[i][player_ID], player_Name, sizeof(player_Name));
				format(score_Text, sizeof(score_Text), "%s~n~~b~%d. ~w~%s - ~r~%d", score_Text, i + 1, player_Name, playerScores[i][player_Score]);
			}
			else
				format(score_Text, sizeof(score_Text), "%s~n~~b~%d. ~r~N/A", score_Text, i + 1);
		}
    TextDrawSetString(text_Top5[1], score_Text);



	return 1;
}

public OnPlayerSpawn(playerid)
{
    SetPlayerInterior(playerid,0);
    SetPlayerColor(playerid,GREEN_COLOR);
    SetCameraBehindPlayer(playerid);
    TextDrawShowForPlayer(playerid,Textdraw0);
   // TextDrawShowForPlayer(playerid, text_Top5[0]);
	//TextDrawShowForPlayer(playerid, text_Top5[1]);
    return 1;
}
stock IsPlayerInWater(playerid)
{
new Float:x,Float:y,Float:pz;
GetPlayerPos(playerid,x,y,pz);
if ((IsPlayerInArea(playerid, 2032.1371, 1841.2656, 1703.1653, 1467.1099) && pz <= 9.0484)
|| (IsPlayerInArea(playerid, 2109.0725, 2065.8232, 1962.5355, 10.8547) && pz <= 10.0792)
|| (IsPlayerInArea(playerid, -492.5810, -1424.7122, 2836.8284, 2001.8235) && pz <= 41.06)
|| (IsPlayerInArea(playerid, -2675.1492, -2762.1792, -413.3973, -514.3894) && pz <= 4.24)
|| (IsPlayerInArea(playerid, -453.9256, -825.7167, -1869.9600, -2072.8215) && pz <= 5.72)
|| (IsPlayerInArea(playerid, 1281.0251, 1202.2368, -2346.7451, -2414.4492) && pz <= 9.3145)
|| (IsPlayerInArea(playerid, 2012.6154, 1928.9028, -1178.6207, -1221.4043) && pz <= 18.45)
|| (IsPlayerInArea(playerid, 2326.4858, 2295.7471, -1400.2797, -1431.1266) && pz <= 22.615)
|| (IsPlayerInArea(playerid, 2550.0454, 2513.7588, 1583.3751, 1553.0753) && pz <= 9.4171)
|| (IsPlayerInArea(playerid, 1102.3634, 1087.3705, -663.1653, -682.5446) && pz <= 112.45)
|| (IsPlayerInArea(playerid, 1287.7906, 1270.4369, -801.3882, -810.0527) && pz <= 87.123)
|| (pz < 1.5)
)
SendClientMessage(playerid, COLOR_RED, "Water is poisonous, you're dead!!!");
SetPlayerHealth(playerid, 0)
SetPlayerArmour(playerid, 0)
{
return 1;
}
return 0;
}
stock GetPlayerHighestScores(array[][rankingEnum], left, right)
{
    new
        tempLeft = left,
        tempRight = right,
        pivot = array[(left + right) / 2][player_Score],
        tempVar
    ;
    while(tempLeft <= tempRight)
    {
        while(array[tempLeft][player_Score] > pivot) tempLeft++;
        while(array[tempRight][player_Score] < pivot) tempRight--;

        if(tempLeft <= tempRight)
        {
            tempVar = array[tempLeft][player_Score], array[tempLeft][player_Score] = array[tempRight][player_Score], array[tempRight][player_Score] = tempVar;
            tempVar = array[tempLeft][player_ID], array[tempLeft][player_ID] = array[tempRight][player_ID], array[tempRight][player_ID] = tempVar;
            tempLeft++, tempRight--;
        }
    }
    if(left < tempRight) GetPlayerHighestScores(array, left, tempRight);
    if(tempLeft < right) GetPlayerHighestScores(array, tempLeft, right);
}
public GameModeExitFunc(playerid) {
	SendRconCommand("changemode GM1");
	GameTextForAll("~y~Changing Game ~n~ ~w~Please Wait....",5500,1);
	for(new i;i<15;++i)
	{
	    SendClientMessageToAll(GREEN_COLOR," ");
	}
	KillTimer(GameTimer);
    TextDrawHideForPlayer(playerid,Textdraw0);
	 }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)