SA-MP Forums Archive
[Ajuda] Gunrack - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Gunrack (/showthread.php?tid=602307)



Gunrack - FernandoDutra - 05.03.2016

Oi pessoal, entгo, estou fazendo um gunrack, porйm estou tendo um problema, ele estб colocando a arma no mesmo, porйm nгo estб pegando.

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == Gunrack)
    {
        new 
gunid GetPlayerWeapon(playerid);
        new 
ammo GetPlayerAmmo(playerid);
        new 
GetPlayerVehicleID(playerid);
        if (
response)
        {
            if(
listitem == && gunid != 0)
            {
                   if(
GunRackInfo[i][gWeapon1] != 0)
                   {
                      
SendClientMessage(playeridCOLOR_ERROR"Jб existe uma arma no slot selecionado.");
                      return 
1;
                   }
                   if(
gunid == 0)
                   {
                      
SendClientMessage(playeridCOLOR_ERROR"Escolha sua arma que deseja colocar no gunrack.");
                        return 
1;
                   }
                   
GunRackInfo[i][gWeapon1] = gunid;
                    
GunRackInfo[i][gAmmo1] = ammo;
                   
RemovePlayerWeapon(playeridgunid);
                   
SendClientMessage(playerid,COLOR_WHITE"Vocк colocou sua arma no gunrack.");
              }
            if(
listitem == 1)
            {
                   
GunRackInfo[i][gWeapon1] = gunid;
                   
GunRackInfo[i][gAmmo1] = ammo;
                   
SendClientMessage(playerid,COLOR_WHITE"Vocк pegou sua arma mo gunrack.");
                   
GivePlayerWeapon(playeridGunRackInfo[i][gWeapon1], GunRackInfo[i][gAmmo1]);
                   return 
1;
            }
        }
    }
    return 
0;

Aonde estб o erro?

PS: listitem 0 = Colocar | listitem 1 = Pegar


Re: Gunrack - rhaegartargaryen - 05.03.2016

Testa e ve se funciona

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == Gunrack)
    {
        new 
gunid GetPlayerWeapon(playerid);
        new 
ammo GetPlayerAmmo(playerid);
        new 
GetPlayerVehicleID(playerid);
        new 
armaid;
        new 
valormunicao;
        if (
response)
        {
            if(
listitem == && gunid != 0)
            {
                   if(
GunRackInfo[i][gWeapon1] != 0)
                   {
                      
SendClientMessage(playeridCOLOR_ERROR"Jб existe uma arma no slot selecionado.");
                      return 
1;
                   }
                   if(
gunid == 0)
                   {
                      
SendClientMessage(playeridCOLOR_ERROR"Escolha sua arma que deseja colocar no gunrack.");
                        return 
1;
                   }
                   
GunRackInfo[i][gWeapon1] = gunid;
                   
GunRackInfo[i][gAmmo1] = ammo;
                   
RemovePlayerWeapon(playeridgunid);
                   
SendClientMessage(playerid,COLOR_WHITE"Vocк colocou sua arma no gunrack.");
              }
            if(
listitem == 1)
            {
                   
armaid GunRackInfo[i][gWeapon1];
                   
valormunicao GunRackInfo[i][gAmmo1];
                   
SendClientMessage(playerid,COLOR_WHITE"Vocк pegou sua arma mo gunrack.");
                   
GivePlayerWeapon(playeridarmaidvalormunicao);
                   return 
1;
            }
        }
    }
    return 
0;




Re: Gunrack - FernandoDutra - 05.03.2016

Quote:
Originally Posted by rhaegartargaryen
Посмотреть сообщение
Testa e ve se funciona

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == Gunrack)
    {
        new 
gunid GetPlayerWeapon(playerid);
        new 
ammo GetPlayerAmmo(playerid);
        new 
GetPlayerVehicleID(playerid);
        new 
armaid;
        new 
valormunicao;
        if (
response)
        {
            if(
listitem == && gunid != 0)
            {
                   if(
GunRackInfo[i][gWeapon1] != 0)
                   {
                      
SendClientMessage(playeridCOLOR_ERROR"Jб existe uma arma no slot selecionado.");
                      return 
1;
                   }
                   if(
gunid == 0)
                   {
                      
SendClientMessage(playeridCOLOR_ERROR"Escolha sua arma que deseja colocar no gunrack.");
                        return 
1;
                   }
                   
GunRackInfo[i][gWeapon1] = gunid;
                   
GunRackInfo[i][gAmmo1] = ammo;
                   
RemovePlayerWeapon(playeridgunid);
                   
SendClientMessage(playerid,COLOR_WHITE"Vocк colocou sua arma no gunrack.");
              }
            if(
listitem == 1)
            {
                   
armaid GunRackInfo[i][gWeapon1];
                   
valormunicao GunRackInfo[i][gAmmo1];
                   
SendClientMessage(playerid,COLOR_WHITE"Vocк pegou sua arma mo gunrack.");
                   
GivePlayerWeapon(playeridarmaidvalormunicao);
                   return 
1;
            }
        }
    }
    return 
0;

n funfo


