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;
}
I think it will work.