30.08.2015, 10:11
im using this unconscious system.
How do i change the animation when i get hurt and delete the freeze?
Код:
/////////////////////// #include <a_samp> #include "../include/gl_common.inc" //--Settings-- #define DIZZ_WAIT 5 //Seconds to wait until player gets dizzy. #define FULL_WAIT 40 //Seconds after becoming dizzy to wait until the player regains full control. //------------ #define COLOR_NOTICE 0xFF7F00FF forward RegainCons1(playerid); forward RegainCons2(playerid); forward DeathRC(playerid); forward SimpleDrunk(playerid); enum pInfo { pKO, pDrunk, }; new PlayerInfo[MAX_PLAYERS][pInfo]; new Keys,up,down; new Float:PlayerHP; new RC1tim; new RC2tim; new WaitSeconds = DIZZ_WAIT * 1000; new RCWaitSeconds = FULL_WAIT * 1000; public OnFilterScriptInit() { print("\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); print("| SWEMike's Knockout |"); print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[256]; new idx; cmd = strtok(cmdtext, idx); //--TEST-- if(IsPlayerAdmin(playerid)) { if(strcmp(cmd, "/knockout", true) == 0) { SetPlayerHealth(playerid, 20); return 1; } } return 0; } public OnPlayerDeath(playerid, killerid, reason) { DeathRC(playerid); return 1; } public OnPlayerUpdate(playerid) { GetPlayerKeys(playerid,Keys,up,down); if(!IsPlayerInAnyVehicle(playerid)) { if(PlayerInfo[playerid][pDrunk] == 1) { if(Keys == KEY_JUMP || Keys == KEY_SECONDARY_ATTACK || Keys == KEY_FIRE || Keys == KEY_ACTION || Keys == KEY_WALK) { SimpleDrunk(playerid); } } } new string[256]; GetPlayerHealth(playerid, PlayerHP); if(PlayerHP <= 20 && PlayerInfo[playerid][pKO] == 0) { format(string, sizeof(string), "You have been knocked out, please wait %d seconds to regain your consciousness.", DIZZ_WAIT); SendClientMessage(playerid, COLOR_NOTICE, string); TogglePlayerControllable(playerid, true); if(!IsPlayerInAnyVehicle(playerid)) { ClearAnimations(playerid); ApplyAnimation(playerid, "BEACH", "CRCKIDLE1", 4.1, 1, 1, 1, 1, 1); } RC1tim = SetTimerEx("RegainCons1", WaitSeconds, false, "i", playerid); PlayerInfo[playerid][pKO] = 1; } else if(PlayerHP > 20 && PlayerInfo[playerid][pKO] == 1) { PlayerInfo[playerid][pKO] = 0; SetPlayerDrunkLevel(playerid, 0); ClearAnimations(playerid); } return 1; } public OnPlayerStreamIn(playerid, forplayerid) { return 1; } public OnPlayerStreamOut(playerid, forplayerid) { return 1; } public OnVehicleStreamIn(vehicleid, forplayerid) { return 1; } public OnVehicleStreamOut(vehicleid, forplayerid) { return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { return 1; } public OnPlayerClickPlayer(playerid, clickedplayerid, source) { return 1; } public RegainCons1(playerid) { SendClientMessage(playerid, COLOR_NOTICE, "You have regained your consciousness but you are very dizzy."); TogglePlayerControllable(playerid, true); SetPlayerDrunkLevel(playerid, 20000); if(!IsPlayerInAnyVehicle(playerid)) { ClearAnimations(playerid); ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,1,1,1,1,1); PlayerInfo[playerid][pDrunk] = 1; } RC2tim = SetTimerEx("RegainCons2", RCWaitSeconds, false, "i", playerid); return 1; } public RegainCons2(playerid) { SendClientMessage(playerid, COLOR_NOTICE, "You have fully regained control over your body and can continue normally."); SetPlayerDrunkLevel(playerid, 0); PlayerInfo[playerid][pDrunk] = 0; ClearAnimations(playerid); return 1; } public DeathRC(playerid) { KillTimer(RC1tim); KillTimer(RC2tim); PlayerInfo[playerid][pKO] = 0; SetPlayerDrunkLevel(playerid, 0); PlayerInfo[playerid][pDrunk] = 0; ClearAnimations(playerid); return 1; } public SimpleDrunk(playerid) { ClearAnimations(playerid); ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,1,1,1,1,1); }