[Ajuda] Problemas com o arrastar
#1

Pessoal eu criei este novo tуpico porque o outro as conversas jб estavam a ser desviadas para outros assuntos...Eu ja nгo tenho erros sу que agora quando eu estou a arrastar ' o criminoso ' ele diz tudo muito certinho... " You are draging **** " so k ele nao arrasta o player, o player apenas fica congelado e n vai atraz do policia. alguem sabe resolver

Код:
if(strcmp(cmd, "/drag", true) == 0)
  {
    if(IsPlayerConnected(playerid))
    {
     if(PlayerInfo[playerid][pAdmin] == 10 || IsACop(playerid))
     {
       tmp = strtok(cmdtext, idx);
      if(!strlen(tmp)) {
        SendClientMessage(playerid, COLOR_WHITE, "SERVER: /drag [Player ID]");
        return 1;
      }
      giveplayerid = ReturnUser(tmp);
       if(IsPlayerConnected(giveplayerid))
      {
        if(giveplayerid != INVALID_PLAYER_ID)
        {
          if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid))
          {
            SendClientMessage(playerid, COLOR_GREY, "  You can't drag Cops !");
            return 1;
          }
          if(DragOff[giveplayerid] > 0)
          {
            SendClientMessage(playerid, COLOR_GREY, "  You Are already being Dragged!");
            return 1;
          }
         if (ProxDetectorS(3.0, playerid, giveplayerid))
         {
               if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You Cannot Drag Yourself!"); return 1; }
             GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
             format(string, sizeof(string), "* You are being dragged by %s,", sendername);
            SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
            format(string, sizeof(string), "* You begin to drag %s,", giveplayer);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            format(string, sizeof(string), "* %s has started to drag %s.", sendername ,giveplayer);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            TogglePlayerControllable(giveplayerid, 0);
            DragOff[giveplayerid] = playerid;
         }
         else
         {
           SendClientMessage(playerid, COLOR_GREY, "  That Player is not near you !");
           return 1;
         }
        }
      }
      else
      {
        SendClientMessage(playerid, COLOR_GREY, "  That player is Offline !");
        return 1;
      }
     }
     else
     {
      SendClientMessage(playerid, COLOR_GREY, "  You are not a Cop / FBI / Navy / National Guard!");
     }
   }
   return 1;
  }
  if(strcmp(cmd, "/stopdrag", true) == 0)
  {
    if(IsPlayerConnected(playerid))
    {
     if(PlayerInfo[playerid][pAdmin] == 10 || IsACop(playerid))
     {
       tmp = strtok(cmdtext, idx);
      if(!strlen(tmp)) {
        SendClientMessage(playerid, COLOR_WHITE, "SERVER: /stopdrag [Player ID]");
        return 1;
      }
      giveplayerid = ReturnUser(tmp);
      if(IsPlayerConnected(giveplayerid))
      {
        if(giveplayerid != INVALID_PLAYER_ID)
        {
          if (ProxDetectorS(3.0, playerid, giveplayerid))
         {
           if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot stop dragging yourself!"); return 1; }
           if(DragOff[giveplayerid] > 0)
           {
             GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
             format(string, sizeof(string), "* %s stopped dragging you.", sendername);
            SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
            format(string, sizeof(string), "* You stopped dragging %s.", giveplayer);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            TogglePlayerControllable(giveplayerid, 1);
            DragOff[giveplayerid] = 0;
           }
           else
           {
             SendClientMessage(playerid, COLOR_GREY, "  That player isn't being dragged !");
             return 1;
           }
         }
         else
         {
           SendClientMessage(playerid, COLOR_GREY, "  That player is not near you !");
           return 1;
         }
        }
      }
      else
      {
        SendClientMessage(playerid, COLOR_GREY, "  That player is Offline !");
        return 1;
      }
     }
     else
     {
      SendClientMessage(playerid, COLOR_GREY, "  You are not a Cop / FBI / Navy / National Guard !");
     }
   }//not connected
   return 1;
  }
Se alguem souber diga =D



OutWorld
Reply
#2

Acho que nгo da pra fazer isto, arrastar o jogador atras do policial.

O maximo possivel й congelar.

Mas me diz uma coisa: Arrastar, que vocк diz, й que ele siga o policial automaticamente ? Sem que ele queira ?
Reply
#3

Ola eu sou o companheiro de servidor no OutWorld.
Й assim nуs no inicio querнamos um sistema que tinha-mos visto em outros servidores mas nгo sabia-mos como se chamava, descobrimos que era Drag.

