Checking if near a flag.
#1

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?
Reply
#2

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
Reply
#3

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.
Reply
#4

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]);
}
Reply
#5

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!
Reply
#6

Then just make the variable global. How hard could it possibly be?
Reply
#7

So I should make a global with the createobject lines? And on GamemodeInit do as an example:

pawn Код:
FlagObjects()
Like this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)