Check wich vehicle has the most health - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Check wich vehicle has the most health (
/showthread.php?tid=146432)
Check wich vehicle has the most health -
juuleman - 07.05.2010
Hi all,
I got a question.
I am making a small derby mission but at the end i want it to say Playernames vehicle has the most health and won this round. Is it possible (with GetVehiclehealth or something??
Plz help.
Re: Check wich vehicle has the most health -
juuleman - 07.05.2010
Please help me ...
Re: Check wich vehicle has the most health -
Norck - 07.05.2010
Just a little example how to do it:
pawn Код:
//somewhere
new Float:max = 0.00;
new winner = -1;
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInDerby[i] == 1)//or whatever you use to know that this player is in derby
{
if(IsPlayerInAnyVehicle(i))
{
new Float:h;
GetVehicleHealth(GetPlayerVehicleID(i),h);
if(h > max)
{
max = h;
winner = i;
}
}
}
}
}
if(winner != -1)
{
new name[MAX_PLAYER_NAME], string[80];
GetPlayerName(winner,name,sizeof(name));
format(string,sizeof(string),"%s's vehicle has the most health and won this round",name);
SendClientMessageToAll(COLOR_WHITE,string);//or whatever color you need
}
Re: Check wich vehicle has the most health -
juuleman - 07.05.2010
Quote:
Originally Posted by Sinyavski
Just a little example how to do it:
pawn Код:
//somewhere new Float:max = 0.00; new winner = -1; for(new i = 0; i < GetMaxPlayers(); i++) { if(IsPlayerConnected(i)) { if(PlayerInDerby[i] == 1)//or whatever you use to know that this player is in derby { if(IsPlayerInAnyVehicle(i)) { new Float:h; GetVehicleHealth(GetPlayerVehicleID(i),h); if(h > max) { max = h; winner = i; } } } } } if(winner != -1) { new name[MAX_PLAYER_NAME], string[80]; GetPlayerName(winner,name,sizeof(name)); format(string,sizeof(string),"%s's vehicle has the most health and won this round",name); SendClientMessageToAll(COLOR_WHITE,string);//or whatever color you need }
|
Thanks