31.08.2011, 18:14
Hey guys,
Im having problems with the callback OnPlayerStateChange. Im trying to check that the newstate == driver, and the oldstate == onfoot, and then show him a textdraw. Somehow it doesnt work, but in game it shows its changing.
It shows "You changed from state %d to state %d!" in game, with the %d with a number ofcourse.
Anyone knows what the problem is?
Im having problems with the callback OnPlayerStateChange. Im trying to check that the newstate == driver, and the oldstate == onfoot, and then show him a textdraw. Somehow it doesnt work, but in game it shows its changing.
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new string[39];
format(string, sizeof(string), "You changed from state %d to state %d!", oldstate, newstate);
SendClientMessage(playerid,0xFFFFFFFF,string);
if( oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT )
{
TextDrawHideForPlayer(playerid, Speedo[playerid]);
}
if( oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER )
{
TextDrawShowForPlayer(playerid, Speedo[playerid]);
}
return 1;
}
Anyone knows what the problem is?