Re: Gunrack - KinX - 05.03.2016

Teste isso :

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == Gunrack)
    {
        new 
gunid[MAX_PLAYERS] = GetPlayerWeapon(playerid);
        new 
ammo[MAX_PLAYERS] = GetPlayerAmmo(playerid);
        new 
GetPlayerVehicleID(playerid);
        if (
response)
        {
            if(
listitem == && gunid != 0)
            {
                   if(
GunRackInfo[i][gWeapon1] != 0)
                   {
                      
SendClientMessage(playeridCOLOR_ERROR"Jб existe uma arma no slot selecionado.");
                      return 
1;
                   }
                   if(
gunid == 0)
                   {
                      
SendClientMessage(playeridCOLOR_ERROR"Escolha sua arma que deseja colocar no gunrack.");
                        return 
1;
                   }
                   
GunRackInfo[i][gWeapon1] = gunid[playerid];
                    
GunRackInfo[i][gAmmo1] = ammo[playerid];
                   
RemovePlayerWeapon(playeridgunid);
                   
SendClientMessage(playerid,COLOR_WHITE"Vocк colocou sua arma no gunrack.");
              }
            if(
listitem == 1)
            {
                   
SendClientMessage(playerid,COLOR_WHITE"Vocк pegou sua arma mo gunrack.");
                   
GivePlayerWeapon(playeridgunid[playerid], ammo[playerid]);
                   return 
1;
            }
        }
    }
    return 
0;




Re: Gunrack - FernandoDutra - 05.03.2016

Quote:
Originally Posted by KinX
Посмотреть сообщение
Teste isso :

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == Gunrack)
    {
        new 
gunid[MAX_PLAYERS] = GetPlayerWeapon(playerid);
        new 
ammo[MAX_PLAYERS] = GetPlayerAmmo(playerid);
        new 
GetPlayerVehicleID(playerid);
        if (
response)
        {
            if(
listitem == && gunid != 0)
            {
                   if(
GunRackInfo[i][gWeapon1] != 0)
                   {
                      
SendClientMessage(playeridCOLOR_ERROR"Jб existe uma arma no slot selecionado.");
                      return 
1;
                   }
                   if(
gunid == 0)
                   {
                      
SendClientMessage(playeridCOLOR_ERROR"Escolha sua arma que deseja colocar no gunrack.");
                        return 
1;
                   }
                   
GunRackInfo[i][gWeapon1] = gunid[playerid];
                    
GunRackInfo[i][gAmmo1] = ammo[playerid];
                   
RemovePlayerWeapon(playeridgunid);
                   
SendClientMessage(playerid,COLOR_WHITE"Vocк colocou sua arma no gunrack.");
              }
            if(
listitem == 1)
            {
                   
SendClientMessage(playerid,COLOR_WHITE"Vocк pegou sua arma mo gunrack.");
                   
GivePlayerWeapon(playeridgunid[playerid], ammo[playerid]);
                   return 
1;
            }
        }
    }
    return 
0;

tб dando uns erros vei. '-'

C:\SAMP\gamemodes\Scripts.pwn(310) : error 008: must be a constant expression; assumed zero
C:\SAMP\gamemodes\Scripts.pwn(311) : error 008: must be a constant expression; assumed zero
C:\SAMP\gamemodes\Scripts.pwn(316) : error 033: array must be indexed (variable "gunid")
C:\SAMP\gamemodes\Scripts.pwn(323) : error 033: array must be indexed (variable "gunid")
C:\SAMP\gamemodes\Scripts.pwn(330) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


Re: Gunrack - KinX - 05.03.2016

hmmm. tenta isso entao


PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == Gunrack)
    {
        new 
gunid GetPlayerWeapon(playerid);
        new 
ammo GetPlayerAmmo(playerid);
        new 
GetPlayerVehicleID(playerid);
        if (
response)
        {
            if(
listitem == && gunid != 0)
            {
                   if(
GunRackInfo[i][gWeapon1] != 0)
                   {
                      
SendClientMessage(playeridCOLOR_ERROR"Jб existe uma arma no slot selecionado.");
                      return 
1;
                   }
                   if(
gunid == 0)
                   {
                      
SendClientMessage(playeridCOLOR_ERROR"Escolha sua arma que deseja colocar no gunrack.");
                        return 
1;
                   }
                   
GunRackInfo[i][gWeapon1] = gunid;
                    
GunRackInfo[i][gAmmo1] = ammo;
                   
RemovePlayerWeapon(playeridgunid);
                   
SendClientMessage(playerid,COLOR_WHITE"Vocк colocou sua arma no gunrack.");
              }
            if(
listitem == 1)
            {
                   
SendClientMessage(playerid,COLOR_WHITE"Vocк pegou sua arma mo gunrack.");
                   
GivePlayerWeapon(playeridgunidammo);
                   return 
1;
            }
        }
    }
    return 
0;




Re: Gunrack - FernandoDutra - 05.03.2016

Quote:
Originally Posted by KinX
Посмотреть сообщение
hmmm. tenta isso entao


PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == Gunrack)
    {
        new 
gunid GetPlayerWeapon(playerid);
        new 
ammo GetPlayerAmmo(playerid);
        new 
GetPlayerVehicleID(playerid);
        if (
response)
        {
            if(
listitem == && gunid != 0)
            {
                   if(
GunRackInfo[i][gWeapon1] != 0)
                   {
                      
SendClientMessage(playeridCOLOR_ERROR"Jб existe uma arma no slot selecionado.");
                      return 
1;
                   }
                   if(
gunid == 0)
                   {
                      
SendClientMessage(playeridCOLOR_ERROR"Escolha sua arma que deseja colocar no gunrack.");
                        return 
1;
                   }
                   
GunRackInfo[i][gWeapon1] = gunid;
                    
GunRackInfo[i][gAmmo1] = ammo;
                   
RemovePlayerWeapon(playeridgunid);
                   
SendClientMessage(playerid,COLOR_WHITE"Vocк colocou sua arma no gunrack.");
              }
            if(
listitem == 1)
            {
                   
SendClientMessage(playerid,COLOR_WHITE"Vocк pegou sua arma mo gunrack.");
                   
GivePlayerWeapon(playeridgunidammo);
                   return 
1;
            }
        }
    }
    return 
0;

ainda nгo tб setando a arma pro player..


Re: Gunrack - rhaegartargaryen - 05.03.2016

Tenta desse Jeito
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[]) 

    if(
dialogid == Gunrack
    { 
        new 
gunid GetPlayerWeapon(playerid); 
        new 
ammo GetPlayerAmmo(playerid); 
        new 
GetPlayerVehicleID(playerid); 
        if (
response
        { 
            if(
listitem == && gunid != 0
            { 
                   if(
GunRackInfo[i][gWeapon1] != 0
                   { 
                      
SendClientMessage(playeridCOLOR_ERROR"Jб existe uma arma no slot selecionado."); 
                      return 
1
                   } 
                   if(
gunid == 0
                   { 
                      
SendClientMessage(playeridCOLOR_ERROR"Escolha sua arma que deseja colocar no gunrack."); 
                        return 
1
                   } 
                   
GunRackInfo[i][gWeapon1] = gunid
                   
GunRackInfo[i][gAmmo1] = ammo
                   
RemovePlayerWeapon(playeridgunid); 
                   
SendClientMessage(playerid,COLOR_WHITE"Vocк colocou sua arma no gunrack."); 
              } 
            if(
listitem == 1
            { 
                   new 
armaid GunRackInfo[i][gWeapon1]; 
                   new 
valormunicao GunRackInfo[i][gAmmo1]; 
                   
SendClientMessage(playerid,COLOR_WHITE"Vocк pegou sua arma mo gunrack."); 
                   
GivePlayerWeapon(playeridarmaidvalormunicao); 
                   return 
1
            } 
        } 
    } 
    return 
0




Re: Gunrack - FernandoDutra - 05.03.2016

Quote:
Originally Posted by rhaegartargaryen
Посмотреть сообщение
Tenta desse Jeito
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[]) 

    if(
dialogid == Gunrack
    { 
        new 
gunid GetPlayerWeapon(playerid); 
        new 
ammo GetPlayerAmmo(playerid); 
        new 
GetPlayerVehicleID(playerid); 
        if (
response
        { 
            if(
listitem == && gunid != 0
            { 
                   if(
GunRackInfo[i][gWeapon1] != 0
                   { 
                      
SendClientMessage(playeridCOLOR_ERROR"Jб existe uma arma no slot selecionado."); 
                      return 
1
                   } 
                   if(
gunid == 0
                   { 
                      
SendClientMessage(playeridCOLOR_ERROR"Escolha sua arma que deseja colocar no gunrack."); 
                        return 
1
                   } 
                   
GunRackInfo[i][gWeapon1] = gunid
                   
GunRackInfo[i][gAmmo1] = ammo
                   
RemovePlayerWeapon(playeridgunid); 
                   
SendClientMessage(playerid,COLOR_WHITE"Vocк colocou sua arma no gunrack."); 
              } 
            if(
listitem == 1
            { 
                   new 
armaid GunRackInfo[i][gWeapon1]; 
                   new 
valormunicao GunRackInfo[i][gAmmo1]; 
                   
SendClientMessage(playerid,COLOR_WHITE"Vocк pegou sua arma mo gunrack."); 
                   
GivePlayerWeapon(playeridarmaidvalormunicao); 
                   return 
1
            } 
        } 
    } 
    return 
0

C:\SAMP\gamemodes\Scripts.pwn(335) : error 017: undefined symbol "armaid"
C:\SAMP\gamemodes\Scripts.pwn(337) : warning 204: symbol is assigned a value that is never used: "municao"
C:\SAMP\gamemodes\Scripts.pwn(336) : warning 204: symbol is assigned a value that is never used: "armaid"


Re: Gunrack - Artista - 05.03.2016

Cada veнculo tem um gun rack, й isso? Se sim, vocк guarda a arma no gun rack estando dentro do veнculo e retira quando estб fora dele? Talvez o erro possa estб aн...

Descreva o seu sistema para que a gente possa entender melhor.