SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 20/01/2017, 08:07 PM   #1
LuanGamer
Big Clucker
 
Join Date: Oct 2016
Posts: 76
Reputation: 0
Thumbs up Sistema Drop de armas

Boa noite,
Gostaria de saber se há como alterar esse código para que seja bloqueado, que certas armas sejam dropadas, a fim de torná-las exclusivas, segue o código:
PHP Code:
CMD:largararma(playerid)
    {
        if(
GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
        new 
GunID GetPlayerWeapon(playerid);
        new 
GunAmmo GetPlayerAmmo(playerid);
        new 
Float:xFloat:yFloat:z;
        if(
GunID && GunAmmo != 0)
        {
            new 
MAX_OBJ+1;
            for(new 
0MAX_OBJa++)
            {
                if(
dGunData[a][ObjPos][0] == 0.0)
                {
                    
a;
                    break;
                }
            }
            if(
MAX_OBJ) return SendClientMessage(playerid0x33AA3300"Você não pode largar esta arma no momento, tente novamente mais tarde!");

            
RemovePlayerWeapon(playeridGunID);

            
GetPlayerPos(playeridxyz);
            
CreateDroppedGun(GunIDGunAmmoxyz);

            
ApplyAnimation(playerid,"BOMBER","BOM_Plant_2Idle",4.1,0,1,1,0,0);

            new 
buffer[85];

            
format(buffersizeof(buffer), "Você largou um(a) %s."GunNames[dGunData[f][ObjData][0]]);
            
SendClientMessage(playerid0x33AA3300buffer);

            
format(buffersizeof(buffer), "* %s colocou um(a) %s no chão."NomePlayer(playerid), GunNames[dGunData[f][ObjData][0]]);
            
SendClientMessageInRange(30.0playeridbufferCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            
printf("%s"buffer);
        }
        return 
1;
    }

    
CMD:parma(playerid)
    {
        if(
GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
        new 
MAX_OBJ+1;
        for(new 
0MAX_OBJa++)
        {
            if(
IsPlayerInRangeOfPoint(playerid1.8dGunData[a][ObjPos][0], dGunData[a][ObjPos][1], dGunData[a][ObjPos][2]))
            {
                
a;
                break;
            }
        }
        if(
MAX_OBJ) return 1;

        if(
gettime() < GetPVarInt(playerid#VarFlood8))
            
return 1;
        
SetPVarInt(playerid#VarFlood8, gettime()+2);

        
GivePlayerWeapon(playeriddGunData[f][ObjData][0], dGunData[f][ObjData][1]);

        
DestroyDroppedObject(f);

        
ApplyAnimation(playerid,"BOMBER","BOM_Plant_2Idle",4.1,0,1,1,0,0);

        new 
buffer[75];
        
format(buffersizeof(buffer), "Você pegou um(a) %s."GunNames[dGunData[f][ObjData][0]]);
          
SendClientMessage(playerid0x33AA3300buffer);

        
format(buffersizeof(buffer), "* %s pegou um(a) %s do chão."NomePlayer(playerid), GunNames[dGunData[f][ObjData][0]]);
        
SendClientMessageInRange(30.0playeridbufferCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        
printf("%s"buffer);
        if(
dGunData[f][ObjData][0] == 47PlayerInfo[playerid][pExplosivos]++;
          return 
1;
    }

stock CreateDroppedGun(GunIDGunAmmoFloat:gPosXFloat:gPosYFloat:gPosZ)
{
    new 
MAX_OBJ+1;
    for(new 
0MAX_OBJa++)
    {
        if(
dGunData[a][ObjPos][0] == 0.0)
        {
            
a;
            break;
        }
    }
    if(
MAX_OBJ) return;

    
dGunData[f][dropTimer] = gettime() + (30*60);//30 minutos para a arma desaparecer

    
dGunData[f][ObjData][0] = GunID;
    
dGunData[f][ObjData][1] = GunAmmo;
    
dGunData[f][ObjPos][0] = gPosX;
    
dGunData[f][ObjPos][1] = gPosY;
    
dGunData[f][ObjPos][2] = gPosZ;
    
dGunData[f][ObjID] = CreateDynamicObject(GunObjects[GunID], dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]-193.7120.0random(360), -1, -1, -180.0);

    new 
buffer[50];

    
format(buffersizeof buffer"%s",GunNames[dGunData[f][ObjData][0]]);
     
dGunData[f][text3d] = CreateDynamic3DTextLabel(buffer0x9ACD32AAdGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]-115.0INVALID_PLAYER_IDINVALID_VEHICLE_ID0, -1, -1, -180.0);

    return;
}


stock DestroyDroppedObject(dropid)
{
        
DestroyDynamicObject(dGunData[dropid][ObjID]);
        
DestroyDynamic3DTextLabel(dGunData[dropid][text3d]);
        
dGunData[dropid][ObjPos][0] = 0.0;
        
dGunData[dropid][ObjPos][1] = 0.0;
        
dGunData[dropid][ObjPos][2] = 0.0;
        
dGunData[dropid][ObjID] = -1;
        
//dGunData[f][ObjData][0] = 0;
        
dGunData[dropid][ObjData][1] = 0;

        return 
1
}
LuanGamer is offline   Reply With Quote
Old 20/01/2017, 08:24 PM   #2
FallweN
Huge Clucker
 
FallweN's Avatar
 
Join Date: Jan 2014
Location: Search on Google
Posts: 444
Reputation: 98
Default Re: Sistema Drop de armas

Adicione no comando

pawn Code:
if(GunID == 38) return SendClientMessage(playerid, -1, "Você não pode largar esta arma"); //ID 38 = Minigun basta colocar a que deseja
__________________

[Tool/Web/Other]
User Control Panel
[GameMode] The Brasil Drift
FallweN is offline   Reply With Quote
Old 21/01/2017, 01:57 PM   #3
LuanGamer
Big Clucker
 
Join Date: Oct 2016
Posts: 76
Reputation: 0
Default Re: Sistema Drop de armas

Muito obrigado! Funcionou realmente. Só uma última coisa, quando morre as armas as vezes também dropam, estou com dificuldade em achar essa parte quando há o kill, para bloquear lá também.
LuanGamer is offline   Reply With Quote
Old 21/01/2017, 02:18 PM   #4
LuanGamer
Big Clucker
 
Join Date: Oct 2016
Posts: 76
Reputation: 0
Default Re: Sistema Drop de armas

Acredito que seja nessa parte, mas estou com dificuldade em saber on inserir:

que fica dentro de
Code:
stock OnPlayerDeathEx(playerid, killerid, reason)
PHP Code:
new Float:pPosXFloat:pPosYFloat:pPosZ;
    
GetPlayerPos(playeridpPosXpPosYpPosZ);
for(new 
i_slot 0gunammoi_slot != 12i_slot++)
       {
          
GetPlayerWeaponData(playeridi_slotgunammo);
           if(
gun != && ammo != 0)
           {
               if(
TempDropArmasBody[playerid] >= 30)
               {
                   
CreateDroppedGun(gunammopPosX+random(3)-random(3), pPosY+random(3)-random(3), pPosZ);
            }
        }
    } 
LuanGamer is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Pedido] drop de armas kauanmota Português/Portuguese 5 21/02/2015 05:32 PM
[Ajuda] Drop de armas bugado iHarzard Português/Portuguese 3 22/03/2014 08:50 PM
[Pedido] Drop De Armas Ao Morrer R4ndonsG4mers Português/Portuguese 3 07/07/2013 06:46 PM
[Pedido] Alguem passa um sistema de armas por comando /armas ? Obrigado! alexandrepr9 Português/Portuguese 4 14/08/2012 02:35 AM
[Ajuda] Drop de Armas Renan_Sinister Português/Portuguese 4 13/08/2012 01:21 AM


All times are GMT. The time now is 02:11 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.