[Rijeseno] autorepair na /aduty

Započeo ediss_manga, Mart 07, 2016, 21:49:06 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Detaljan opis problema: • napravio sam sistem kad uzmes /aduty da ti se vozilo popravlja samo i da ti se helti vracaju na 99 ali ne reaguje sve ok kompajluje i udjem uzmem aduti udaram vozilo ali ga ne popravlja nit mi vraca helte pa sad dal trebam dodati nesto ili ??
Skripta koju koristim: SG:RP
Neke slike/video/kod za lakse dobivanje pomoci (npr.slika server.cfg, server log ili slično):
forward Autorepair();
public Autorepair()
{
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(aduty == 1)
    {
       if(PlayerInfo[pAdmin] >= 1)
       {
            new Float:health;
            GetPlayerHealth(i,health);
            if (health < 98.0)
            {
                SetPlayerHealth(i, 99.0);
            }
            new Float:arm;
            GetPlayerArmour(i,arm);
            if (arm < 98.0)
            {
                SetPlayerArmour_H(i, 99.0);
            }

           SetPVarInt(i, "PopravkaVozila", 1);
           new Float:vHealth;
           new vehicleid = GetPlayerVehicleID(i);
           GetVehicleHealth(vehicleid,vHealth);
           if(vHealth < 999)
           {
            RepairVehicle(vehicleid);
            SetVehicleHealth_H(vehicleid, 999.0);
           }
      }
   }
}
   return 1;
}
Poslednja Izmena: April 06, 2016, 17:15:53 POSLE PODNE od Harryâ„¢


YCMD:aduty(playerid, params[],help)
{
    #pragma unused help
    #pragma unused params
    if(UlogovanProvera[playerid] == 0) return SCM(playerid,-1,""SERVERPLAVA"(SGRP) "C_BELA"Moras biti prijavljen.");
   if(PI[playerid][Admin] == 0) return Ovlascenje(playerid);
   if(PI[playerid][TrazeniNivo] >= 1) return Error(playerid, "Ne mozete koristiti ovu komandu jer imate wanted level.");
   if(PI[playerid][Admin] < 6 && PosaoAktivan[playerid] == 1) return Error(playerid, "Radis posao,ne mozes ici duty.");
   if(IgracNaEventu[playerid] == 1) return Error(playerid, "Na eventu si,ne mozes to.");
   if(AdminDuty[playerid] == 0)
   {
       if(PI[playerid][Pol] == 1)
       {
          format(nellys, sizeof(nellys),"{33CCFF}(( {FFFFFF}Admin {33CCFF}%s {FFFFFF}je na duznosti, koristi {33CCFF}/pitaj {FFFFFF}ako mu zelis postaviti pitanje! {33CCFF}))",ImeIgraca(playerid));
         SCMTA(COLOR_GRAD1,nellys);
         SetPlayerSkin(playerid, 294);
         AdminDuty[playerid] = 1;
         SetPlayerColor(playerid, SVETLOPLAVA);
         g_SetPlayerArmour(playerid, 99.0);
         SetPlayerHealth_H(playerid, 99.0);
      }
      else
      {
          format(nellys, sizeof(nellys),"{33CCFF}(( {FFFFFF}Adminka {33CCFF}%s {FFFFFF}je na duznosti, koristi {33CCFF}/pitaj {FFFFFF}ako joj zelis postaviti pitanje! {33CCFF}))",ImeIgraca(playerid));
         SCMTA(COLOR_GRAD1,nellys);
         SetPlayerSkin(playerid, 211);
         AdminDuty[playerid] = 1;
         SetPlayerColor(playerid, SVETLOPLAVA);
         g_SetPlayerArmour(playerid, 99.0);
         SetPlayerHealth_H(playerid, 99.0);
      }
   }
   else if(AdminDuty[playerid] == 1)
   {
        if(PI[playerid][Pol] == 1)
       {
         format(nellys,sizeof(nellys),"{33CCFF}(( {FFFFFF}Admin {33CCFF}%s {FFFFFF}vise nije na duznosti.{33CCFF}))",ImeIgraca(playerid));
         SCMTA(COLOR_GRAD1,nellys);
      }
      else
      {
          format(nellys,sizeof(nellys),"{33CCFF}(( {FFFFFF}Adminka {33CCFF}%s {FFFFFF}vise nije na duznosti.{33CCFF}))",ImeIgraca(playerid));
         SCMTA(COLOR_GRAD1,nellys);
      }
      g_SetPlayerArmour(playerid, 0);
      SetPlayerHealth_H(playerid, 99.0);
      SetPlayerSkin(playerid, PI[playerid][pSkin]);
      SetPlayerColor(playerid,TEAM_HIT_COLOR);
      AdminDuty[playerid] = 0;
   }
   return 1;
}

