Jump to content
  • 0

Death System ca pe LS:RP


valelele

Question

Am incercat sa fac un Death System ca pe LS:RP.

Gen: cand un player trage intr-un player iar acela care sufera daune are hp-ul sub 35 si nu este mort sa il dea in Injury System si sa cada direct pe jos.

Asta cred ca am facut bine, punand la OnPlayerUpdate:

OnPlayerUpdate{

if(health < 35 && GetPVarInt(playerid, "Dead") == 0)
{
    DoInjured(playerid);
}

}

forward DoInjured(playerid);
public DoInjured(playerid)
{
    new Float:x, Float:y, Float:z;
    ApplyAnimationEx(playerid, "WUZI", "CS_Dead_Guy", 4.0, 0, 1, 1, 1, 0);
    ResetPlayerWeapons(playerid);
    GameTextForPlayer(playerid, "~b~BRUTTALY WOUNDED", 5000, 1);
    SetPlayerHealthEx(playerid,50.0);
    new stringdamage[128];
    new stringdamage2[256];
    GetPlayerPos(playerid, x, y, z);
    format(stringdamage, sizeof(stringdamage), "(( Has been injured %d times, /damages %d for more information. ))", CountDamages(playerid), playerid);
    strcat(stringdamage, stringdamage2);

    PlayerInfo[playerid][pInjuriesText] = CreateDynamic3DTextLabel(stringdamage, COLOR_ERROR, x, y, z, 25.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1, 20.0);
    SetPVarInt(playerid, "Dead", 10);
    return 1;
}

 

 

Iar cand acel player care a tras sa se apropie de cel care e in Injury si trage in el, ala de pe jos sa nu ia damage, cum sa fac asta?

Am facut doar la OnPlayerTakeDamage:

Citat

 

if(GetPVarInt(playerid, "Dead") == 10)
        {
            DestroyDynamic3DTextLabel(PlayerInfo[playerid][pInjuriesText]);

            GetPlayerPos(playerid, x, y, z);

               PlayerInfo[playerid][pInjuriesText] = CreateDynamic3DTextLabel("(( THIS PLAYER IS DEAD ))", COLOR_ERROR, x, y, z, 25.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1, 20.0);
            return 0;
        }

 

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0
Acum 12 ore, valelele a spus:

Am incercat sa fac un Death System ca pe LS:RP.

Gen: cand un player trage intr-un player iar acela care sufera daune are hp-ul sub 35 si nu este mort sa il dea in Injury System si sa cada direct pe jos.

Asta cred ca am facut bine, punand la OnPlayerUpdate:


OnPlayerUpdate{

if(health < 35 && GetPVarInt(playerid, "Dead") == 0)
{
    DoInjured(playerid);
}

}

forward DoInjured(playerid);
public DoInjured(playerid)
{
    new Float:x, Float:y, Float:z;
    ApplyAnimationEx(playerid, "WUZI", "CS_Dead_Guy", 4.0, 0, 1, 1, 1, 0);
    ResetPlayerWeapons(playerid);
    GameTextForPlayer(playerid, "~b~BRUTTALY WOUNDED", 5000, 1);
    SetPlayerHealthEx(playerid,50.0);
    new stringdamage[128];
    new stringdamage2[256];
    GetPlayerPos(playerid, x, y, z);
    format(stringdamage, sizeof(stringdamage), "(( Has been injured %d times, /damages %d for more information. ))", CountDamages(playerid), playerid);
    strcat(stringdamage, stringdamage2);

    PlayerInfo[playerid][pInjuriesText] = CreateDynamic3DTextLabel(stringdamage, COLOR_ERROR, x, y, z, 25.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1, 20.0);
    SetPVarInt(playerid, "Dead", 10);
    return 1;
}

 

 

Iar cand acel player care a tras sa se apropie de cel care e in Injury si trage in el, ala de pe jos sa nu ia damage, cum sa fac asta?

Am facut doar la OnPlayerTakeDamage:

 

Fa o variabila ce o adaugi atunci cand cineva este sub hp-ul in care il baga find "Dead" si dupa te joci cu variabile-le sub OnPlayerGiveDamage este mult mai bine de cat la OnPlayerTakeDamage

Exemplu

new IsAlreadyDead[MAX_PLAYER_NAME]; // Variabila

IsAlreadyDead = 1; // Adaugi unde ar trebui sa il bage in functia DoInjury inainte sau in timp ce o activeaza , nu conteaza

OnPlayerGiveDamage // Te duci frumos la functia asta

// Si bagi asta, nu am testat vezi si tu sper ca ti-am oferit o ideie

new Float:HP;
GetPlayerHealth(playerid, HP);

new HeIsStillAlive = IsAlreadyDead[playerid] == 0;
new HeIsWaitingToDie = IsAlreadyDead[damagedid] == 1;

if(HP < 34 && HeIsStillAlive == HeIsWaitingToDie) amount = 0;

 

Edited by StR_Marian

Ce inseamna cuvantul "Unic" este atunci cand Chestia / Obiectul / Idea / etc... nu exista in alta parte.

Copii, nu mai veniti cu vorbe de "Am gamemode unic", nu exista asa ceva, la ora actuala totul este pe net.

Aveti grija pe cine ajutati, majoritatea sunt caini.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.