Headshot active for everyone
#1

Hello, can someone tell me what's wrong with this command? It's supposed to activate headshot for all players but it doesn't activate anything. Thank you.

pawn Код:
new headshot[MAX_PLAYERS];
pawn Код:
//-----------------------------------HEADSHOT-----------------------------------
    if(strcmp(cmd, "/ahs", true) == 0)
    {
        new activeheadshot;
        tmp = strtok(cmdtext, idx);
        activeheadshot = strval(tmp);
        if(logged[playerid] == 0)
        {
            SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be logged in to use that command.");
            return 1;
        }
        if(PlayerInfo[playerid][pAdmin] < 2)
        {
            SendClientMessage(playerid, COLOR_BRIGHTRED, "You are not an admin!");
            return 1;
        }
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /ahs [0/1]");
            return 1;
        }
        if(activeheadshot > 1 || activeheadshot < 0)
        {
            SendClientMessage(playerid, COLOR_BRIGHTRED, "You must enter 1 or 0 to activate or deactivate headshots.");
            return 1;
        }
        if(activeheadshot == 1)
        {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            headshot[i]=1;
        }
            dini_IntSet("server.ini","headshot", activeheadshot);
            SendClientMessage(playerid, COLOR_ORANGE, "You have enabled headshots for everyone.");
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "Admin %s enabled headshots !", sendername);
            SendClientMessageToAll(COLOR_WHITE, string);
            format(string, sizeof(string), "~w~HEADSHOT ENABLED");
            GameTextForAll(string, 5000, 3 );
            return 1;
        }
        if(activeheadshot == 0)
        {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            headshot[i]=0;
        }
            dini_IntSet("server.ini","headshot", activeheadshot);
            GetPlayerName(playerid, sendername, sizeof(sendername));
            SendClientMessage(playerid, COLOR_ORANGE, "You have disabled headshots for everyone.");
            format(string, sizeof(string), "Admin %s disabled headshots !", sendername);
            SendClientMessageToAll(COLOR_WHITE, string);
            format(string, sizeof(string), "~w~HEADSHOT DISABLED");
            GameTextForAll(string, 5000, 3);
            return 1;
        }
        return 1;
    }
pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
    if(headshot[playerid] == 1)
    {
    if(damagedid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 9)
     {
        SetPlayerHealth(damagedid, 0.0);
     }
    if(damagedid != INVALID_PLAYER_ID && weaponid == 33 && bodypart == 9)
     {
        SetPlayerHealth(damagedid, 0.0);
     }
    if(damagedid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)
     {
        SetPlayerHealth(damagedid, 0.0);
     }
    }
    return 1;
}
Reply


Messages In This Thread
Headshot active for everyone - by Adamsy - 20.08.2016, 05:16
Re: Headshot active for everyone - by DeeadPool - 20.08.2016, 06:36
Re: Headshot active for everyone - by Logic_ - 20.08.2016, 15:14
Re: Headshot active for everyone - by Adamsy - 20.08.2016, 18:33
Re: Headshot active for everyone - by Shinja - 20.08.2016, 18:50
Re: Headshot active for everyone - by Adamsy - 20.08.2016, 20:44
Re: Headshot active for everyone - by Shinja - 20.08.2016, 20:55
Re: Headshot active for everyone - by Adamsy - 20.08.2016, 21:27
Re: Headshot active for everyone - by Adamsy - 21.08.2016, 20:16
Re: Headshot active for everyone - by SyS - 22.08.2016, 13:50

Forum Jump:


Users browsing this thread: 1 Guest(s)