Thread: [Plugin] Pawn.RakNet
View Single Post
Old 10/03/2018, 01:45 PM   #184
Jelly23
Guest
 
Posts: n/a
Default Re: Pawn.RakNet

PHP Code:
//RPCs
#define RPC_ServerJoin (137)
#define RPC_ServerQuit (138)

ShowPlayerOnScoreBoard(playeridtoplayeridbool:show)
{
    if(!
IsPlayerConnected(playerid) || !IsPlayerConnected(toplayerid)) return 0;
    
    new 
BitStream:bs BS_New(), name[MAX_PLAYER_NAME];
    
    
BS_WriteValue(
        
bs,
        
PR_UINT16playerid,
        
PR_UINT81
    
);

    
BS_RPC(bstoplayeridRPC_ServerQuit);
    
BS_Reset(bs);
    
    
GetPlayerName(playeridnamesizeof(name));
    
    
BS_WriteValue(
        
bs,
        
PR_UINT16playerid,
        
PR_INT320,
        
PR_UINT8, !show,
        
PR_UINT8strlen(name),
        
PR_STRINGname
    
);
    
    
BS_RPC(bstoplayeridRPC_ServerJoin);
    
BS_Delete(bs);
    return 
1;

Function snippet. This will show/hide a player from score-board (In-Game) by adding them back as a NPC for 'toplayerid'.

Take into account that hidden players will have their name tags removed for 'toplayerid', that is because they are added back as NPCs. Other than that, everything works fine.
  Reply With Quote