OnPlayerWeaponShot Problem.
#1

Hello, i have problem with OnPlayerWeaponShot. I made script which should prevent players to kill eachother in ammunation but now it also happens even they are not in ammu.

PHP Code:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
    if(
hittype == BULLET_HIT_TYPE_PLAYER && IsPlayerConnected(hitid) && !IsPlayerNPC(hitid))
    {
        if(
hitid != INVALID_PLAYER_ID)
        {
            if(
InEvent[hitid] != InEvent[playerid] || InTDM[hitid] != InTDM[playerid] || InParkour[hitid] != InParkour[playerid] || InSkydive[hitid] != InSkydive[playerid] || InDerby[hitid] != InDerby[playerid])
            {
                
GameTextForPlayer(playerid"NO KILLING!"30003);
                return 
0;
            }
            
            if(
InHouse[hitid] != INVALID_HOUSE_ID)
            {
                
GameTextForPlayer(playerid"NO KILLING!"30003);
            }
            if(
InAmmu[hitid] != INVALID_PLAYER_ID)
            {
                new 
FloatHP;
                
GetPlayerHealth(playeridHP);
                
GetPlayerHealth(hitidHP);
                
SetPlayerHealth(hitid100);
                
GameTextForPlayer(playerid"NO KILLING!"30003);
                
SetPlayerHealth(playeridHP-30);
            }
            if(
pProtectTick[hitid] > 0)
            {
                
GameTextForPlayer(playerid"NO SPAWN KILLING!"50003);
            }
            if(
GetPlayerTeam(playerid) != NO_TEAM && GetPlayerTeam(hitid) != NO_TEAM) {
                if(
GetPlayerTeam(playerid) == GetPlayerTeam(hitid) || GetPlayerTeam(hitid) == GetPlayerTeam(playerid)) {
                    
GameTextForPlayer(playerid"NO TEAM KILLING!"50003);
                }
            }
            if(
IsPlayerAFK(hitid))
            {
                 if(
gettime() - AbuseTick[playerid] < 20)
                 {
                    
SetPlayerHealth(hitid0);
                    
GameTextForPlayer(hitid"NO AFK TO AVOID DEATH"50003);
                 }
            }
            if(
pProtectTick[playerid] > 0)
            {
                
pProtectTick[playerid] = 0;
                
SetPlayerHealth(playerid100.0);
            }
        }
    } 
Reply
#2

Problem solved!
Reply
#3

Please specify how you solved the problem in case someone else faces the same issue.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)