[Ajuda] Sistema de laser
#1

bom au quero um sistema de laser na arma se possivel em dialog list tentei retirar de algumas gm aqui no forum mesmo e de algum topico mais sempra da um erro 2 a 8 erros tentei varias gm mais n obtive susseзo sempre faltava algo "!!!! se algum poder postar o codigo obg ou postar um topico que realmente fucione vlw (obs/;quero por dentro da gm pk minha host n esta carregando fs)
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=207732

Estude esse sistema e faзa o em dialog


Exemplo de FS :

pawn Код:
#include <a_samp>
#include <zcmd>

#define DIALOG_LASER 24514

COMMAND:laser(playerid, params[])
{
  ShowPlayerDialog(playerid, DIALOG_LASER, DIALOG_STYLE_LIST, "Laser", "Laser Vermelho\nLaser Verde\nLaser Azul\nEditar Laser\nRemover Laser", "Selecionar", "Fechar");
  return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_LASER)
    {
        if(response)
        {
   
            switch(listitem)
            {
                case 0: SetPlayerAttachedObject(playerid, 1, 18643, 6, 0.100000, 0.029999, 0.079999, 0.000000, -10.000000, 4.000000, 1.000000, 1.000000, 1.000000); // exemplo
                case 1: SetPlayerAttachedObject(playerid, 1, 18643, 6, 0.100000, 0.029999, 0.079999, 0.000000, -10.000000, 4.000000, 1.000000, 1.000000, 1.000000);
                case 2: SetPlayerAttachedObject(playerid, 1, 18643, 6, 0.100000, 0.029999, 0.079999, 0.000000, -10.000000, 4.000000, 1.000000, 1.000000, 1.000000);
                case 3: EditAttachedObject(playerid, 1);
                case 4: RemovePlayerAttachedObject(playerid, 1);
            }
        }
        return 1;
    }
 
    return 0;
}
Obs : Os parametros de SetPlayerAttachedObject estгo todos iguais, fiz apenas para dar um exemplo
Reply
#3

Se fizer igual esta aqui nгo tem erro!

Coloque no topo do GM

PHP код:
#define Ativar 3232 
Coloque na "public OnGameModeInit()"

PHP код:
        print("\n-- Laser Pointer by Skiaffo --\n");
        new 
GetMaxPlayers();
        for (new 
i=0pi++)
        {
                
SetPVarInt(i"laser"0);
                
SetPVarInt(i"color"18643);
        }
        return 
1
Coloque na "public OnGameModeExit()"

PHP код:
        new GetMaxPlayers();
        for (new 
i=0pi++)
        {
                
SetPVarInt(i"laser"0);
                
RemovePlayerAttachedObject(i0);
        }
        return 
1
coloque na "public OnPlayerSpawn(playerid)"

PHP код:
    if (!GetPVarInt(playerid"color")) SetPVarInt(playerid"color"18643); 
Coloque na "public OnPlayerDisconnect"

PHP код:
        SetPVarInt(playerid"laser"0);
        
RemovePlayerAttachedObject(playerid0); 
coloque junto com seus comandos

PHP код:
CMD:laser(playerid)
{
    
ShowPlayerDialog(playeridAtivarDIALOG_STYLE_LIST"Laser""{00ff00}Ligar\n{ff0000}Desligar""OK""SAIR");
    return 
1;

Coloque na "public OnDialogResponse"
PHP код:
    if (dialogid == Ativar)
    {
        if(
response)
        {
            if(
listitem == 0)
            {
                
SetPVarInt(playerid"laser"1);
                
SetPVarInt(playerid"color"GetPVarInt(playerid"color"));
                return 
1;
            }
            if(
listitem == 1)
            {
                
SetPVarInt(playerid"laser"0);
                
RemovePlayerAttachedObject(playerid0);
                return 
1;
            }
        }
        return 
1;
    }
    return 
1;

Coloque na "public OnPlayerUpdate(playerid)"

PHP код:
        if (GetPVarInt(playerid"laser"))
        {
                
RemovePlayerAttachedObject(playerid0);
                if ((
IsPlayerInAnyVehicle(playerid)) || (IsPlayerInWater(playerid))) return 1;
                switch (
GetPlayerWeapon(playerid))
                {
                        case 
23:
                        {
                                if (
IsPlayerAiming(playerid))
                                {
                                        if (
GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                         {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// SP standing aiming
                                                
0.1082490.0302320.1180511.468254350.512573364.284240);
                                        }
                                        else
                                        {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// SP crouched aiming
                                                
0.1082490.0302320.1180511.468254349.862579364.784240);
                                        }
                                }
                                else
                                {
                                        if (
GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                        {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// SP standing not aiming
                                                
0.0782480.0272390.113051, -11.131746350.602722362.384216);
                                        }
                                        else
                                        {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// SP crouched not aiming
                                                
0.0782480.0272390.113051, -11.131746350.602722362.384216);
                        }       }       }
                        case 
27:
                        {
                                if (
IsPlayerAiming(playerid))
                                {
                                        if (
GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                        {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// SPAS standing aiming
                                                
0.588246, -0.0227660.138052, -11.531745347.712585352.784271);
                                        }
                                        else
                                        {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// SPAS crouched aiming
                                                
0.588246, -0.0227660.1380521.468254350.712585352.784271);
                                        }
                                }
                                else
                                {
                                        if (
GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                         {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// SPAS standing not aiming
                                                
0.563249, -0.019760.134051, -11.131746351.602722351.384216);
                                        }
                                        else
                                        {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// SPAS crouched not aiming
                                                
0.563249, -0.019760.134051, -11.131746351.602722351.384216);
                        }       }       }
                        case 
