17.11.2009, 11:48
I've made up a system that does this:
If a player has a lighter and a cigarette he can type in /smoke and this would happen for him:
Once a special action has been applied he can use KEY_FIRE (Left Mouse Button) to smoke a cigarette.
Under the callback OnPlayerKeyStateChage i made this:
And the bug is:
If a player is runing (SPACE) or walking (ALT) and if he presses (LMB) to smoke, nothing happens.
How can i make that he can smoke while runing or walking ?
Thank you for your answers.
If a player has a lighter and a cigarette he can type in /smoke and this would happen for him:
pawn Код:
PlayerActionMessage(playerid,10.0,"takes a lighter and lights up his cigarette");
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_SMOKE_CIGGY);
PlayerSmoking[playerid] = 5;
Under the callback OnPlayerKeyStateChage i made this:
pawn Код:
if(newkeys == KEY_FIRE) // LMB
{
if(PlayerSmoking[playerid] > 1) // He's cigarette is lighted and he has more than 1 smokes remaining
{
PlayerSmoking[playerid] -= 1;
GivePlayerHealth(playerid,2);
PlayerActionMessage(playerid,10.0,"smokes a cigarette");
}
else // He has only one smoke left. He stops smoking.
{
PlayerSmoking[playerid] = 0;
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
PlayerActionMessage(playerid,10.0,"throws the cigarette away");
}
}
If a player is runing (SPACE) or walking (ALT) and if he presses (LMB) to smoke, nothing happens.
How can i make that he can smoke while runing or walking ?
Thank you for your answers.

