SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Romānă/Romanian

 
 
Thread Tools Display Modes
Old 27/08/2017, 09:48 AM   #1
None1337
Big Clucker
 
Join Date: Aug 2017
Posts: 109
Reputation: 0
Default Problema DMG

Salut, am pus o restrictie atunci cand jucatorul are /freeze nimeni sa nu ii poata lua DMG, insa nu stiu de ce..

Uitati codul meu:

Am pus la OnPlayerGiveDamage
Code:
if(PlayerInfo[damagedid][pFreezeTime] != 0)
        {
            amount = 0;
        }
None1337 is offline  
Old 27/08/2017, 10:29 AM   #2
10MIN
Huge Clucker
 
10MIN's Avatar
 
Join Date: Jun 2017
Location: Clock4ever
Posts: 319
Reputation: 28
Default Re: Problema DMG

Ia incearca asa:
Code:
if(PlayerInfo[damagedid][pFreezeTime] != 0)
{
      new Float:burduf_hp; //ignora numele, ii pus asa ca poate mai ai hp definit pe undeva
      GetPlayerHealth(damagedid,burduf_hp); 
      SetPlayerHealth(damagedid, (burduf_hp + amount ) ); //am pus 2 paranteze ca sa fiu sigur ca iese cum trebuie
}
__________________
**signature**
10MIN is offline  
Old 27/08/2017, 02:47 PM   #3
None1337
Big Clucker
 
Join Date: Aug 2017
Posts: 109
Reputation: 0
Default Re: Problema DMG

E ok merge, insa mai o intrebare. Daca as pune de exemplu la OnPlayerGiveDamage jos de tot ceva de genu
Code:
if(amount == 0)
{
     new hp;
    GetPlayerHealth(playerid, hp);
    SetPlayerHealthEx(playerid,hp);
}
Ar fi ok, ar functiona corect pentru tot publicul OnPlayerGiveDamage?
Spun asta pentru ca am mai multe in cod in care trebuie sa nu primeasca jucatorul dmg..si de aceea as vrea sa fac acest lucru.
None1337 is offline  
Old 27/08/2017, 08:24 PM   #4
10MIN
Huge Clucker
 
10MIN's Avatar
 
Join Date: Jun 2017
Location: Clock4ever
Posts: 319
Reputation: 28
Default Re: Problema DMG

Pai daca amount = 0 (foarte imposibil) nu cred ca OnPlayerGiveDamage ar fi executat...
Cea mai simpla metoda e ca in cealalta postare a mea, poti sa o "expandezi" dupa modelul asta:
Code:
if(god[blabla] || PlayerInfo[blabla][pAdmin] || disabled damage) //Si asa mai departe.....
__________________
**signature**
10MIN is offline  
Old 28/08/2017, 10:04 PM   #5
None1337
Big Clucker
 
Join Date: Aug 2017
Posts: 109
Reputation: 0
Default Re: Problema DMG

Nu prea inteleg.

Cum am zis, eu am ceva de genu

Code:
if(gMember(playerid) == gMember(damageid))
{
     amount = 0;
     return 0;
}
Corect? Ar trebui sa nu ii ia hp. Insa ii IA
Varianta care ai spus-o tu e ok, e buna, insa problema e ca am mai multe din astea cu amount = 0, si ar sta sa faca o gramada de verificari in anumite cazuri, si nu prea as vrea asta.
None1337 is offline  
Old 29/08/2017, 05:55 AM   #6
10MIN
Huge Clucker
 
10MIN's Avatar
 
Join Date: Jun 2017
Location: Clock4ever
Posts: 319
Reputation: 28
Default Re: Problema DMG

Pai poti sa faci if-urile cu multe conditii. De exemplu:
PHP Code:
if(|| || c
Si poti sa le faci pe toate intr-un if. RETINE: Semnul || inseamna "sau" intr-un if...
__________________
**signature**
10MIN is offline  
Old 30/09/2017, 07:14 AM   #7
DimaShift
Banned
 
Join Date: May 2017
Location: Republic of Moldova
Posts: 123
Reputation: 43
Default Re: Problema DMG

OnPlayerTakeDamage e mai bun decit OnPlayerGiveDamage
DimaShift is offline  
Old 04/10/2017, 03:33 PM   #8
KessMan
Big Clucker
 
Join Date: Oct 2016
Posts: 59
Reputation: 0
Default Re: Problema DMG

Varianta corecta pentru aceasta problema este folosirea callback-ului "OnPlayerWeaponShot".
Returneaza cu 0 (return 0 daca vrei sa nu mai primeasca Damage sub nici-o forma. (Exceptii explozie si uciderea de cutit (pe la spate cu Knife))
KessMan is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 06:50 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.