weapon drop
#1

PHP код:
    for(new 0MAX_PICKUPSi++) {
        if(
pickupid == DropInfo[i][ID] && DropInfo[i][ID] != -1) {
             
SetTimerEx("Health_Timer"10000false"i"playerid);
            if(
DropInfo[i][Type] == 1) {
                new 
FloatHP;
                
GetPlayerHealth(playeridHP);
                if(
HP 90SetPlayerHealth(playeridHP+10);
                else 
SetPlayerHealth(playerid100);
            }
            else {
                 new 
gunname[32];
                
GetWeaponName(DropInfo[i][Weapon], gunnamesizeof(gunname));
                
GivePlayerWeapon(playeridDropInfo[i][Weapon], DropInfo[i][Ammo]);
            }
            
DestroyPickup(DropInfo[i][ID]);
            
Delete3DTextLabel(DropInfo[i][Label]);
            
DropInfo[i][Type] = 0;
            
DropInfo[i][ID] = -1;
        }
    } 
PHP код:
function ResetPickups() {
    for(new 
0MAX_PICKUPSi++) {
        if(
DropInfo[i][ID] != -1DropInfo[i][ID] = -1;
    }
    return 
1;
}
function 
DestroyPickups() {
    for(new 
0MAX_PICKUPSi++) {
        if(
DropInfo[i][ID] != -1) {
            
DestroyPickup(DropInfo[i][ID]);
            
DropInfo[i][Type] = 0;
            
DropInfo[i][ID] = -1;
        }
    }
    return 
1;
}
function 
drop_player_weapons(playeridtype) {
    new 
FloatPos[3], gunname[32], sweapon,sammoiddresult;
    
GetPlayerPos(playeridPos[0], Pos[1], Pos[2]);
    for(new 
012i++) {
        
GetPlayerWeaponData(playeridisweaponsammo);
        if(
sweapon != 0) {
            
result++;
            
idd CheckIDEmpty();
            
DropInfo[idd][ID] = CreatePickup(WeaponObject(sweapon), 23Pos[0]+resultPos[1]+2Pos[2], -1);
            
DropInfo[idd][Type] =  0;
            
DropInfo[idd][Weapon] = sweapon;
            
DropInfo[idd][Ammo] = sammo;
            
GetWeaponName(sweapongunnamesizeof(gunname));
        }
    }
    if(
activeHeal == && type == 0) {
        
result++;
        
idd CheckIDEmpty();
        
DropInfo[idd][ID] = CreatePickup(124023Pos[0]+resultPos[1]+2Pos[2], -1);
        
DropInfo[idd][Type] = 1;
        
DropInfo[idd][Weapon] = 0;
        
DropInfo[idd][Ammo] = 0;
    }
    
ResetPlayerWeapons(playerid);
    return 
1;

Using this drop, but whenever i take weapons that are dropped, after few seconds i get removed my weapons, it should actually remove the drop weapons but it appears that its removing even the players weaps who took it.

I think

PHP код:
ResetPlayerWeapons(playerid); 
is what causes to to reset other players weaps.
Reply
#2

Show your Health_Timer function
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)