MapIcon help.
#1

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  if (newkeys & KEY_FIRE)
  {
    for(new q = 0; q > 50; q++)
  	{
  	new Float:x, Float:y, Float:z;
    	GetPlayerPos(playerid,x,y,z);
    	if(IsPlayerConnected(q)) SetPlayerMapIcon(q, 1, x, y, z, 41, COLOR_RED);
    	SetTimer("ShootIcon",2000,0);
  	}
  }
  return 1;
}
I have this code from a friend and he wants to make when someone press the mouse button you get a mapicon over there.
But it doesnt work and i have no idea what to do to fix it :S. Does anyone of you know how to make it show for all players ?

~Nookie
Reply
#2

Not tested :S
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  if (newkeys & KEY_FIRE)
  {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
          SetPlayerMarkerForPlayer(playerid, i, GetPlayerColor(i));
        }
        SetTimerEx("HideIcon",2000,0,"i",playerid);
    }
    return 1;
}

forward HideIcon(playerid);
public HideIcon(playerid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
      if(IsPlayerConnected(i))
      {
        SetPlayerMarkerForPlayer(playerid, i, 00); // 00 = invisibile
        }
    }
}
Reply
#3

Looks like it works im waiting for him now so we can test with 2 players.
Thanks for the help tho.

~Nookie
Reply
#4

Ok let me know
Reply
#5

Quote:
Originally Posted by [TLV
ReVo_ ]
Ok let me know
Nope know when i shoot the mapicon gets placed at him and when he shoots the mapicon gets placed at me.

~Nookie
Reply
#6

Make sure you are checking for a empty slot, I'd use a Icon streamer for this because [TLV]ReVo_ creates 200 map icons at the same place and uses up all the slots. Check my sig on how to make a Icon streamer.
Reply
#7

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  if (newkeys & KEY_FIRE)
  {
        for(new a = 0, b = GetMaxPlayers(); a < b; a++)
        {
        SetPlayerMarkerForPlayer(playerid, a, GetPlayerColor(playerid));
            SetTimerEx("HideIcon",2000,0,"i",playerid);
        }
        return 1;
    }
    return 1;
}

forward HideIcon(playerid);

public HideIcon(playerid)
{
    for(new a = 0, b = GetMaxPlayers(); a < b; a++)
    {
    SetPlayerMarkerForPlayer(playerid, a, 00);
    }
    return 1;
}
I'm not very good with the markers lol, so I dunno if it'll work.
Reply
#8

Quote:
Originally Posted by [HiC
TheKiller ]
Make sure you are checking for a empty slot, I'd use a Icon streamer for this because [TLV]ReVo_ creates 200 map icons at the same place and uses up all the slots. Check my sig on how to make a Icon streamer.
Thanks but that didn't help me at all.
I asked how to make my code work not how to make a streamer.

~Nookie
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)