Balkan SA:MP

PAWN skriptanje, gamemodovi, filterskripte, include fajlovi, mape, pluginovi => Razgovor u vezi PAWN - skriptanja => Temu započeo: Neckiy poslato April 16, 2021, 05:32:02 PRE PODNE

Naslov: Pomoc u vezi ProxDetector-a
Poruka od: Neckiy poslato April 16, 2021, 05:32:02 PRE PODNE
Poz, imam problem sa ProxDetectorom. Ja sam ga ispisao ali kada god compilam uvek bude 4 errora za 1 line.

CEO PROXDETECTOR:
[pawn] forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
   if(IsPlayerConnected(playerid))
   {
       new Float:posx, Float:posy, Float:posz;
       new Float:oldposx, Float:oldposy, Float:oldposz;
       new Float:tempposx, Float:tempposy, Float:tempposz;
       GetPlayerPos(playerid, oldposx, oldposy, oldposz);
       foreach(new i = Player)
       {
           if(IsPlayerConnected(i))
           {
               if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
               {
                   GetPlayerPos(i, posx, posy, posz);
                   tempposx = (oldposx - posx);
                   tempposy = (oldposy - posy);
                   tempposz = (oldposz - posz);
                   if(((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
                   {
                       SCM(i, col1, string);
                   }
                   else if(((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
                   {
                       SCM(i,col2,string);
                   }
                   else if(((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
                   {
                       SCM(i,col3,string);
                   }
                   else if(((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && (tempposz < radi/2) && (tempposz > -radi/2)))
                   {
                       SCM(i,col4,string);
                   }
                   else if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && (tempposz < radi) && (tempposz > -radi)))
                   {
                       SCM(i,col5,string);
                   }
               }
           }
       }
   }
   return 1;
} [/pawn]

i problemi su za ovaj line [pawn]foreach(new i = Player)[/pawn]
Naslov: Odg: Pomoc u vezi ProxDetector-a
Poruka od: yeet poslato April 16, 2021, 05:52:46 PRE PODNE


pokusaj ovo [pawn]stock IsPlayerNearPlayer(Float:radi, playerid, targetid)
{
    if( IsPlayerConnected(playerid) && IsPlayerConnected( targetid ) )
   {
       if( GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld( targetid ) )
      {
         new Float:posx, Float:posy, Float:posz,
             Float:oldposx, Float:oldposy, Float:oldposz,
             Float:tempposx, Float:tempposy, Float:tempposz;

         GetPlayerPos( playerid, oldposx, oldposy, oldposz);

         GetPlayerPos(targetid, posx, posy, posz);
         tempposx = (oldposx -posx);
         tempposy = (oldposy -posy);
         tempposz = (oldposz -posz);

         if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
         {
            return 1;
         }
      }
   }
   return 0;
}[/pawn]
Naslov: Odg: Pomoc u vezi ProxDetector-a
Poruka od: fajnydzieciak poslato April 16, 2021, 14:36:43 POSLE PODNE
Citat: Neckiy poslato April 16, 2021, 05:32:02 PRE PODNE
Poz, imam problem sa ProxDetectorom. Ja sam ga ispisao ali kada god compilam uvek bude 4 errora za 1 line.

CEO PROXDETECTOR:
[pawn] forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
   if(IsPlayerConnected(playerid))
   {
       new Float:posx, Float:posy, Float:posz;
       new Float:oldposx, Float:oldposy, Float:oldposz;
       new Float:tempposx, Float:tempposy, Float:tempposz;
       GetPlayerPos(playerid, oldposx, oldposy, oldposz);
       foreach(new i = Player)
       {
           if(IsPlayerConnected(i))
           {
               if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
               {
                   GetPlayerPos(i, posx, posy, posz);
                   tempposx = (oldposx - posx);
                   tempposy = (oldposy - posy);
                   tempposz = (oldposz - posz);
                   if(((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
                   {
                       SCM(i, col1, string);
                   }
                   else if(((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
                   {
                       SCM(i,col2,string);
                   }
                   else if(((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
                   {
                       SCM(i,col3,string);
                   }
                   else if(((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && (tempposz < radi/2) && (tempposz > -radi/2)))
                   {
                       SCM(i,col4,string);
                   }
                   else if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && (tempposz < radi) && (tempposz > -radi)))
                   {
                       SCM(i,col5,string);
                   }
               }
           }
       }
   }
   return 1;
} [/pawn]

i problemi su za ovaj line [pawn]foreach(new i = Player)[/pawn]
Pa ne ide new i = Player nego new i: Player
Naslov: Odg: Pomoc u vezi ProxDetector-a
Poruka od: Neckiy poslato April 17, 2021, 07:42:45 PRE PODNE
Sve je reseno hvala momci!