Arranjamos um sistema de Drag em que o "criminoso" й puxado para dentro do carro.

E agora falta-nos o segundo sistema de Drag que e o de puxar, em que o policia anda e o "criminoso" fica congelado e "agarrado ao policial" ou seja para onde o policial vai o "criminoso vai tambйm".

eu penso que o que falta no codigo e isto:

Код:
if(sendoarrastado[playerid] == 1)
{
new Float:Pos[3];
GetPlayerPos(arrastador[playerid], Pos[0], Pos[1], Pos[2]);
SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
}
agora a nossa questгo й como adequar este codigo ao nosso GM

para relembrar o codigo do drag й:

Код:
if(strcmp(cmd, "/drag", true) == 0)
  {
    if(IsPlayerConnected(playerid))
    {
     if(PlayerInfo[playerid][pAdmin] == 10 || IsACop(playerid))
     {
       tmp = strtok(cmdtext, idx);
      if(!strlen(tmp)) {
        SendClientMessage(playerid, COLOR_WHITE, "SERVER: /drag [Player ID]");
        return 1;
      }
      giveplayerid = ReturnUser(tmp);
       if(IsPlayerConnected(giveplayerid))
      {
        if(giveplayerid != INVALID_PLAYER_ID)
        {
          if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid))
          {
            SendClientMessage(playerid, COLOR_GREY, "  You can't drag Cops !");
            return 1;
          }
          if(DragOff[giveplayerid] > 0)
          {
            SendClientMessage(playerid, COLOR_GREY, "  You Are already being Dragged!");
            return 1;
          }
         if (ProxDetectorS(3.0, playerid, giveplayerid))
         {
               if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You Cannot Drag Yourself!"); return 1; }
             GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
             format(string, sizeof(string), "* You are being dragged by %s,", sendername);
            SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
            format(string, sizeof(string), "* You begin to drag %s,", giveplayer);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            format(string, sizeof(string), "* %s has started to drag %s.", sendername ,giveplayer);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            TogglePlayerControllable(giveplayerid, 0);
            DragOff[giveplayerid] = playerid;
         }
         else
         {
           SendClientMessage(playerid, COLOR_GREY, "  That Player is not near you !");
           return 1;
         }
        }
      }
      else
      {
        SendClientMessage(playerid, COLOR_GREY, "  That player is Offline !");
        return 1;
      }
     }
     else
     {
      SendClientMessage(playerid, COLOR_GREY, "  You are not a Cop / FBI / Navy / National Guard!");
     }
   }
   return 1;
  }
  if(strcmp(cmd, "/stopdrag", true) == 0)
  {
    if(IsPlayerConnected(playerid))
    {
     if(PlayerInfo[playerid][pAdmin] == 10 || IsACop(playerid))
     {
       tmp = strtok(cmdtext, idx);
      if(!strlen(tmp)) {
        SendClientMessage(playerid, COLOR_WHITE, "SERVER: /stopdrag [Player ID]");
        return 1;
      }
      giveplayerid = ReturnUser(tmp);
      if(IsPlayerConnected(giveplayerid))
      {
        if(giveplayerid != INVALID_PLAYER_ID)
        {
          if (ProxDetectorS(3.0, playerid, giveplayerid))
         {
           if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot stop dragging yourself!"); return 1; }
           if(DragOff[giveplayerid] > 0)
           {
             GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
             format(string, sizeof(string), "* %s stopped dragging you.", sendername);
            SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
            format(string, sizeof(string), "* You stopped dragging %s.", giveplayer);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            TogglePlayerControllable(giveplayerid, 1);
            DragOff[giveplayerid] = 0;
           }
           else
           {
             SendClientMessage(playerid, COLOR_GREY, "  That player isn't being dragged !");
             return 1;
           }
         }
         else
         {
           SendClientMessage(playerid, COLOR_GREY, "  That player is not near you !");
           return 1;
         }
        }
      }
      else
      {
        SendClientMessage(playerid, COLOR_GREY, "  That player is Offline !");
        return 1;
      }
     }
     else
     {
      SendClientMessage(playerid, COLOR_GREY, "  You are not a Cop / FBI / Navy / National Guard !");
     }
   }//not connected
   return 1;
  }
Reply
#4

Era sу uma questгo de lуgica ...
PHP код:
//OnGameModeInit
SetTimer("jArrastar"1000true);


