30.09.2009, 00:54
Okay so .. I have made a command .. to get a player drunk, kinda like to test out how to do stuff.
The command:
.. and the timer .. to complement the command .. is supposed to set the player with the drunk animation after drinking a little bit.
.. but it doesn't work ... any idea's why ![smiley](images/smilies/question.gif)
Thanks in advance.![Cool](images/smilies/cool.gif)
EDIT:
Lmao .. never mind I solved it .. I should really pay attention a bit more.
The error was down to a mistake in letter-case the timer was calling "IrDrunk" when the function was called "irdrunk".
Solved .. how embarrassing.
The command:
pawn Код:
dcmd_beer(playerid, params[])
{
#pragma unused params
new string[128];
ImDrinking[playerid] = 1; // This bit sets the timer to recognise me as drinking.
format(string,sizeof(string),"You now have a bottle of beer, break a leg!");
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_BEER);
return SendClientMessage(playerid, Green, string);
}
pawn Код:
Drunktimer = SetTimer("IrDrunk", 1000, 1);
pawn Код:
public irdrunk()
{
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && ImDrinking[i] == 1 && GetPlayerDrunkLevel(i) >= 4000)
{
ApplyAnimation(i,"PED","WALK_DRUNK",4.1,1,1,1,1,1);
}
/* if(IsPlayerConnected(i) && ImDrinking[i] && GetPlayerDrunkLevel(i) >= 20000)
{
SetPlayerHealth(i, 0);
} */
}
return 1;
}
![smiley](images/smilies/question.gif)
Thanks in advance.
![Cool](images/smilies/cool.gif)
EDIT:
Lmao .. never mind I solved it .. I should really pay attention a bit more.
The error was down to a mistake in letter-case the timer was calling "IrDrunk" when the function was called "irdrunk".
Solved .. how embarrassing.
![Embarrassed](images/smilies/redface.gif)