[Tutorial] Pacotes - Pawn.RakNet
#21

Jelly, encontrei um bug. ao usar ShowPlayerForPlayer e RemovePlayerForPlayer, os jogadores ficam com skin do cj e tbm nгo aparecem os acessуrios e tals. como resolver isso?
Reply
#22

Уtimo tutorial.
Reply
#23

Quote:
Originally Posted by KoloradO
Посмотреть сообщение
Jelly, encontrei um bug. ao usar ShowPlayerForPlayer e RemovePlayerForPlayer, os jogadores ficam com skin do cj e tbm nгo aparecem os acessуrios e tals. como resolver isso?
Parвmetros faltando/incorretos no BitStream, verifique a lista.
Reply
#24

Como fazer SetPlayerSkinForPlayer e SetPlayerAttachedObjectForPlayer?

Eu sou leigo nisso de raknet, tentei fazer mas nгo deu muito certo rs

Код:
stock SetPlayerSkinForPlayer(playerid, toplayerid, skin)
{
    new BitStream:bs = BS_New();

    BS_WriteValue(
        bs,
        PR_UINT16, playerid
    );

    BS_SetWriteOffset(bs, skin);
    BS_RPC(bs, toplayerid, 153, PR_LOW_PRIORITY, PR_RELIABLE_ORDERED);
    BS_Delete(bs);
    return 1;
}
Reply
#25

Quote:
Originally Posted by KoloradO
Посмотреть сообщение
Como fazer SetPlayerSkinForPlayer e SetPlayerAttachedObjectForPlayer?

Eu sou leigo nisso de raknet, tentei fazer mas nгo deu muito certo rs

Код:
stock SetPlayerSkinForPlayer(playerid, toplayerid, skin)
{
    new BitStream:bs = BS_New();

    BS_WriteValue(
        bs,
        PR_UINT16, playerid
    );

    BS_SetWriteOffset(bs, skin);
    BS_RPC(bs, toplayerid, 153, PR_LOW_PRIORITY, PR_RELIABLE_ORDERED);
    BS_Delete(bs);
    return 1;
}
SetPlayerAttObjForPlayer- Anexa um objeto em um jogador apenas para outro jogador.
PHP код:
SetPlayerAttObjForPlayer(playerid, toplayerid, index, modelid, bone, Float:fOffsetX = 0.0, Float:fOffsetY = 0.0, Float:fOffsetZ = 0.0, Float:fRotX = 0.0, Float:fRotY = 0.0, Float:fRotZ = 0.0, Float:fScaleX = 1.0, Float:fScaleY = 1.0, Float:fScaleZ = 1.0, materialcolor1 = 0, materialcolor2 = 0)
{
    new 
BitStream:bs = BS_New();
    
BS_WriteValue(
        
bs,
        
PR_UINT16, playerid,
        
PR_UINT32, index,
        
PR_BOOL, 1,
        
PR_UINT32, modelid,
        
PR_UINT32, bone,
        
PR_FLOAT, fOffsetX,
        
PR_FLOAT, fOffsetY,
        
PR_FLOAT, fOffsetZ,
        
PR_FLOAT, fRotX,
        
PR_FLOAT, fRotY,
        
PR_FLOAT, fRotZ,
        
PR_FLOAT, fScaleX,
        
PR_FLOAT, fScaleY,
        
PR_FLOAT, fScaleZ,
        
PR_UINT32, materialcolor1,
        
PR_UINT32, materialcolor2
    
);
    
BS_RPC(bs, toplayerid, 113, PR_LOW_PRIORITY, PR_RELIABLE_ORDERED);
    
BS_Delete(bs);
    return 
1;
} 
RemovePlayerAttObjForPlayer- Remove um objeto anexado em um jogador apenas para outro jogador.
PHP код:
RemovePlayerAttObjForPlayer(playerid, toplayerid, index)
{
    new 
BitStream:bs = BS_New();
    
BS_WriteValue(
        
bs,
        
PR_UINT16, playerid,
        
PR_UINT32, index,
        
PR_BOOL, 0
    
);
    
BS_RPC(bs, toplayerid, 113, PR_LOW_PRIORITY, PR_RELIABLE_ORDERED);
    
BS_Delete(bs);
    return 
1;
} 
SetPlayerSkinForPlayer - Muda o skin de um jogador para outro jogador.
PHP код:
SetPlayerSkinForPlayer(playerid, forplayerid, skin)
{
    new 
BitStream:bs = BS_New();
    
BS_WriteValue(
        
bs,
        
PR_UINT16, playerid,
        
PR_UINT32, skin
    
);
    
BS_RPC(bs, forplayerid, 153, PR_LOW_PRIORITY, PR_RELIABLE_ORDERED);
    
BS_Delete(bs);
    return 
1;
} 
Detalhes importantes:

