Headshot active for everyone
#10

Quote:
Originally Posted by Adamsy
Посмотреть сообщение
BUMP.

Here is the code I use, headshot works but even after disabled and works only for id 0.
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
        {
        if(activeheadshot == 1)
        {
            headshot[i] = 1;
            dini_IntSet("server.ini","headshot", activeheadshot);
            SendClientMessage(playerid, COLOR_ORANGE, "Vous avez activй le headshot pour tout le monde.");
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "L'admin %s a activй les headshots. (Eagle, Rifle, Sniper)", sendername);
            SendClientMessageToAll(COLOR_WHITE, string);
            format(string, sizeof(string), "~w~HEADSHOT ACTIVE");
            GameTextForAll(string, 5000, 3 );
            return 1;
        }
        if(activeheadshot == 0)
        {
            headshot[i] = 0;

            dini_IntSet("server.ini","headshot", activeheadshot);
            GetPlayerName(playerid, sendername, sizeof(sendername));
            SendClientMessage(playerid, COLOR_ORANGE, "Vous avez dйsactivй le headshot pour tout le monde.");
            format(string, sizeof(string), "Ladmin %s a dйsactivй les headshots.", sendername);
            SendClientMessageToAll(COLOR_WHITE, string);
            format(string, sizeof(string), "~r~HEADSHOT DESACTIVE");
            GameTextForAll(string, 5000, 3);
            return 1;
        }
        }
your return statements in the loop breaks it so only first iteration will work that is id 0 so you have to remove it

PHP код:
for(new 0MAX_PLAYERSi++)
        {
        if(
activeheadshot == 1)
        {
            
headshot[i] = 1;
            
dini_IntSet("server.ini","headshot"activeheadshot);
            
SendClientMessage(playeridCOLOR_ORANGE"Vous avez activй le headshot pour tout le monde.");
            
GetPlayerName(playeridsendernamesizeof(sendername));
            
format(stringsizeof(string), "L'admin %s a activй les headshots. (Eagle, Rifle, Sniper)"sendername);
            
SendClientMessageToAll(COLOR_WHITEstring);
            
format(stringsizeof(string), "~w~HEADSHOT ACTIVE");
            
GameTextForAll(string5000);
            
        }
        if(
activeheadshot == 0)
        {
            
headshot[i] = 0;
            
dini_IntSet("server.ini","headshot"activeheadshot);
            
GetPlayerName(playeridsendernamesizeof(sendername));
            
SendClientMessage(playeridCOLOR_ORANGE"Vous avez dйsactivй le headshot pour tout le monde.");
            
format(stringsizeof(string), "Ladmin %s a dйsactivй les headshots."sendername);
            
SendClientMessageToAll(COLOR_WHITEstring);
            
format(stringsizeof(string), "~r~HEADSHOT DESACTIVE");
            
GameTextForAll(string50003);
            
        }
}
        
return 
1;} 
Even though i edited your code i wont suggest it as its not optimized so i suggest you to
*use zcmd instead of strcmp
*use foreach for looping through players
*use sql saving system.
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: 2 Guest(s)