09.05.2015, 08:42
(
Последний раз редактировалось Logofero; 09.05.2015 в 09:06.
Причина: Add: script
)
Quote:
after created actor use SetActorInvulnerable(actorid, true);. it should work.
pawn Код:
|
When enabled SetActorInvulnerable (actorid, true);
Stop working OnPlayerGiveDamageActor(playerid, damaged_actorid, Float: amount, weaponid, bodypart);
If SetActorInvulnerable (actorid, true);
OnPlayerGiveDamageActor (playerid, damaged_actorid, Float: amount, weaponid, bodypart) does not work
My script:
PHP код:
/**
* GAMEMODE : game (lite version)
* revision : 0.1 @9 may 2015
* author : fERO aka Logofero
**/
#define GAMEMODE_NAME "game (lite version)"
#include <a_samp>
#include <a_actor>
#define MAX_MSG_SIZE (256)
#define COLOR_DEFAULT (0xAAAAAAFF)
main()
{
print("\n----------------------------------");
printf(" Gamemode '%s' loaded",GAMEMODE_NAME);
print("----------------------------------\n");
}
public OnGameModeInit()
{
SetGameModeText(GAMEMODE_NAME);
AddPlayerClass(0, 0.0,0.0,5.0, 0.0, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/kill", cmdtext, true, 10) == 0)
{
SetPlayerHealth(playerid, 0);
return 1;
}
if (strcmp("/mbot", cmdtext, true, 10) == 0)
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x,y,z);
GetPlayerFacingAngle(playerid, a);
new id = CreateActor(random(299), x,y,z, a);
//SetActorHealth(id, 100.0);
//ApplyActorAnimation(id, "PED", "WALK_drunk", 4.1, 1, 1, 1, 1, 0);
//ApplyActorAnimation(id, "CHAINSAW", "CSAW_1", 4.1, 1, 1, 1, 1, 0);
SetActorInvulnerable(id, true); // <- Enabled!
return 1;
}
if (strcmp("/dbot", cmdtext, true, 10) == 0)
{
for(new i; i < MAX_ACTORS; i++) {
if(IsValidActor(i)) DestroyActor(i);
}
return 1;
}
if (strcmp("/hbot", cmdtext, true, 10) == 0)
{
for(new i; i < MAX_ACTORS; i++) {
if(IsValidActor(i)) SetActorHealth(i, 0.0);
}
return 1;
}
if (strcmp("/h2bot", cmdtext, true, 10) == 0)
{
for(new i; i < MAX_ACTORS; i++) {
if(IsValidActor(i)) SetActorHealth(i, 100.0);
}
return 1;
}
if (strcmp("/abot", cmdtext, true, 10) == 0)
{
for(new i; i < MAX_ACTORS; i++) {
if(IsValidActor(i)) {
new msg[MAX_MSG_SIZE];
new Float:a;
GetActorFacingAngle(i, a);
format(msg, MAX_MSG_SIZE, "GetActorFacingAngle actor %d current_angle %.1f", i, a);
SendClientMessage(playerid, COLOR_DEFAULT, msg);
SetActorFacingAngle(i, 180.0);
GetActorFacingAngle(i, a);
format(msg, MAX_MSG_SIZE, "SetActorFacingAngle actor %d set 180.0 current_angle %.1f", i, a);
SendClientMessage(playerid, COLOR_DEFAULT, msg);
}
}
return 1;
}
return 0;
}
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart) {
return 1;
}
public OnPlayerGiveDamageActor(playerid, damaged_actorid, Float:amount, weaponid, bodypart) { //does not work!
new string[128], attacker[MAX_PLAYER_NAME];
new weaponname[24];
GetPlayerName(playerid, attacker, sizeof (attacker));
GetWeaponName(weaponid, weaponname, sizeof (weaponname));
format(string, sizeof(string), "%s has made %.0f damage to actor id %d, weapon: %s", attacker, amount, damaged_actorid, weaponname);
SendClientMessageToAll(0xFFFFFFFF, string);
new Float:health;
GetActorHealth(damaged_actorid, health); //Get current health
if(weaponid==37)amount=9;
SetActorHealth(damaged_actorid, health-amount); //Apply damage, set new health
return 1;
}
if SetActorInvulnerable (actorid,false);
OnPlayerGiveDamageActor (playerid, damaged_actorid, Float: amount, weaponid, bodypart); work!