26.04.2016, 12:32
Iformation;
This is a basic system that pretty much put's a player in injured mode, and if their shot again whilst in 'injured' mode it sends them directly to the hospital.
Code;
Breakdown;
This include a_samp for the default SAMP functions for your gamemode, and makes things like TogglePlayerControlable(), and SetPlayerPos work.
This is an enumerator for your player info. An enumerator just translates numbers into words for ease of use, with that being said the new Players[MAX_PLAYERS][pInfo] is an array. (If you're not sure what's an array ****** or SAMP wiki is your friend.)
https://sampforum.blast.hk/showthread.php?tid=318307
The float defines the user health, and GetPlayerHealth checks for their HP then after if the users health is 15.0 or lower then it applies the hut animation, and makes it where the user cannot get out of the anim by toggling his power to control his character, and it also sets the enum value of the pInjured to 1 or yes.
This checks if the player is injured when they take damage if it's true, and their injured then it sets them to the hospital, and their HP up to 75.
This is a basic system that pretty much put's a player in injured mode, and if their shot again whilst in 'injured' mode it sends them directly to the hospital.
Code;
pawn Код:
#include <a_samp>
enum pInfo {
pInjured,
}
new Players[MAX_PLAYERS][pInfo];
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
new Float:health;
GetPlayerHealth(playerid,health);
if(health < 15.0)
{
TogglePlayerControllable(playerid, 0);
ApplyAnimation(playerid,"CRACK","crckidle2",1,0,0, 0,0,0);
Players[playerid][pInjured] = 1;
}
if(Players[playerid][pInjured] == 1)
{
SetPlayerHealth(playerid, 75);
SetPlayerPos(playerid, 2035.3583,-1412.8423,16.9922);
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, -1, "You've been injured, and respawned at the hospital");
Players[playerid][pInjured] = 0;
}
return 1;
}
Код:
#include <a_samp>
Код:
enum pInfo { pInjured, } new Players[MAX_PLAYERS][pInfo];
https://sampforum.blast.hk/showthread.php?tid=318307
Код:
new Float:health; GetPlayerHealth(playerid,health); if(health < 15.0) { TogglePlayerControllable(playerid, 0); ApplyAnimation(playerid,"CRACK","crckidle2",1,0,0, 0,0,0); Players[playerid][pInjured] = 1; }
Код:
if(Players[playerid][pInjured] == 1) { SetPlayerHealth(playerid, 75); SetPlayerPos(playerid, 2035.3583,-1412.8423,16.9922); TogglePlayerControllable(playerid, 1); SendClientMessage(playerid, -1, "You've been injured, and respawned at the hospital"); Players[playerid][pInjured] = 0;