//fim
forward jArrastar();
public 
jArrastar()
{
    for(new 
0MAX_PLAYERS; ++i)
    {
        if(
sendoarrastado[i] == 1)
        {
            new 
Float:Pos[3];
            
GetPlayerPos(arrastador[i], Pos[0], Pos[1], Pos[2]);
            
SetPlayerPos(playeridPos[0], Pos[1], Pos[2]);
        }
    }
}



if(
strcmp(cmd"/drag"true) == 0)
  {
    if(
IsPlayerConnected(playerid))
    {
     if(
PlayerInfo[playerid][pAdmin] == 10 || IsACop(playerid))
     {
       
tmp strtok(cmdtextidx);
      if(!
strlen(tmp)) {
        
SendClientMessage(playeridCOLOR_WHITE"SERVER: /drag [Player ID]");
        return 
1;
      }
      
giveplayerid ReturnUser(tmp);
       if(
IsPlayerConnected(giveplayerid))
      {
        if(
giveplayerid != INVALID_PLAYER_ID)
        {
          if(
gTeam[giveplayerid] == || IsACop(giveplayerid))
          {
            
SendClientMessage(playeridCOLOR_GREY"  You can't drag Cops !");
            return 
1;
          }
          if(
DragOff[giveplayerid] > 0)
          {
            
SendClientMessage(playeridCOLOR_GREY"  You Are already being Dragged!");
            return 
1;
          }
         if (
ProxDetectorS(3.0playeridgiveplayerid))
         {
               if(
giveplayerid == playerid) { SendClientMessage(playeridCOLOR_GREY"You Cannot Drag Yourself!"); return 1; }
             
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
            
GetPlayerName(playeridsendernamesizeof(sendername));
             
format(stringsizeof(string), "* You are being dragged by %s,"sendername);
            
SendClientMessage(giveplayeridCOLOR_LIGHTBLUEstring);
            
format(stringsizeof(string), "* You begin to drag %s,"giveplayer);
            
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
            
format(stringsizeof(string), "* %s has started to drag %s."sendername ,giveplayer);
            
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            
TogglePlayerControllable(giveplayerid0);
            
DragOff[giveplayerid] = playerid;
            
sendoarrastado[giveplayerid] = 1;
            
arrastador[giveplayerid] = playerid;
         }
         else
         {
           
SendClientMessage(playeridCOLOR_GREY"  That Player is not near you !");
           return 
1;
         }
        }
      }
      else
      {
        
SendClientMessage(playeridCOLOR_GREY"  That player is Offline !");
        return 
1;
      }
     }
     else
     {
      
SendClientMessage(playeridCOLOR_GREY"  You are not a Cop / FBI / Navy / National Guard!");
     }
   }
   return 
1;
  }
  if(
strcmp(cmd"/stopdrag"true) == 0)
  {
    if(
IsPlayerConnected(playerid))
    {
     if(
PlayerInfo[playerid][pAdmin] == 10 || IsACop(playerid))
     {
       
tmp strtok(cmdtextidx);
      if(!
strlen(tmp)) {
        
SendClientMessage(playeridCOLOR_WHITE"SERVER: /stopdrag [Player ID]");
        return 
1;
      }
      
giveplayerid ReturnUser(tmp);
      if(
IsPlayerConnected(giveplayerid))
      {
        if(
giveplayerid != INVALID_PLAYER_ID)
        {
          if (
ProxDetectorS(3.0playeridgiveplayerid))
         {
           if(
giveplayerid == playerid) { SendClientMessage(playeridCOLOR_GREY"You cannot stop dragging yourself!"); return 1; }
           if(
DragOff[giveplayerid] > 0)
           {
             
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
            
GetPlayerName(playeridsendernamesizeof(sendername));
             
format(stringsizeof(string), "* %s stopped dragging you."sendername);
            
SendClientMessage(giveplayeridCOLOR_LIGHTBLUEstring);
            
format(stringsizeof(string), "* You stopped dragging %s."giveplayer);
            
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
            
TogglePlayerControllable(giveplayerid1);
            
DragOff[giveplayerid] = 0;
            
sendoarrastado[giveplayerid] = 0;
            
arrastador[giveplayerid] = INVALID_PLAYER_ID;
           }
           else
           {
             
SendClientMessage(playeridCOLOR_GREY"  That player isn't being dragged !");
             return 
1;
           }
         }
         else
         {
           
SendClientMessage(playeridCOLOR_GREY"  That player is not near you !");
           return 
1;
         }
        }
      }
      else
      {
        
SendClientMessage(playeridCOLOR_GREY"  That player is Offline !");
        return 
1;
      }
     }
     else
     {
      
SendClientMessage(playeridCOLOR_GREY"  You are not a Cop / FBI / Navy / National Guard !");
     }
   }
//not connected
   
return 1;
  } 