30:
                        {
                                if (
IsPlayerAiming(playerid))
                                {
                                        if (
GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                         {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// AK standing aiming
                                                
0.628249, -0.0277660.078052, -6.621746352.552642355.084289);
                                         }
                                         else
                                         {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// AK crouched aiming
                                                
0.628249, -0.0277660.078052, -1.621746356.202667355.084289);
                                        }
                                }
                                else
                                {
                                        if (
GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                        {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// AK standing not aiming
                                                
0.663249, -0.029760.080051, -11.131746358.302734353.384216);
                                        }
                                         else
                                         {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// AK crouched not aiming
                                                
0.663249, -0.029760.080051, -11.131746358.302734353.384216);
                        }       }       }
                        case 
31:
                        {
                                if (
IsPlayerAiming(playerid))
                                {
                                        if (
GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                         {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// M4 standing aiming
                                                
0.528249, -0.0202660.068052, -6.621746352.552642355.084289);
                                        }
                                        else
                                        {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// M4 crouched aiming
                                                
0.528249, -0.0202660.068052, -1.621746356.202667355.084289);
                                        }
                                 }
                                 else
                                 {
                                        if (
GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                        {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// M4 standing not aiming
                                                
0.503249, -0.023760.065051, -11.131746357.302734354.484222);
                                        }
                                        else
                                        {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// M4 crouched not aiming
                                                
0.503249, -0.023760.065051, -11.131746357.302734354.484222);
                        }       }       }
            case 
34:
            {
                if (
IsPlayerAiming(playerid))
                {
                    
/*if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) {
                        SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper standing aiming
                        0.528249, -0.020266, 0.068052, -6.621746, 352.552642, 355.084289);
                    } else {
                        SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper crouched aiming
                        0.528249, -0.020266, 0.068052, -1.621746, 356.202667, 355.084289);
                    }*/
                    
return 1;
                }
                else
                {
                    if (
GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                    {
                        
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// Sniper standing not aiming
                        
0.658248, -0.032760.133051, -11.631746355.302673353.584259);
                    }
                    else
                    {
                        
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// Sniper crouched not aiming
                        
0.658248, -0.032760.133051, -11.631746355.302673353.584259);
            }    }    }
                        case 
29:
                        {
                                if (
IsPlayerAiming(playerid))
                                 {
                                        if (
GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                        {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// MP5 standing aiming
                                                
0.298249, -0.027760.158052, -11.631746359.302673357.584259);
                                        }
                                        else
                                        {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// MP5 crouched aiming
                                                
0.298249, -0.027760.1580528.368253358.302673352.584259);
                                        }
                                }
                                else
                                {
                                        if (
GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                        {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// MP5 standing not aiming
                                                
0.293249, -0.0277590.195051, -12.131746354.302734352.484222);
                                        }
                                        else
                                        {
                                                
SetPlayerAttachedObject(playerid0GetPVarInt(playerid"color"), 6// MP5 crouched not aiming
                                                
0.293249, -0.0277590.195051, -12.131746354.302734352.484222);
        }       }       }       }       }
        return 
1;

Coloque no final do GM

PHP код:
stock IsPlayerInWater(playerid) {
        new 
anim GetPlayerAnimationIndex(playerid);
        if (((
anim >=  1538) && (anim <= 1542)) || (anim == 1544) || (anim == 1250) || (anim == 1062)) return 1;
        return 
0;
}
stock IsPlayerAiming(playerid)
{
    new 
anim GetPlayerAnimationIndex(playerid);
    if (((
anim >= 1160) && (anim <= 1163)) || (anim == 1167) || (anim == 1365) ||
    (
anim == 1643) || (anim == 1453) || (anim == 220)) return 1;
    return 
0;

Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)