SA-MP Forums Archive
[AJUDA] Cуdigo detector de armas - 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] Cуdigo detector de armas (/showthread.php?tid=309729)



[AJUDA] Cуdigo detector de armas - Kelvin_Cesar - 08.01.2012

Entao, peguei um codigo de detector de metais neste topico:
https://sampforum.blast.hk/showthread.php?tid=210997&page=2 (o cуd. do Rjjj)

PHP код:
//No Topo do GM:
new ArmasDetector[MAX_PLAYERS][14];
new 
ArmasBallasDetector[MAX_PLAYERS][14];
new 
bool:Checado[MAX_PLAYERS];
new 
PlayersOnline;
//No OnGameModeInit:
SetTimer("DetectorMetais"1000true);
//OnPlayerConnect:
PlayersOnline++;
//No OnPlayerDisconnect:
PlayersOnline--;
//No Final do GM:
forward DetectorMetais();
public 
DetectorMetais()
{
    for(new 
0<= PlayersOnlinex++)
    {
        if(
IsPlayerInRangeOfPoint(x2.0100.00200.00350.00))//Troque essas coordenadas pelas da porta !
        
{
            if(
Checado[x])
            {
                
GivePlayerWeapon(playeridweaponidammo);
                
Checado[x] = false;
            }
            if(
GetPlayerWeapon(x) > 0)
            {
                for(new 
013i++)
                {
                    
GetPlayerWeaponData(xiArmasDetector[x][i], ArmasBallasDetector[x][i]);
                    if(
Checado[x])
                    {
                        
GivePlayerWeapon(playeridArmasDetector[x][i], ArmasBallasDetector[x][i]);
                        
SendClientMessage(playerid0xFFFF00AA"[INFO] Suas armas foram devolvidas !");
                    }
                    else
                    {
                        
SendClientMessage(playerid0xFFFF00AA"[INFO] Suas armas foram retiradas pelo detector de metais !");
                        
ResetPlayerWeapons(x);
                        
Checado[x] = true;
                    }
                }
            }
        }
    }
    return 
1;

Mas quando compilo no GM da os seguintes erros:
gmtestes.pwn(88857) : error 017: undefined symbol "playerid"
gmtestes.pwn(88867) : error 017: undefined symbol "playerid"
gmtestes.pwn(88868 ) : error 017: undefined symbol "playerid"
gmtestes.pwn(88872) : error 017: undefined symbol "playerid"

Alguem poderia me ajudar? obrigado


Re: [AJUDA] Cуdigo detector de armas - Adrian Fahrenheit Tepes - 08.01.2012

pawn Код:
//No Topo do GM:


new ArmasDetector[MAX_PLAYERS][14];
new ArmasBallasDetector[MAX_PLAYERS][14];
new bool:Checado[MAX_PLAYERS];
new PlayersOnline;



//No OnGameModeInit:
SetTimer("DetectorMetais", 1000, true);



//OnPlayerConnect:
PlayersOnline++;



//No OnPlayerDisconnect:
PlayersOnline--;



//No Final do GM:
forward DetectorMetais();
public DetectorMetais()
{
    for(new x = 0; x <= PlayersOnline; x++)
    {
        if(IsPlayerInRangeOfPoint(x, 2.0, 100.00, 200.00, 350.00))//Troque essas coordenadas pelas da porta !
        {
            if(Checado[x])
            {
                GivePlayerWeapon(x, weaponid, ammo);
                Checado[x] = false;
            }
            if(GetPlayerWeapon(x) > 0)
            {
                for(new i = 0; i < 13; i++)
                {
                    GetPlayerWeaponData(x, i, ArmasDetector[x][i], ArmasBallasDetector[x][i]);
                    if(Checado[x])
                    {
                        GivePlayerWeapon(x, ArmasDetector[x][i], ArmasBallasDetector[x][i]);
                        SendClientMessage(x, 0xFFFF00AA, "[INFO] Suas armas foram devolvidas !");
                    }
                    else
                    {
                        SendClientMessage(x, 0xFFFF00AA, "[INFO] Suas armas foram retiradas pelo detector de metais !");
                        ResetPlayerWeapons(x);
                        Checado[x] = true;
                    }
                }
            }
        }
    }
    return 1;
}



Re: [AJUDA] Cуdigo detector de armas - Kelvin_Cesar - 08.01.2012

Funcionou, obrigado (eu tive que substituir weaponid e ammo tbm )


Re: [AJUDA] Cуdigo detector de armas - humildadeforever - 08.01.2012

Poe no topo do GM:
pawn Код:
forward DetectorMetais(playerid);
e apaga esse:
pawn Код:
forward DetectorMetais();
e a linha
pawn Код:
public DetectorMetais()
troca por
pawn Код:
public DetectorMetais(playerid)



Re: [AJUDA] Cуdigo detector de armas - Kelvin_Cesar - 08.01.2012

Nossa, muito obrigado, resolveu bem! +rep

Aproveitando o topico, como faзo para verificar se o cara й policial, mas tipo se ele for policial ele nao perder as armas?


Re: [AJUDA] Cуdigo detector de armas - Adrian Fahrenheit Tepes - 08.01.2012

Qual a variбvel que define se o jogador й policial ou nгo?!


Re: [AJUDA] Cуdigo detector de armas - Kelvin_Cesar - 08.01.2012

Quote:

if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
{

Seria isso?


Re: [AJUDA] Cуdigo detector de armas - Kelvin_Cesar - 08.01.2012

Alguem pode me ajudar?