quick question
#1

hey how to make an actor killable
and yes i read the SetActorInvulnerable and didn't undrestand how to exactly use the second thing pleas help
(give an example if u can)
Reply
#2

Everything you need to know is here: https://sampwiki.blast.hk/wiki/Category:Actor
Reply
#3

i told yo i do not undrestand the second parameter make some effor damn it
Reply
#4

Quote:
Originally Posted by iNuBe
Посмотреть сообщение
i told yo i do not undrestand the second parameter make some effor damn it
If only people would read...



"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;
}
Reply
#5

but sir i'm but a simple scripter and it takes a lot of time to find this out on y own why not use my professional scripting brothers who know better
Reply
#6

Quote:
Originally Posted by iNuBe
Посмотреть сообщение
but sir i'm but a simple scripter and it takes a lot of time to find this out on y own why not use my professional scripting brothers who know better
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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)