Balkan SA:MP

PAWN skriptanje, gamemodovi, filterskripte, include fajlovi, mape, pluginovi => Razgovor u vezi PAWN - skriptanja => Temu započeo: .варнинг poslato Jul 03, 2018, 10:02:36 PRE PODNE

Naslov: Damage Informer
Poruka od: .варнинг poslato Jul 03, 2018, 10:02:36 PRE PODNE
Problem(error/warning): Ubacio sam DamageInformer i kada padnem ili tako nesto ne pojavi se td na kom pise koliko sam izgubio hp.
Dio skripte: TD:[pawn]    for(new i; i < MAX_PLAYERS; ++i)
   {
   GiveDamage = TextDrawCreate(171.000000, 388.000000, " ");
   TextDrawAlignment(GiveDamage, 2);
   TextDrawBackgroundColor(GiveDamage, 255);
   TextDrawFont(GiveDamage, 2);
   TextDrawLetterSize(GiveDamage, 0.160000, 0.599999);
   TextDrawColor(GiveDamage, 0x00FF04FF);
   TextDrawSetOutline(GiveDamage, 1);
   TextDrawSetProportional(GiveDamage, 1);
   }

   for(new i; i < MAX_PLAYERS; ++i)
   {
   TakeDamage = TextDrawCreate(440.000000,388.000000, " ");
   TextDrawAlignment(TakeDamage, 2);
   TextDrawBackgroundColor(TakeDamage, 255);
   TextDrawFont(TakeDamage, 2);
   TextDrawLetterSize(TakeDamage, 0.160000, 0.599999);
   TextDrawColor(TakeDamage, 0xE81010FF);
   TextDrawSetOutline(TakeDamage, 1);
   TextDrawSetProportional(TakeDamage, 1);
   }[/pawn]
OnPlayerTake i GiveDamage: [pawn]forward OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid);
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
   new s[20];
   format(s, 20, "+Damage %.0f %", amount, playerid);
   TextDrawSetString(GiveDamage[playerid], s);
   TextDrawShowForPlayer(playerid, GiveDamage[playerid]);
   PlayerPlaySound(playerid,17802,0.0,0.0,0.0);
   SetTimerEx("DestruirTextoDraw", 1000, false, "i", playerid);
   return 1;
}

forward DestruirTextoDraw(playerid);
public DestruirTextoDraw(playerid)
{
   TextDrawHideForPlayer(playerid, GiveDamage[playerid]);
   TextDrawHideForPlayer(playerid, TakeDamage[playerid]);
   return 1;
}
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
   if(issuerid != INVALID_PLAYER_ID)
    {
      if(IgracPolicajac(issuerid))
      {
         if(GetPlayerWeapon(issuerid) == 23)
         {
            new string[512], Float:Poz[3];
            GetPlayerPos(playerid, Poz[0], Poz[1], Poz[2]);
            if(IsPlayerInRangeOfPoint(issuerid, 5.0, Poz[0], Poz[1], Poz[2]))
            {
               if(PlayerInfo[playerid][pTrazeniLevel] == 0) return SCM(issuerid,-1,""PLAVA"( INFO ) "SIVA"Igrac nema Wanted Level!");
               if(IgracPolicajac(playerid)) return SCM(issuerid,-1,""PLAVA"( INFO ) "SIVA"Ne mozes tazovati PD!");
               if(PlayerInfo[issuerid][pRank] == 0) return SCM(issuerid,-1,""PLAVA"( INFO ) "SIVA"Suspendovan si!");
               if(AdminDuty[playerid] == 1) return SCM(issuerid,-1,""PLAVA"( INFO ) "SIVA"Taj igrac je Admin na duznosti!");
               format(string, sizeof(string), "%s puca tazerom na %s-a i pogadja ga.", GetName(issuerid) ,GetName(playerid));
               ProxDetector(20.0, issuerid, string, PROX,PROX,PROX,PROX,PROX);
               JBC_TogglePlayerControllable(playerid, 0); IgracTazovan[playerid] = 1;
               TazerTimer[playerid] = SetTimerEx("TazovanTajmer", 15000, false, "i", playerid);
               OnePlayAnim(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
         }
      }
   }
    new s[20];
   format(s, 20, "-Damage %.0f %.0f", amount, playerid);
   TextDrawSetString(TakeDamage[playerid], s);
   TextDrawShowForPlayer(playerid, TakeDamage[playerid]);
   PlayerPlaySound(playerid,17802,0.0,0.0,0.0);
   SetTimerEx("DestruirTextoDraw", 1000, false, "i", playerid);
   return 1;
   }
   if (weaponid == WEAPON_GRENADE || weaponid == 51)
   {
      new Float:health;
      GetPlayerHealth(playerid, health);
      SetPlayerHealth(playerid, (health - (amount * 0.3)));

      FlashbangStage[playerid] = 1;

      HandleFlashbangStage(playerid);
   }
   return 1;
}[/pawn]
Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log): ///
Slika/video ingame problema(obavezno ako je ingame problem): ///
Naslov: Odg: Damage Informer
Poruka od: bunta poslato Jul 03, 2018, 10:28:36 PRE PODNE
Moja ti je preporuka da koristis weapon-config.inc jer ima i druge benefite... :P
Naslov: Odg: Damage Informer
Poruka od: .варнинг poslato Jul 03, 2018, 14:45:17 POSLE PODNE
Citat: .бунÑ,а poslato Jul 03, 2018, 10:28:36 PRE PODNE
Moja ti je preporuka da koristis weapon-config.inc jer ima i druge benefite... :P
Ubacio sam weapon-config, al mi izbaci error da je OnPlayerTakeDamage vec definisan definisan je u includu i kod mene u skrpi (kod mene je za pd, tazer i to) tkd nzm..
Naslov: Odg: Damage Informer
Poruka od: bunta poslato Jul 03, 2018, 14:48:45 POSLE PODNE
dodaÅ¡ to za tazer za pd ili Å¡ta već  u include?
Naslov: Odg: Damage Informer
Poruka od: Slade poslato Jul 03, 2018, 23:29:32 POSLE PODNE
Pokusaj ovako:

