28.07.2016, 15:33
Hello, I've tried everything but it seems like I can't find a way to stop a timer. Basically its about when you go in a small shelter and take a pickup, the exit is getting blocked and a 3d text label spawns, saying the command /riddle as then are the instructions on how to escape the house, after the person enters the pickup a timer starts where his health is getting lowered by 1 every 1 second untill he dies, unless he manages to say the command he will eventually die. The problem is after the player writes the command, even though I've written the KillTimer thing it doesn't stop, below is the code any help is appreciated as I ran out of ideas.
PHP код:
new lowhp[MAX_PLAYERS];
new Text3D:riddle;
new destroy;
new door1; // pickup
new door2; //door to move
forward message(playerid);
if (strcmp("/shorter", cmdtext, true, 10) == 0)
{
if (IsPlayerInRangeOfPoint(playerid, 7.0, -1497.6346,-2251.0876,1.9605))
{
SendClientMessage(playerid, COLOR_GREEN, "Seems like you will live... for now.");
DestroyObject(destroy);
Delete3DTextLabel(riddle);
KillTimer(message(playerid));
return 1;
}
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == door1)
DestroyObject(door2);
destroy = CreateObject(2957,-1497.3000488281, -2251.8999023438, 2.7999999523163, 336.19207763672, 349.67669677734, 27.749084472656);
SendClientMessage(playerid, COLOR_WHITE, "Look behind yourself");
riddle = Create3DTextLabel("/riddle", COLOR_ORANGE, -1497.6346,-2251.0876,1.9605, 10, 0, 0);
lowhp[playerid] = SetTimerEx("message", 1000, true, "i", playerid);
return 1;
}
public message(playerid)
{
new Float:Healther;
GetPlayerHealth(playerid, Healther);
SetPlayerHealth(playerid, Healther-1);
return 1;
}