#include static TalkStyle[MAX_PLAYERS]; static Timer:ChatTimer[MAX_PLAYERS]; timer OnPlayerStopsChatting[2000](playerid) { ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0, 1); } hook OnPlayerConnect(playerid) { TalkStyle[playerid] = 0; } hook OnPlayerText(playerid, text[]) { StartChatting(playerid, strlen(text) * 100); } StartChatting(playerid, length) { if(!IsPlayerDoingAnimation(playerid)) { switch(TalkStyle[playerid]) { case 0: ApplyAnimation(playerid, "PED", "IDLE_CHAT", 4.0, 1, 0, 0, 1, 1); case 1: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkA", 4.0, 1, 0, 0, 1, 1); case 2: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkB", 4.0, 1, 0, 0, 1, 1); case 3: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkC", 4.0, 1, 0, 0, 1, 1); case 4: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkD", 4.0, 1, 0, 0, 1, 1); case 5: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkE", 4.0, 1, 0, 0, 1, 1); case 6: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkF", 4.0, 1, 0, 0, 1, 1); case 7: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkG", 4.0, 1, 0, 0, 1, 1); case 8: ApplyAnimation(playerid, "GANGS", "prtial_gngtlkH", 4.0, 1, 0, 0, 1, 1); } if(!Timer_IsRunning(ChatTimer[playerid])) { ChatTimer[playerid] = defer OnPlayerStopsChatting[length](playerid); } } } CMD:talkstyle(playerid, params[]) { if(isnull(params) || !IsNumeric(params)) return SendSyntaxMessage(playerid, "/talkstyle (0-8)"); new styleid = strval(params); if(!(0 <= styleid <= 9)) return SendErrorMessage(playerid, "Talking style ID must be between 0 and 8."); if(TalkStyle[playerid] == styleid) return SendErrorMessage(playerid, "You already have that talking style."); Player_SetTalkStyle(playerid, styleid, true); SendInfoMessage(playerid, "You have set a new talking style."); return 1; } stock Player_SetTalkStyle(playerid, styleid, bool:save) { TalkStyle[playerid] = styleid; if(save) { new query[64]; mysql_format(MySQL_GetHandle(), query, sizeof(query), "UPDATE characters SET talk_style = %d WHERE id = %d", styleid, Character_GetSQLID(playerid)); mysql_tquery(MySQL_GetHandle(), query); } } stock Player_GetTalkStyle(playerid) { return TalkStyle[playerid]; }