SA-MP Forums Archive
[Ajuda] SetPlayerNameForPlayer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] SetPlayerNameForPlayer (/showthread.php?tid=650287)



SetPlayerNameForPlayer - KoloradO - 24.02.2018

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;
}



Re: SetPlayerNameForPlayer - KoloradO - 24.02.2018

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..


Re: SetPlayerNameForPlayer - Jelly23 - 24.02.2018

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.


Re: SetPlayerNameForPlayer - KoloradO - 25.02.2018

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


Re: SetPlayerNameForPlayer - Jelly23 - 25.02.2018

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.


Re: SetPlayerNameForPlayer - KoloradO - 02.11.2018

Serб que pode ser o meu compilador ?


Re: SetPlayerNameForPlayer - GuiLopez - 02.11.2018

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


Re: SetPlayerNameForPlayer - Pool - 02.11.2018

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.


Re: SetPlayerNameForPlayer - Ermanhaut - 02.11.2018

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.


Re: SetPlayerNameForPlayer - KoloradO - 02.11.2018

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.


Re: SetPlayerNameForPlayer - B4dSh33p - 02.11.2018

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.


Re: SetPlayerNameForPlayer - KoloradO - 02.11.2018

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.


Re: SetPlayerNameForPlayer - ipsLuan - 02.11.2018

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


Re: SetPlayerNameForPlayer - GasparzinhoXD - 02.11.2018

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


Re: SetPlayerNameForPlayer - KoloradO - 02.11.2018

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


Re: SetPlayerNameForPlayer - BrunoBM23 - 02.11.2018

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


Re: SetPlayerNameForPlayer - B4dSh33p - 02.11.2018

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



Re: SetPlayerNameForPlayer - Cycle - 03.11.2018

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.