18.11.2010, 21:31
pawn Код:
forward NeedsToEat(playerid);
forward NeedsToEat2(playerid);
forward TakeHealthDown();
pawn Код:
new N2ETimer[MAX_PLAYERS];
new IsHungry[MAX_PLAYERS];
new Float:Health[MAX_PLAYERS];
new Float:tmpHealth[MAX_PLAYERS];
new N2ECount[MAX_PLAYERS];
pawn Код:
Food[0] = CreatePickup(2804, 2, 1883.26, 2073.04, 11.06, 0);
CreatePickup(2804, 2, 1694.57, 2204.29, 11.06, 0);
CreatePickup(2804, 2, 1153.51, 2070.38, 10.82, 0);
CreatePickup(2804, 2, 2088.21, 2221.93, 10.82, 0);
CreatePickup(2804, 2, 2107.01, 2231.94, 11.02, 0);
CreatePickup(2804, 2, 1875.21, 2071.30, 10.82, 0);
CreatePickup(2804, 2, -2478.04, 2319.20, 4.98, 0);
CreatePickup(2804, 2, -142.08, 1223.38, 19.73, 0);
Food[1] = CreatePickup(2804, 2, -49.94, 1190.46, 19.35, 0);
pawn Код:
SetTimer("TakeHealthDown", 2500, 1);
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
KillTimer(N2ETimer[playerid]);
IsHungry[playerid] = 0;
return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
N2ETimer[playerid] = SetTimerEx("NeedsToEat", 600000, 0, "i", playerid);
IsHungry[playerid] = 0;
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
}
if(pickupid== Food[0] <= Food[1]) //this is line 1987 !!!!!!!!!!!!!!!!!!!!!
{
SendClientMessage(playerid, COLOR_GREEN, "* You satisfied by eating or drinking!");
IsHungry[playerid] = 0;
SetTimerEx("NeedsToEat2", 1000, 0, "i", playerid);
}
return 1;
}
pawn Код:
public NeedsToEat(playerid)
{
SendClientMessage(playerid, COLOR_ORANGE, "* You're starting to feel hungry!");
IsHungry[playerid] = 1;
N2ECount[playerid] = 0;
GetPlayerHealth(playerid, Health[playerid]);
if(Health[playerid] == 100.0)
{
Health[playerid] = 99.0;
SetPlayerHealth(playerid, 99.0);
}
SetTimerEx("NeedsToEat2", 1000, 0, "i", playerid);
}
pawn Код:
public NeedsToEat2(playerid)
{
if(IsHungry[playerid])
{
if(N2ECount[playerid] >= 0 && N2ECount[playerid] < 60)
{
GetPlayerHealth(playerid, tmpHealth[playerid]);
if(tmpHealth[playerid] > Health[playerid])
{
SendClientMessage(playerid, COLOR_GREEN, "* You satisfied by eating or drinking!");
IsHungry[playerid] = 0;
N2ETimer[playerid] = SetTimerEx("NeedsToEat", 600000, 0, "i", playerid);
}
else
{
SetTimerEx("NeedsToEat2", 1000, 0, "i", playerid);
N2ECount[playerid] ++;
}
}
else
{
SendClientMessage(playerid, COLOR_ORANGE, "* You're starting to feel really week, hurry to get some food before you pass out!");
IsHungry[playerid] = 2;
}
}
}
pawn Код:
public TakeHealthDown()
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i) && IsHungry[i] == 2)
{
GetPlayerHealth(i, tmpHealth[i]);
if(tmpHealth[i] > Health[i])
{
SendClientMessage(i, COLOR_GREEN, "* You satisfied by eating or drinking!");
IsHungry[i] = 0;
N2ETimer[i] = SetTimerEx("NeedsToEat", 600000, 0, "i", i);
}
GetPlayerHealth(i, Health[i]);
SetPlayerHealth(i, tmpHealth[i] -1);
if(tmpHealth[i] < 5)
{
SendClientMessage(i, COLOR_RED, "* You're starving from hunger!");
}
}
}
}
pawn Код:
C:\Users\Marino Varesio\Desktop\zombie outbreak\gamemodes\zombieoutbreak.pwn(1987) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Warning.