Abraзos..
Reply
#5

Muito obrigado pela ajuda mas nгo funcionou:

Код:
D:\Documents and Settings\Joгo Lourenзo\Ambiente de trabalho\7846523\server\gamemodes\Generation_Role_Play.pwn(40331) : error 029: invalid expression, assumed zero
D:\Documents and Settings\Joгo Lourenзo\Ambiente de trabalho\7846523\server\gamemodes\Generation_Role_Play.pwn(40331) : error 017: undefined symbol "jArrastar"
D:\Documents and Settings\Joгo Lourenзo\Ambiente de trabalho\7846523\server\gamemodes\Generation_Role_Play.pwn(40332) : error 029: invalid expression, assumed zero
D:\Documents and Settings\Joгo Lourenзo\Ambiente de trabalho\7846523\server\gamemodes\Generation_Role_Play.pwn(40332) : error 017: undefined symbol "jArrastar"
D:\Documents and Settings\Joгo Lourenзo\Ambiente de trabalho\7846523\server\gamemodes\Generation_Role_Play.pwn(40466) : warning 219: local variable "tmp" shadows a variable at a preceding level
D:\Documents and Settings\Joгo Lourenзo\Ambiente de trabalho\7846523\server\gamemodes\Generation_Role_Play.pwn(40488) : warning 213: tag mismatch
D:\Documents and Settings\Joгo Lourenзo\Ambiente de trabalho\7846523\server\gamemodes\Generation_Role_Play.pwn(40518) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#6

Vey Tudo Que Seja
pawn Код:
undefined symbol
Deve Criar Uma Variavel, Public Ou Stock
pawn Код:
//Variavel Simples
new Exemplo;
//Variavel Que Seja Algo Para Um Player
new Exemplo[MAX_PLAYERS];//Nesta Vocк Pode Usar Exemplo[playerid] = Valor; Ou If Exemplo[playerid] == valor
//Publics
//Primeiro Cria Forward
forward Exemplo();
//Depois A Public
public Exempo()
{
    return 1;
}
Nesse Caso Vocк Deve Colocar Isto
pawn Код:
//Forward
forward jArrastar();
//Public
public jArrastar()
{
    for(new i = 0; i < MAX_PLAYERS; ++i)
    {
        if(sendoarrastado[i] == 1)
        {
            //Isto Vai Fazer Com Que Aquele Settimer La Emcima Arraste e Atualize De 1 Em 1 Segundo
            new Float:Pos[3];
            GetPlayerPos(arrastador[i], Pos[0], Pos[1], Pos[2]);
            SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
        }
    }
}
Reply
#7

ok obrigado pela ajuda resolveu algumas coisas mas ainda nгo esta:

ERROS:
Quote:

Generation_Role_Play.pwn(40332) : error 029: invalid expression, assumed zero
Generation_Role_Play.pwn(40332) : error 004: function "jArrastar" is not implemented
Generation_Role_Play.pwn(40467) : warning 219: local variable "tmp" shadows a variable at a preceding level
Generation_Role_Play.pwn(40489) : warning 213: tag mismatch
Generation_Role_Play.pwn(40519) : warning 215: expression has no effect
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

Reply
#8

pawn Код:
forward jArrastar(playerid);
public jArrastar(playerid)
{
    for(new i = 0; i < MAX_PLAYERS; ++i)
    {
        if(sendoarrastado[i] == 1)
        {
            new Float:Pos[3];
            GetPlayerPos(arrastador[i], Pos[0], Pos[1], Pos[2]);
            SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
        }
    }
}
Reply
#9

os 2 erros persistem
Reply
#10

Usa stock no lugar de public e forward

pawn Код:
stock jArrastar() // Se nгo pegar colocar 'playerid'
{
    for(new i = 0; i < MAX_PLAYERS; ++i)
    {
        if(sendoarrastado[i] == 1)
        {
            //Isto Vai Fazer Com Que Aquele Settimer La Emcima Arraste e Atualize De 1 Em 1 Segundo
            new Float:Pos[3];
            GetPlayerPos(arrastador[i], Pos[0], Pos[1], Pos[2]);
            SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
        }
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)