SA-MP Forums Archive
Help with bomb system - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with bomb system (/showthread.php?tid=363602)



Help with bomb system - Kain1297 - 28.07.2012

im making a bomb system but the problem is that im the only one who can defuse my own bomb, only the player who detonated can defuse it
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	new Float:x, Float:y, Float:z;
	if (strcmp("/detonate", cmdtext, true, 10) == 0)
	{
		GetPlayerPos(playerid, x,y,z);
        GetPlayerPos(deton, PlayerBombX[playerid], PlayerBombY[playerid], PlayerBombZ[playerid]);
		deton = CreateObject(1252,x,y,z,0,0,0);
		GameTextForPlayer(playerid, "Bomb planted!",2000,3);
		return 1;
	}
	if (strcmp("/defuse", cmdtext, true, 10) == 0)
	{
		if(IsPlayerInRangeOfPoint(playerid, 10.5,PlayerBombX[i], PlayerBombY[i], PlayerBombZ[i]))
		{
		TextDrawShowForPlayer(playerid,Textdraw0[playerid]);
		TextDrawShowForPlayer(playerid,Textdraw1[playerid]);
		TextDrawShowForPlayer(playerid,Textdraw2[playerid]);
		GameTextForPlayer(playerid, "Defusing bomb!",2000,3);
		taim = SetTimer("defuse",100,true);
		playerid = defid;
		}
		else
		{
		GameTextForPlayer(playerid, "You need to be near the bomb!",2000,3);
		}
		return 1;
	}
	return 0;
}



Re: Help with bomb system - [MM]RoXoR[FS] - 28.07.2012

pawn Код:
taim = SetTimer("defuse",100,true);
defid = playerid;
I think it will work.
Also I think you should use SetTimerEx and pass bomb id to timer.