new HighestID = -1;
new HighestValue;
for(new i; i<sizeof(ARRAY); i++)
{
if(ARRAY[i] > HighestValue)
{
HighestID = i;
HighestValue = ARRAY[i];
}
}
//now you have the highest id and highest value.
new HighestID = -1;
new Float:HighestValue, Float:X, Float:Y, Float:Z;
for(new i; i<MAX_PLAYERS; i++)
{
GetPlayerPos(i, X, Y, Z);
if(Z > HighestValue)
{
HighestID = i;
HighestValue = Z;
}
}
// Player 'HighestID' is the highest at "Z = HighestValue"
//Note: This code does not deal with a tie... if 2 players are at exactly the same height, the player with the lowest playerID will 'win'.
|
Replace 'ARRAY' in the code below with the array you use. If the values you want to compare are floats, replace 'new HighestValue;' with 'new Float:HighestValue;'.
pawn Код:
This should do it: pawn Код:
|
for(new Slot; Slot < 12; Slot++)
{
GetPlayerWeaponData(iCount, Slot, Weapons_Storage[iCount][Slot][0], Weapons_Storage[iCount][Slot][1]);
}
for(new iCount; iCount < MAX_PLAYERS; iCount++) if(IsPlayerConnected(iCount) && In_Pyramid[iCount])
{
SetPlayerHealth(iCount, 100.0);
SetPlayerInArea(iCount, 2270.7515, 2384.8372, 1217.5714, 1351.8844, 60.0000);
SetPlayerInterior(iCount, 0);
SetPlayerVirtualWorld(iCount, PYRAMID_WORLD);
/* for(new Slot; Slot < 12; Slot++)
{
GetPlayerWeaponData(iCount, Slot, Weapons_Storage[iCount][Slot][0], Weapons_Storage[iCount][Slot][1]);
}*/
ResetPlayerWeapons(iCount);
GivePlayerWeapon(iCount, 38, 9999);
TogglePlayerControllable(iCount, false);
}