01.11.2010, 14:25
hello,
this is kinda my first time working with areas and weather is the player is inside in area or not. So im kinda lost...
for example: when the player is inside an area, it should say you have 10 seconds to leave.
Then when you enter again it restarts the countdown.
I dont have any problems with the countdown msg ... i just dont know how to check if a player is outside an area.
heres what i have so far:
public OnGameModeInit()
{
SetTimer("a51check",1000,1);
return 1;
}
forward a51check();
public a51check()
{
for(new P=0; P < MAX_PLAYERS; P++)
{
if (IsPlayerConnected(P))
{
if(acount[P] <= 0)
{
acount[P] = 11;
return 1;
}
if(IsPlayerInCube(P, 97.0170,1799.1124,-57.8426,285.2727,1940.9764,281.8122))
{
acount[P] --;
new string[280];
format(string,sizeof(string),"You have %d seconds to get out",acount[P]);
GameTextForPlayer(P,string,1000,5);
return 1;
}
if(!IsPlayerInCube(P, 97.0170,1799.1124,-57.8426,285.2727,1940.9764,281.8122))
{
acount[P] = 11;
return 1;
}
}
}
return 1;
}
this is kinda my first time working with areas and weather is the player is inside in area or not. So im kinda lost...
for example: when the player is inside an area, it should say you have 10 seconds to leave.
Then when you enter again it restarts the countdown.
I dont have any problems with the countdown msg ... i just dont know how to check if a player is outside an area.
heres what i have so far:
public OnGameModeInit()
{
SetTimer("a51check",1000,1);
return 1;
}
forward a51check();
public a51check()
{
for(new P=0; P < MAX_PLAYERS; P++)
{
if (IsPlayerConnected(P))
{
if(acount[P] <= 0)
{
acount[P] = 11;
return 1;
}
if(IsPlayerInCube(P, 97.0170,1799.1124,-57.8426,285.2727,1940.9764,281.8122))
{
acount[P] --;
new string[280];
format(string,sizeof(string),"You have %d seconds to get out",acount[P]);
GameTextForPlayer(P,string,1000,5);
return 1;
}
if(!IsPlayerInCube(P, 97.0170,1799.1124,-57.8426,285.2727,1940.9764,281.8122))
{
acount[P] = 11;
return 1;
}
}
}
return 1;
}