Checking if near a flag. -
Dan. - 13.05.2012
I have some problems detecting if a player is near the flag.
When gamemode starts, this flag will spawn:
pawn Код:
new PunaneLipp = CreateObject(2914, -973.6993,1077.1937,1343.9927,0, 0, 0, 96.0);
But how to check, if player is near the object "PunaneLipp"?
Because the "new" is inside brackets, so it wont work when I try to check if the player is in range, in a timer outside the GameModeInit.. so how to solve?
Re: Checking if near a flag. -
thefatshizms - 13.05.2012
wouldnt it still work if u did this:
pawn Код:
IsPlayerInRangeOfPoint(-973.6993,1077.1937,1343.9927);
im sure it would still work but im still noob so i might be wrong
Re: Checking if near a flag. -
Dan. - 13.05.2012
But when the player dies, he drops the flag to his current position. So the player couldn't then pick up the flag from there.
Re: Checking if near a flag. -
zbt - 13.05.2012
pawn Код:
if(IsPlayerInRangeOfObject(playerid, range, PunaneLipp))
return SendClientMessage(playerid, -1, "a");
stock IsPlayerInRangeOfObject(playerid, Float:range, objectid) {
new Float:pos[3];
GetObjectPos(objectid, pos[0], pos[1], pos[2]);
return IsPlayerInRangeOfPoint(playerid, range, pos[0], pos[1], pos[2]);
}
Re: Checking if near a flag. -
Dan. - 13.05.2012
This is not working, still the same error. The "PunaneLipp" is inside the brackets, but the stock is outside the brackets, so it says undefined!
Re: Checking if near a flag. -
Vince - 13.05.2012
Then just make the variable global. How hard could it possibly be?
Re: Checking if near a flag. -
Dan. - 13.05.2012
So I should make a global with the createobject lines? And on GamemodeInit do as an example:
Like this?