2 questions any help please :)
#8

With the first one, start off by setting a repeating timer under OnGameModeInit, using:
https://sampwiki.blast.hk/wiki/SetTimer
Код:
SetTimer("1SecTimer", 1000, true);
/*
1SecTimer - The public we're gonna call
1000 - The time it will take before we call the public in milliseconds, we'll set it to 1 second
true - Should it repeat, in this case we want to check his health each second, so true, it should repeat
*/
Then in the public, loop through all players
https://sampwiki.blast.hk/wiki/Keywords:Statements#for
Код:
for(new i = 0; i < MAX_PLAYERS; i ++) // Calls the code underneath 500 times as "i"
{
    if(IsPlayerConnected(i)) // Check if that number is connected
    {

    }
}
Or just use foreach

And check if their health is below etc. 50
https://sampwiki.blast.hk/wiki/GetPlayerHealth
Код:
new
    Float: HP // Declare "HP" as a float (a number that can hold decimals, like 21.1582)
;
GetPlayerHealth(i, HP); // Stores the players health in the HP float
if(HP < 50) // If the HP float is set to something lower than 50
{

}
And then set their drunk level.
https://sampwiki.blast.hk/wiki/SetPlayerDrunkLevel
Код:
if(HP < 50)
{
    SetPlayerDrunkLevel(i, 2000);
}
Reply


Messages In This Thread
2 questions any help please :) - by Bulgaria - 03.04.2015, 22:47
Re: 2 questions any help please :) - by Bulgaria - 03.04.2015, 23:47
Re: 2 questions any help please :) - by ImperioHosting - 03.04.2015, 23:52
Re: 2 questions any help please :) - by Bulgaria - 03.04.2015, 23:55
Re: 2 questions any help please :) - by CalvinC - 04.04.2015, 08:10
Re: 2 questions any help please :) - by Bulgaria - 04.04.2015, 13:08
AW: 2 questions any help please :) - by Mencent - 04.04.2015, 13:16
Re: 2 questions any help please :) - by CalvinC - 04.04.2015, 13:30
Re: 2 questions any help please :) - by Bulgaria - 04.04.2015, 13:53
Re: 2 questions any help please :) - by Bulgaria - 04.04.2015, 14:05

Forum Jump:


Users browsing this thread: 1 Guest(s)