18.12.2015, 20:31
(
Последний раз редактировалось SickAttack; 18.12.2015 в 21:10.
)
Quote:
i told yo i do not undrestand the second parameter make some effor damn it
|
"u make some effor damn it"
pawn Код:
// ** INCLUDES
#include <a_samp>
// ** VARIABLES
// *** GLOBAL VARIABLES
// **** GENERAL
new gActor,
bool:gActorDead = false;
// ** MAIN
main()
{
print("Loaded \"killable_actor.amx\".");
}
// ** CALLBACKS
public OnGameModeInit()
{
gActor = CreateActor(0, 136.6050, -74.2258, 1.4297, 0.0);
SetActorInvulnerable(gActor, false);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerSpawn(playerid)
{
GivePlayerWeapon(playerid, 26, 500);
return 1;
}
public OnPlayerGiveDamageActor(playerid, damaged_actorid, Float:amount, weaponid, bodypart)
{
new Float:health;
GetActorHealth(gActor, health);
if(health >= 0.0)
{
SetActorHealth(gActor, health - amount);
}
if(!gActorDead && (health - amount) <= 0.0)
{
gActorDead = true;
OnActorDeath(damaged_actorid, playerid, weaponid);
}
return 1;
}
forward OnActorDeath(actorid, killerid, reason);
public OnActorDeath(actorid, killerid, reason)
{
if(!IsValidActor(actorid)) return 0;
if(IsValidWeaponID(reason))
{
new weapon_name[20];
if(reason == 0)
{
strcat(weapon_name, "Fists");
}
else
{
GetWeaponName(reason, weapon_name, sizeof(weapon_name));
}
new string[144];
format(string, sizeof(string), "%s (%d) killed the actor #%d - %s.", PlayerName(killerid), killerid, actorid, weapon_name);
SendClientMessageToAll(0x9F3535FF, string);
}
return 1;
}
// ** FUNCTIONS
forward bool:IsValidWeaponID(weaponid);
public bool:IsValidWeaponID(weaponid)
{
if(weaponid < 0 || weaponid > 46) return false;
switch(weaponid)
{
case 0, 19, 20, 21, 48: return false;
default: return true;
}
return false;
}
stock PlayerName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
return name;
}