[Help]Spectating system!
#1

Hello guys! Can someone tell me how to make a spectating system? Like after the players has died, and if they click FIRE, he will spectate other players randomly. Please help me guys!
Thanks.
Reply
#2

PlayerSpectatePlayer
Reply
#3

1.For a spectating system note that there is a spec f that comes already when you download the server package.
2.For specing when he press key use OnPlayerKeyStateChange and OnPlayerDeath when he dies.
EDIT - I was a little late
Reply
#4

this is my script:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if ((newkeys & KEY_FIRE))
    {
    if(PlayerInfo[playerid][Youdead] == 1)
    {
    new ranplayer;
    ranplayer = random(500);
    SetPlayerColor(playerid,COLOR_GREY);
    while(!IsPlayerConnected(ranplayer))
    {
        ranplayer = random(500);
     }
    TogglePlayerSpectating(playerid, 1);
    PlayerSpectatePlayer(playerid, ranplayer);
    }
    }
    return 1;
}
I dont know why it doesnt works. Help please
Reply
#5

bump! help me please
Reply
#6

You need a proper RandomPlayer() function. If you have 3 players online (ID 0 1 2) and you run that, it may take hours for it to return 0 1 or 2.
Reply
#7

can you give me that script please? i dont know how to do it
Reply
#8

pawn Код:
stock RandomPlayer()
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    /* Success you have 1 player online :P */
                    return i;
                }
            }
            else return 0;
        }
Reply
#9

i tried adding some script on "/* Success you have 1 player online :P */" and failed
can you give me the full script of it please?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)