GTA Közösség - A magyar GTA fórum

San Andreas Multiplayer (SA-MP) => SA-MP: Szerverfejlesztés => Segítségkérés => A témát indította: skyLine - 2012. május 09. - 18:35:44

Cím: /vonszol bug
Írta: skyLine - 2012. május 09. - 18:35:44
Sziasztok
Nem tudja nekem valaki megmondani, hogy miért van az, hogy ha a rendõr beírja /vonszol akkor csak ID 0-t tudja vonszolni.
 
   if(strcmp(cmd, \"/vonszol\", true) == 0) {
        if(IsPlayerConnected(playerid))
    {
            if (PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1)
   {
            new suspect = GetClosestPlayer(playerid);
   if(PlayerCuffed[suspect] < 2)
   {
   SendClientMessage(playerid,COLOR_WHITE,\"A Játékos nincs megbilincselve!\");
   return 1;
   }
       if(IsPlayerConnected(suspect))
      {
          if(GetDistanceBetweenPlayers(giveplayerid,suspect) < 5)
         {
         SendClientMessage(playerid,COLOR_WHITE,\"/nemvonszol ha el akarod engedni!\");
glue_player[playerid] = giveplayerid;
KillTimer(glue_checktmr);
glue_checktmr = SetTimerEx(\"VehicleGlueTimer\",1,1,\"i\",playerid);
} else { SendClientMessage(playerid,COLOR_WHITE,\"Nem vagy elég közel hozzá!\"); }
 }
   } else { SendClientMessage(playerid,COLOR_WHITE,\"Nem vagy rendõr!\"); }
} else { SendClientMessage(playerid,COLOR_WHITE,\"Elõször jelentkezz be!\"); }
return 1;
}
Cím: /vonszol bug
Írta: staubka - 2012. május 09. - 18:38:25
GetClosestPlayer tartalmát pls másold be.
Cím: /vonszol bug
Írta: skyLine - 2012. május 09. - 18:44:18
public GetClosestPlayer(p1)
{
new x,Float:dis,Float:dis2,player;
player = -1;
dis = 99999.99;
for (x=0;x<MAX_PLAYERS;x++)
{
if(IsPlayerConnected(x))
{
   if(x != p1)
   {
      dis2 = GetDistanceBetweenPlayers(x,p1);
      if(dis2 < dis && dis2 != -1.00)
      {
         dis = dis2;
         player = x;
      }
   }
}
}
return player;
}
Cím: /vonszol bug
Írta: staubka - 2012. május 09. - 18:48:46
GetDistanceBetweenPlayers -t is pls, a GetClosestPlayer-el nincs baj..
Cím: /vonszol bug
Írta: skyLine - 2012. május 09. - 18:52:48
public Float:GetDistanceBetweenPlayers(p1,p2)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
{
return -1.00;
}
GetPlayerPos(p1,x1,y1,z1);
GetPlayerPos(p2,x2,y2,z2);
return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
Cím: /vonszol bug
Írta: staubka - 2012. május 09. - 18:58:31
Ez is jó..
A parancsban se nagyon találok hibát így elsõ ránézésre.. Úgyhogy nemtudom..
Cím: /vonszol bug
Írta: ZyZu. - 2012. május 09. - 22:09:48
A GetClosesPlayernel álisd átt erre
 

player = +1;
Cím: /vonszol bug
Írta: staubka - 2012. május 09. - 23:08:56
Idézetet írta: ZyZu date=1336594188\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"21225\" data-ipsquote-contentclass=\"forums_Topic
A GetClosesPlayernel álisd átt erre
 

player = +1;

 

Nekem is megvan a GetClosestPlayer, nekem is player = -1 mégis mûködik..
Cím: /vonszol bug
Írta: skyLine - 2012. május 09. - 18:35:44
Sziasztok
Nem tudja nekem valaki megmondani, hogy miért van az, hogy ha a rendõr beírja /vonszol akkor csak ID 0-t tudja vonszolni.
 
   if(strcmp(cmd, \"/vonszol\", true) == 0) {
        if(IsPlayerConnected(playerid))
    {
            if (PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1)
   {
            new suspect = GetClosestPlayer(playerid);
   if(PlayerCuffed[suspect] < 2)
   {
   SendClientMessage(playerid,COLOR_WHITE,\"A Játékos nincs megbilincselve!\");
   return 1;
   }
       if(IsPlayerConnected(suspect))
      {
          if(GetDistanceBetweenPlayers(giveplayerid,suspect) < 5)
         {
         SendClientMessage(playerid,COLOR_WHITE,\"/nemvonszol ha el akarod engedni!\");
glue_player[playerid] = giveplayerid;
KillTimer(glue_checktmr);
glue_checktmr = SetTimerEx(\"VehicleGlueTimer\",1,1,\"i\",playerid);
} else { SendClientMessage(playerid,COLOR_WHITE,\"Nem vagy elég közel hozzá!\"); }
 }
   } else { SendClientMessage(playerid,COLOR_WHITE,\"Nem vagy rendõr!\"); }
} else { SendClientMessage(playerid,COLOR_WHITE,\"Elõször jelentkezz be!\"); }
return 1;
}
Cím: /vonszol bug
Írta: staubka - 2012. május 09. - 18:38:25
GetClosestPlayer tartalmát pls másold be.
Cím: /vonszol bug
Írta: skyLine - 2012. május 09. - 18:44:18
public GetClosestPlayer(p1)
{
new x,Float:dis,Float:dis2,player;
player = -1;
dis = 99999.99;
for (x=0;x<MAX_PLAYERS;x++)
{
if(IsPlayerConnected(x))
{
   if(x != p1)
   {
      dis2 = GetDistanceBetweenPlayers(x,p1);
      if(dis2 < dis && dis2 != -1.00)
      {
         dis = dis2;
         player = x;
      }
   }
}
}
return player;
}
Cím: /vonszol bug
Írta: staubka - 2012. május 09. - 18:48:46
GetDistanceBetweenPlayers -t is pls, a GetClosestPlayer-el nincs baj..
Cím: /vonszol bug
Írta: skyLine - 2012. május 09. - 18:52:48
public Float:GetDistanceBetweenPlayers(p1,p2)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
{
return -1.00;
}
GetPlayerPos(p1,x1,y1,z1);
GetPlayerPos(p2,x2,y2,z2);
return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
Cím: /vonszol bug
Írta: staubka - 2012. május 09. - 18:58:31
Ez is jó..
A parancsban se nagyon találok hibát így elsõ ránézésre.. Úgyhogy nemtudom..
Cím: /vonszol bug
Írta: ZyZu. - 2012. május 09. - 22:09:48
A GetClosesPlayernel álisd átt erre
 

player = +1;
Cím: /vonszol bug
Írta: staubka - 2012. május 09. - 23:08:56
Idézetet írta: ZyZu date=1336594188\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"21225\" data-ipsquote-contentclass=\"forums_Topic
A GetClosesPlayernel álisd átt erre
 

player = +1;

 

Nekem is megvan a GetClosestPlayer, nekem is player = -1 mégis mûködik..