help in spec
#1

ok, i can create it.

pawn Код:
PlayerSpectatePlayer(playerid, targetid);
but how to make it like when player click in spec mode. it can spec all the online players one by one. Any idea?
Need help.
Reply
#2

You can use GetPlayerKeys or OnPlayerKeyStateChange to check if admin left click with mouse to forward to next player id.
Reply
#3

I know about keystate change. can you give me an example to go through the available ids ? and spec then one by one or randomly.
Reply
#4

pawn Код:
CMD:randomspec(playerid,params[])
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
      PlayerSpectatePlayer(playerid, random(i));
    }
  }
  return 1;
}
try this if not working tell me
Reply
#5

i need a player to test it. So i will test it later. Thank bro.
Reply
#6

pawn Код:
CMD:randomspec(playerid,params[])
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
      TogglePlayerSpectating(playerid, 1);
      PlayerSpectatePlayer(playerid, random(i));
    }
  }
  return 1;
}
sorry i forgot this
Reply
#7

fine, its working but can you fix this bug. I created it like it send message to the player id that he is spectating %d.

bug:
Код:
[22:49:23] You are spectating 1671753445

[22:49:23] You are spectating 0

[22:49:24] You are spectating 582277378

[22:49:24] You are spectating 0

[22:49:25] You are spectating 1706884788

[22:49:25] You are spectating 0

[22:49:26] You are spectating 1703948818

[22:49:26] You are spectating 0

[22:49:26] You are spectating 1797934518

[22:49:26] You are spectating 0

[22:49:27] You are spectating 890837544

[22:49:27] You are spectating 0

[22:49:29] You are spectating 68896010
code:
pawn Код:
if (PRESSED( KEY_FIRE ))
    {
        if(isDead[playerid] == 1)
        {
            new stringn[128];
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    PlayerSpectatePlayer(playerid, random(i));
                    format(stringn, sizeof(stringn),"You are spectating %d", random(i));
                    SendClientMessage(playerid, -1, stringn);
                }
            }
        }
        return 1;
    }
Reply
#8

pawn Код:
if (PRESSED( KEY_FIRE ))
    {
        if(isDead[playerid] == 1)
        {
            new stringn[128];
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    TogglePlayerSpectating(playerid, 1);
                    new name[MAX_PLAYER_NAME];
                    GetPlayerName(random(i), name, sizeof(name));
                    PlayerSpectatePlayer(playerid, random(i));
                    format(stringn, sizeof(stringn),"You are spectating %s", random(i));
                    SendClientMessage(playerid, -1, stringn);
                    new name1[MAX_PLAYER_NAME];
                    new stringxD[300];
                    GetPlayerName(playerid, name1, sizeof(name1));
                    format(stringxD, sizeof(stringxD),"%s is spectating you", name1);
                    SendClientMessage(random(i),-1,stringxD);
                   
                }
            }
        }
        return 1;
    }
btw, thanks
Reply
#9

ok i will check it.
Already repped you
Reply
#10

Maybe This will help you
CLICK HERE
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)