[Ajuda] SetPlayerNameForPlayer
#1

Fiz essa funзгo utilizando plugin Pawn.RakNet, testei vбrias vezes e por algum motivo nгo funciona
oq fiz errado?

Код:
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
#2

Quote:
Originally Posted by Cycle
View Post
Porque faltou vocк incrementar o valor do parвmetro da string "name" junto com a length/size.

PHP Code:
SetPlayerNameForPlayer(playeridtoplayeridname[])
{
    new 
BitStream:bs BS_New(), size strlen(name);
    
BS_WriteValue(
        
bs,
        
PR_UINT16playerid,
        
PR_UINT8size,
        
PR_STRINGnamesize
    
);
    
BS_RPC(bstoplayerid11);
    
BS_Delete(bs);
    return 
true;

mesma coisa..
Reply
#3

Quote:
Originally Posted by Cycle
View Post
Porque faltou vocк incrementar o valor do parвmetro da string "name" junto com a length/size.

PHP Code:
SetPlayerNameForPlayer(playeridtoplayeridname[])
{
    new 
BitStream:bs BS_New(), size strlen(name);
    
BS_WriteValue(
        
bs,
        
PR_UINT16playerid,
        
PR_UINT8size,
        
PR_STRINGnamesize
    
);
    
BS_RPC(bstoplayerid11);
    
BS_Delete(bs);
    return 
true;

Nгo! vocк sу repetiria "size" (length) ao ler uma string, nгo ao escrever.

A funзгo funciona perfeitamente, nгo sei que problema vocк estб tendo.
Reply
#4

Quote:
Originally Posted by Jelly23
View Post
Nгo! vocк sу repetiria "size" (length) ao ler uma string, nгo ao escrever.

A funзгo funciona perfeitamente, nгo sei que problema vocк estб tendo.
Mano nгo funciona, й serio.. eu jб tentei de tudo! vк com mais atenзгo se nгo tem algum erro testa vc mesmo pra ver.

Eu configurei pra quando um player spawnar, vai setar o nome dele pra "Teste" para o id 0. mas nada acontece
Reply
#5

Quote:
Originally Posted by KoloradO
Посмотреть сообщение
Mano nгo funciona, й serio.. eu jб tentei de tudo! vк com mais atenзгo se nгo tem algum erro testa vc mesmo pra ver.

Eu configurei pra quando um player spawnar, vai setar o nome dele pra "Teste" para o id 0. mas nada acontece
Eu realmente testei, alйm da funзгo estar correta. Acredito que alguma modificaзгo que vocк use, esteja impedindo o RPC de chegar no RakClient.
Reply
#6

Serб que pode ser o meu compilador ?
Reply
#7

Verifique se estб na public correta e se os "{" estгo fechados na mesma funзгo
Reply
#8

O compilador nгo interfere em completamente nada.
Se as chaves nгo estivessem fechadas, o cуdigo nгo iria compilar.

Vбrias pessoas jб te ajudaram sobre isso, inclusive os ъnicos que fazem algo com Pawn.RakNet jб te falaram o que fazer, isso sу pode ser brincadeira ou tem alguma forзa contrбria que nгo estб permitindo vocк a usar, pois jб fiz os testes, e tudo e estб funcionando corretamente. Um membro jб fez uma include especнfica sobre isso, sem necessidade, porйm ele fez. Testei usando a include dele, e funcionou bem, seguiu totalmente os requisitos dados.
Reply
#9

Quote:
Originally Posted by Pool
Посмотреть сообщение
O compilador nгo interfere em completamente nada.
Se as chaves nгo estivessem fechadas, o cуdigo nгo iria compilar.

Vбrias pessoas jб te ajudaram sobre isso, inclusive os ъnicos que fazem algo com Pawn.RakNet jб te falaram o que fazer, isso sу pode ser brincadeira ou tem alguma forзa contrбria que nгo estб permitindo vocк a usar, pois jб fiz os testes, e tudo e estб funcionando corretamente. Um membro jб fez uma include especнfica sobre isso, sem necessidade, porйm ele fez. Testei usando a include dele, e funcionou bem, seguiu totalmente os requisitos dados.
Talvez o compilador interfira sim.
Tente utilizar o compilador do pawn-lang (joga isso no g00gle que tu acha), tente remover os argumentos que o compilador estб utilizando.
Reply
#10

Quote:
Originally Posted by Pool
Посмотреть сообщение
O compilador nгo interfere em completamente nada.
Se as chaves nгo estivessem fechadas, o cуdigo nгo iria compilar.

Vбrias pessoas jб te ajudaram sobre isso, inclusive os ъnicos que fazem algo com Pawn.RakNet jб te falaram o que fazer, isso sу pode ser brincadeira ou tem alguma forзa contrбria que nгo estб permitindo vocк a usar, pois jб fiz os testes, e tudo e estб funcionando corretamente. Um membro jб fez uma include especнfica sobre isso, sem necessidade, porйm ele fez. Testei usando a include dele, e funcionou bem, seguiu totalmente os requisitos dados.
Nгo estou fazendo nenhum tipo de bricadeira oshe, nгo tenho necessidade disso.

Eu compilei o cуdigo direitinho e abri o servidor apenas com o PLUGIN Pawn.RakNet e simplesmente a funзгo nгo funciona. Eu jб estou quebrando o cйrebro com isso, todas as outras funcхes funcionam menos essa. Exemplo SetPlayerColorForPlayer, Show/HideForPlayer etc.


Quote:
Originally Posted by Ermanhaut
Посмотреть сообщение
Talvez o compilador interfira sim.
Tente utilizar o compilador do pawn-lang (joga isso no g00gle que tu acha), tente remover os argumentos que o compilador estб utilizando.
Eu jб uso esse compilador. Vou tentar utilizar o compilador padrгo do SA-MP pra ver se resolve, do contrбrio eu nгo sei oq pode ser.
Reply
#11

acho que o capiroto tambйm baixou em mim, jб tentei usar essa funзгo, uma do plugin YSF e nada faz setar Name para apenas outro jogador ver.
Reply
#12

Quote:
Originally Posted by B4dSh33p
View Post
acho que o capiroto tambйm baixou em mim, jб tentei usar essa funзгo, uma do plugin YSF e nada faz setar Name para apenas outro jogador ver.
A funзгo SetPlayerNameForPlayer do Plugin YSF funciona aqui.
Reply
#13

Quote:
Originally Posted by KoloradO
Посмотреть сообщение
Serб que pode ser o meu compilador ?
https://forum.sa-mp.com/showpost.php...postcount=3426
Reply
#14

@KoloradO Testa em uma GM sem nada, vк se funciona...
Reply
#15

Quote:
Originally Posted by ipsLuan
View Post
Oque tem ? '-'

Quote:
Originally Posted by GasparzinhoXD
View Post
@KoloradO Testa em uma GM sem nada, vк se funciona...
primeira coisa que eu fiz foi isso
Reply
#16

A funзгo estб correta, e a estrutura do RPC tambйm, entгo nгo entendo por que vocк estб tendo problemas.
Reply
#17

Quote:
Originally Posted by ipsLuan
Посмотреть сообщение
olha oque acontece quando eu uso esse cуdigo que vocк mandou.

Код:
D:\pawno\include\Pawn.RakNet.inc(538) : warning 219: local variable "bs" shadows a variable at a preceding level
D:\pawno\include\Pawn.RakNet.inc(558) : warning 219: local variable "bs" shadows a variable at a preceding level
D:\pawno\include\Pawn.RakNet.inc(583) : warning 219: local variable "bs" shadows a variable at a preceding level
D:\pawno\include\Pawn.RakNet.inc(601) : warning 219: local variable "bs" shadows a variable at a preceding level
..\modulos\Stocks.pwn(2775) : warning 219: local variable "bs" shadows a variable at a preceding level
..\modulos\Stocks.pwn(2806) : warning 219: local variable "bs" shadows a variable at a preceding level
..\modulos\cmds.pwn(41) : warning 219: local variable "bs" shadows a variable at a preceding level
..\modulos\SetPlayerNameForPlayer.pwn(10) : error 010: invalid function or declaration
..\modulos\SetPlayerNameForPlayer.pwn(10 -- 17) : error 021: symbol already defined: "strcat"
..\modulos\SetPlayerNameForPlayer.pwn(19) : error 001: expected token: ";", but found ")"
..\modulos\SetPlayerNameForPlayer.pwn(30) : error 010: invalid function or declaration
..\modulos\SetPlayerNameForPlayer.pwn(33) : error 010: invalid function or declaration
..\modulos\SetPlayerNameForPlayer.pwn(33 -- 42) : error 010: invalid function or declaration
..\modulos\SetPlayerNameForPlayer.pwn(33 -- 47) : error 010: invalid function or declaration
..\modulos\SetPlayerNameForPlayer.pwn(33 -- 47) : fatal error 107: too many error messages on one line
Reply
#18

Quote:
Originally Posted by B4dSh33p
Посмотреть сообщение
olha oque acontece quando eu uso esse cуdigo que vocк mandou.

Код:
D:\pawno\include\Pawn.RakNet.inc(538) : warning 219: local variable "bs" shadows a variable at a preceding level
D:\pawno\include\Pawn.RakNet.inc(558) : warning 219: local variable "bs" shadows a variable at a preceding level
D:\pawno\include\Pawn.RakNet.inc(583) : warning 219: local variable "bs" shadows a variable at a preceding level
D:\pawno\include\Pawn.RakNet.inc(601) : warning 219: local variable "bs" shadows a variable at a preceding level
..\modulos\Stocks.pwn(2775) : warning 219: local variable "bs" shadows a variable at a preceding level
..\modulos\Stocks.pwn(2806) : warning 219: local variable "bs" shadows a variable at a preceding level
..\modulos\cmds.pwn(41) : warning 219: local variable "bs" shadows a variable at a preceding level
..\modulos\SetPlayerNameForPlayer.pwn(10) : error 010: invalid function or declaration
..\modulos\SetPlayerNameForPlayer.pwn(10 -- 17) : error 021: symbol already defined: "strcat"
..\modulos\SetPlayerNameForPlayer.pwn(19) : error 001: expected token: ";", but found ")"
..\modulos\SetPlayerNameForPlayer.pwn(30) : error 010: invalid function or declaration
..\modulos\SetPlayerNameForPlayer.pwn(33) : error 010: invalid function or declaration
..\modulos\SetPlayerNameForPlayer.pwn(33 -- 42) : error 010: invalid function or declaration
..\modulos\SetPlayerNameForPlayer.pwn(33 -- 47) : error 010: invalid function or declaration
..\modulos\SetPlayerNameForPlayer.pwn(33 -- 47) : fatal error 107: too many error messages on one line
As funзхes foram desenvolvidas com o proposito de servir como include.

- Ao autor do tуpico:

O que eu fiz na include, й o mesmo que vocк estб fazendo na sua funзгo. Como o Bruno disse, o ID do RPC e a sua estrutura estгo corretas, logo, o mesmo nгo deveria resultar em erros e estes "problemas" que vocк estб tendo.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)