Ex: SetPlayerSkinForPlayer - Quando o jogador entrar na zona de streaming de outro jogador, o servidor manda o RPC WorldPlayerAdd com dados como estнlo de luta, skin, cor, etc. Vocк vai ter que mudar esses dados com os que vocк vai utilizar nas funзхes por-jogador, ou vocк verб o jogador com sua informaзгo original (skin, cor, etc).

Outro detalhe:

Vamos dizer que vocк tem o skin por-jogador salvo em uma matriz: new SkinPorJogador[MAX_PLAYERS][MAX_PLAYERS];

Vocк vai ter que tomar conta de casos em que o servidor pode mudar o skin para todos (ex: SetPlayerSkin). Para isso, vocк vai utilizar a callback OnOutcomingRPC e mudar o valor da matriz com o novo ID de skin dado pelo servidor no BitStream (RPC 153), assim, a matriz SkinPorJogador terб o valor dado pelo servidor quando mudado.
Reply
#26

Espero ver algum lanзamento no futuro, utilizando Pawn.RakNet.
Reply
#27

Tentei fazer um SetPlayerNameForPlayer, fiz correto?

Код:
stock SetPlayerNameForPlayer(playerid, toplayerid, name[])
{
    new BitStream:bs = BS_New();

    BS_WriteValue(
        bs,
        PR_UINT16, playerid,
        PR_UINT16, sizeof(name),
        PR_STRING, name,
        
    );

    BS_RPC(bs, toplayerid, 11, PR_LOW_PRIORITY, PR_RELIABLE_ORDERED);
    BS_Delete(bs);
    return 1;
}
Reply
#28

Quote:
Originally Posted by KoloradO
Посмотреть сообщение
Tentei fazer um SetPlayerNameForPlayer, fiz correto?

Код:
stock SetPlayerNameForPlayer(playerid, toplayerid, name[])
{
    new BitStream:bs = BS_New();

    BS_WriteValue(
        bs,
        PR_UINT16, playerid,
        PR_UINT16, sizeof(name),
        PR_STRING, name,
        
    );

    BS_RPC(bs, toplayerid, 11, PR_LOW_PRIORITY, PR_RELIABLE_ORDERED);
    BS_Delete(bs);
    return 1;
}
PHP код:
SetPlayerNameForPlayer(playerid, toplayerid, name[])
{
    new 
BitStream:bs = BS_New(), size = strlen(name);
    
BS_WriteValue(
        
bs,
        
PR_UINT16, playerid,
        
PR_UINT8, size,
        
PR_STRING, name
    
);
    
BS_RPC(bs, toplayerid, 11);
    
BS_Delete(bs);
    return 
1;
} 
Reply
#29

Quando eu tiver um tempinho em minha vida irei me aprofundar mais em Pawn.RakNet.

Parabйns, уtimo tуpico!
Reply
#30

Em breve um tуpico dedicado apenas a explicar como a sincronizaзгo e processos de "streaming" ocorrem no SA-MP, e como os mundos virtuais sгo manipulados pelo servidor.
Reply
#31

Уtimo tutorial cara, gostei de ver!
Reply
#32

Atualizado.

Agora com os pacotes tambйm disponнveis na RPC List: Aqui
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)