[pawn]public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID)
{
if(IgracPolicajac(issuerid))
{
if(GetPlayerWeapon(issuerid) == 23)
{
new string[512], Float:Poz[3];
GetPlayerPos(playerid, Poz[0], Poz[1], Poz[2]);
if(IsPlayerInRangeOfPoint(issuerid, 5.0, Poz[0], Poz[1], Poz[2]))
{
if(PlayerInfo[playerid][pTrazeniLevel] == 0) return SCM(issuerid,-1,""PLAVA"( INFO ) "SIVA"Igrac nema Wanted Level!");
if(IgracPolicajac(playerid)) return SCM(issuerid,-1,""PLAVA"( INFO ) "SIVA"Ne mozes tazovati PD!");
if(PlayerInfo[issuerid][pRank] == 0) return SCM(issuerid,-1,""PLAVA"( INFO ) "SIVA"Suspendovan si!");
if(AdminDuty[playerid] == 1) return SCM(issuerid,-1,""PLAVA"( INFO ) "SIVA"Taj igrac je Admin na duznosti!");
format(string, sizeof(string), "%s puca tazerom na %s-a i pogadja ga.", GetName(issuerid) ,GetName(playerid));
ProxDetector(20.0, issuerid, string, PROX,PROX,PROX,PROX,PROX);
JBC_TogglePlayerControllable(playerid, 0); IgracTazovan[playerid] = 1;
TazerTimer[playerid] = SetTimerEx("TazovanTajmer", 15000, false, "i", playerid);
OnePlayAnim(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
}
}
}
}
if(amount >= 1) {
   new s[60];
   format(s, 60, "-Damage %.0f", amount);
   TextDrawSetString(TakeDamage[playerid], s);
   TextDrawShowForPlayer(playerid, TakeDamage[playerid]);
   PlayerPlaySound(playerid,17802,0.0,0.0,0.0);
   SetTimerEx("DestruirTextoDraw", 1000, false, "i", playerid);
}
if (weaponid == WEAPON_GRENADE || weaponid == 51)
{
   new Float:health;
   GetPlayerHealth(playerid, health);
   SetPlayerHealth(playerid, (health - (amount * 0.3)));
   FlashbangStage[playerid] = 1;
   HandleFlashbangStage(playerid);
}
return 1;
}[/pawn]
Naslov: Odg: Damage Informer
Poruka od: Terza Lazarevic poslato Jul 04, 2018, 01:10:09 PRE PODNE
Citat: .варнинг poslato Jul 03, 2018, 14:45:17 POSLE PODNE
Ubacio sam weapon-config, al mi izbaci error da je OnPlayerTakeDamage vec definisan definisan je u includu i kod mene u skrpi (kod mene je za pd, tazer i to) tkd nzm..

Kod weapon-configa ti lepo pise da je OnPlayerTakeDamage izbrisan
CitatOnPlayerGiveDamage and OnPlayerTakeDamage are removed. Use OnPlayerDamage (see below).
Naslov: Odg: Damage Informer
Poruka od: bunta poslato Jul 04, 2018, 07:36:53 PRE PODNE
https://github.com/oscar-broman/samp-weapon-config/blob/master/weapon-config.inc

Sta je ovo u include-u?
red 3222 : public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
???