Map Icon Fail?
#1

Hi guys, small problem here. I got a capture the flag server in the making, ofc, shows the flag on the radar for 5 secs, and then hides. I want to make it so that after the 5 seconds is up, it only shows locally.
Код:
new Float:flagposx, Float:flagposy, Float:flagposz;
Код:
stock SpawnNewFlag()
{
	DestroyObject(flag);
	new rflag = random(sizeof(FlagCoordinates));
	flag = CreateObject(2993, FlagCoordinates[rflag][0], FlagCoordinates[rflag][1], FlagCoordinates[rflag][2]-1, 0, 0,0,0);
	flagposx = FlagCoordinates[rflag][0];
	flagposy = FlagCoordinates[rflag][1];
	flagposz = FlagCoordinates[rflag][2];
	for(new i = 0; i < MAX_PLAYERS; i++) {
	SetPlayerMapIcon(i, 1, flagposx, flagposy, flagposz, 53, 0, MAPICON_GLOBAL);
	}
	SendClientMessageToAll(TURQUOISE, "[FLAG] The Flag has respawned. Showing flag for 5 seconds.");
	SetTimer("FlagHide", 5000, false);
	return 1;
}
and
Код:
public FlagHide()
{
    SendClientMessageToAll(TURQUOISE, "[FLAG] The flag has been hidden.");
    for(new i = 0; i < MAX_PLAYERS; i++) {
	RemovePlayerMapIcon(i, 1);
	RemovePlayerMapIcon(i, 3);
	GetObjectPos(flag, flagposx,flagposy,flagposz);
	SetPlayerMapIcon(i, 2, flagposx, flagposy, flagposz, 53, 0, MAPICON_LOCAL);
	}
	return 1;
}
I didnt think i was THAT much of a noob, but this has completely defeated me. The icon doesnt show anywhere at all, any ideas?
-Aston
Reply
#2

it will never show up if you will put the map icon invisible(id 1 = white square)
pick up other icon: https://sampwiki.blast.hk/wiki/MapIcons
Reply
#3

Код:
SetPlayerMapIcon(i, 1, flagposx, flagposy, flagposz, 53, 0, MAPICON_GLOBAL);
It's id 53 though, the flag. This works fine as a global, but local one doesn't show at all.
Reply
#4

Quote:
Originally Posted by AstonDA-G
Посмотреть сообщение
Код:
SetPlayerMapIcon(i, 1, flagposx, flagposy, flagposz, 53, 0, MAPICON_GLOBAL);
It's id 53 though, the flag. This works fine as a global, but local one doesn't show at all.
yea,sorry.
Reply
#5

It doesnt come up, I found the flag, but the map icon wasn't there, it just didnt show up at all, even when i was stood next to it
Reply
#6

Quote:
Originally Posted by AstonDA-G
Посмотреть сообщение
It doesnt come up, I found the flag, but the map icon wasn't there, it just didnt show up at all, even when i was stood next to it
no,sorry i was thinking you were just a replyer..
anyway try this:
pawn Код:
forward LocalFlag(playerid);
public FlagHide()
{
        SendClientMessageToAll(TURQUOISE, "[FLAG] The flag has been hidden.");
        for(new i = 0; i < MAX_PLAYERS; i++) {
    RemovePlayerMapIcon(i, 1);
    RemovePlayerMapIcon(i, 3);
    GetObjectPos(flag, flagposx,flagposy,flagposz);
        SetTimer("LocalFlag",1000,1);
    }
    return 1;
}
public LocalFlag(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerInRange(i, /*TYPE HERE THE VIEW DISTANCE*/,/*height view distance*/, flagposx, flagposy, flagposz)
    SetPlayerMapIcon(i, 2, flagposx, flagposy, flagposz, 53, 0, MAPICON_LOCAL);
    }
}
Reply
#7

works perfectly, Thanks so much!!!!
rep ++; 'd, though it wont count till i get 50 posts :S
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)