[Ajuda] Sistema Drop de armas
#1

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
}
Reply
#2

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
Reply
#3

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.
Reply
#4

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);
            }
        }
    } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)