EVO OVAKO COMPILA SVE OK ALI NE REAGUJE :
forward Autorepair();
public Autorepair()
{
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(AdminDuty == 1)
    {
    if(PI[Admin] > 0)
   {
            new Float:health;
            GetPlayerHealth(i,health);
            if (health < 98.0)
            {
                SetPlayerHealth(i, 99.0);
            }
            new Float:arm;
            GetPlayerArmour(i,arm);
            if (arm < 98.0)
            {
                g_SetPlayerArmour(i, 99.0);
            }

           SetPVarInt(i, "PopravkaVozila", 1);
           new Float:vher;
           new vehicleid = GetPlayerVehicleID(i);
           GetVehicleHealth(vehicleid,vher);
           if(vher < 999)
           {
            RepairVehicle(vehicleid);
            SetVehicleHealth_AC(vehicleid, 999.0);
           }
      }
   }
}
    SetTimer("Autorepair", 1000, true);
   return 1;
}

Dodaj pod public OnGameModeInit()

SetTimer("Autorepair", 1000, true);

komanda /aduty


YCMD:aduty(playerid, params[], help)
{
    #pragma unused help
#pragma unused params
    if(UlogovanProvera[playerid] == 0) return SCM(playerid,-1,""SERVERPLAVA"(SGRP) "C_BELA"Moras biti prijavljen.");
    if(PI[playerid][Admin] == 0) return Ovlascenje(playerid);
    if(PI[playerid][TrazeniNivo] >= 1) return Error(playerid, "Ne mozete koristiti ovu komandu jer imate wanted level.");
    if(PI[playerid][Admin] < 6 && PosaoAktivan[playerid] == 1) return Error(playerid, "Radis posao,ne mozes ici duty.");
    if(IgracNaEventu[playerid] == 1) return Error(playerid, "Na eventu si,ne mozes to.");
new string[256];
if(AdminDuty[playerid] == 0)
{
       if(PI[playerid][Pol] == 1)
       {
          format(nellys, sizeof(nellys),"{33CCFF}(( {FFFFFF}Admin {33CCFF}%s {FFFFFF}je na duznosti, koristi {33CCFF}/pitaj {FFFFFF}ako mu zelis postaviti pitanje! {33CCFF}))",ImeIgraca(playerid));
         SCMTA(COLOR_GRAD1,nellys);
         SetPlayerSkin(playerid, 294);
         AdminDuty[playerid] = 1;
         SetPlayerColor(playerid, SVETLOPLAVA);
         g_SetPlayerArmour(playerid, 99.0);
         SetPlayerHealth_H(playerid, 99.0);
      }
      else
      {
          format(nellys, sizeof(nellys),"{33CCFF}(( {FFFFFF}Adminka {33CCFF}%s {FFFFFF}je na duznosti, koristi {33CCFF}/pitaj {FFFFFF}ako joj zelis postaviti pitanje! {33CCFF}))",ImeIgraca(playerid));
         SCMTA(COLOR_GRAD1,nellys);
         SetPlayerSkin(playerid, 211);
         AdminDuty[playerid] = 1;
         SetPlayerColor(playerid, SVETLOPLAVA);
         g_SetPlayerArmour(playerid, 99.0);
         SetPlayerHealth_H(playerid, 99.0);
      }
}
else if(AdminDuty[playerid] == 1)
{
  if(PI[playerid][Pol] == 1)
      {
         format(nellys,sizeof(nellys),"{33CCFF}(( {FFFFFF}Admin {33CCFF}%s {FFFFFF}vise nije na duznosti.{33CCFF}))",ImeIgraca(playerid));
         SCMTA(COLOR_GRAD1,nellys);
      }
      else
      {
          format(nellys,sizeof(nellys),"{33CCFF}(( {FFFFFF}Adminka {33CCFF}%s {FFFFFF}vise nije na duznosti.{33CCFF}))",ImeIgraca(playerid));
         SCMTA(COLOR_GRAD1,nellys);
      }
      g_SetPlayerArmour(playerid, 0);
      SetPlayerHealth_H(playerid, 99.0);
      SetPlayerSkin(playerid, PI[playerid][pSkin]);
      SetPlayerColor(playerid,TEAM_HIT_COLOR);
      AdminDuty[playerid] = 0;
}
return 1;
}



Public

forward Autorepair();
public Autorepair()
{
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(AdminDuty[i] == 1)
    {
    if(PI[playerid][Admin] >= 1)
    {
            new Float:health;
            GetPlayerHealth(i,health);
            if (health < 98.0)
            {
               SetPlayerHealth(i, 99.0);
            }
            new Float:arm;
            GetPlayerArmour(i,arm);
            if (arm < 98.0)
            {
                SetPlayerArmour(i, 99.0);
            }

        SetPVarInt(i, "PopravkaVozila", 1);
        new Float:vHealth;
        new vehicleid = GetPlayerVehicleID(i);
        GetVehicleHealth(vehicleid,vHealth);
        if(vHealth < 999)
        {
        RepairVehicle(vehicleid);
        }
}
}
}
return 1;
}

Poslednja Izmena: Mart 08, 2016, 00:40:26 PRE PODNE od Ta[G]a

brate mozesli mi pojasnit malo gdje sta tacno da dodam

rjeseno ..hvala vam na pomoci!! moze lock


[/HVALA[/glow]size]