[Ajuda] erro GetPlayerNameEx
#1

Saudaзхes,
Faz pouco tempo que comecei a aprender PAWN e estou indo muito bem, contudo, tive um problema e nem na gringa consegui entendк-lo.

Seguinte, estava vendo este tutorial:
https://sampforum.blast.hk/showthread.php?tid=626016

Aprendi vбrias coisas, fui aproveitar pra botar estes conhecimentos em prбtica e tive o seguinte problema:
Код:
error 017: undefined symbol "GetPlayerNameEx"
Eu entendi pra que ele serve, mas nгo sei porque ele nгo й reconhecido na hora de compilar, acredito que esteja faltando algo e que o problema seja bobo.

O cуdigo de /ir estava assim antes deu compactб-lo:
Код:
if(strcmp(cmd, "/ir", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USO: /ir [playerid/Parte-do-Nick]");
				return 1;
			}
			new Float:plocx,Float:plocy,Float:plocz;
			new plo;
			plo = ReturnUser(tmp);
			if (IsPlayerConnected(plo))
			{
			    if(plo != INVALID_PLAYER_ID)
			    {
					new nome[24];
                    GetPlayerName(playerid, nome, sizeof nome);
                    if(PlayerInfo[playerid][pAdmin] >= 1 && AdminDuty[playerid] == 1 || strfind(nome, ADMPLAYER, true) == 0 || strfind(nome, ADMPLAYER2, true) == 0)
					{
						if(Spectate[playerid] != 255)
						{
							Spectate[playerid] = 256;
						}
						GetPlayerPos(plo, plocx, plocy, plocz);
						if(PlayerInfo[plo][pInt] > 0)
						{
							SetPlayerInterior(playerid,PlayerInfo[plo][pInt]);
							PlayerInfo[playerid][pInt] = PlayerInfo[plo][pInt];
							PlayerInfo[playerid][pLocal] = PlayerInfo[plo][pLocal];
						}
						if(PlayerInfo[playerid][pInt] == 0)
						{
							SetPlayerInterior(playerid,0);
						}
						if(plocz > 530.0 && PlayerInfo[plo][pInt] == 0) //the highest land point in sa = 526.8
						{
							SetPlayerInterior(playerid,1);
							PlayerInfo[playerid][pInt] = 1;
						}
                        if(PlayerInfo[plo][pJailed] >= 1) //the highest land point in sa = 526.8
						{
							Carregar3(playerid);
						}
						if (GetPlayerState(playerid) == 2)
						{
							new tmpcar = GetPlayerVehicleID(playerid);
							SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
							TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
						}
						else
						{
							SetPlayerPos(playerid,plocx,plocy+2, plocz);
						}
						GetPlayerName(plo, giveplayer,256);
						GetPlayerName(playerid, sendername,256);
		                format(string, sizeof(string), "[Info] Vocк teleportou atй %s.", giveplayer);
		                SendClientMessage(playerid, COLOR_WHITE, string);
		                format(string, sizeof(string), "[Info] O admin %s, teleportou atй vocк.", sendername);
		                SendClientMessage(plo, COLOR_WHITE, string);
						format(string, sizeof(string), "[ADMIN]%s teleportou atй %s", sendername, giveplayer);
						{
							ABroadCast(COLOR_GREEN,string,1);
						}
						PayLog(string);
					}
					else
					{
						SendClientMessage(playerid, COLOR_GRAD1, "   Vocк nгo estб autorizado a usar este comando \\ ou nгo estб com admin ligado !");
					}
				}
			}
			else
			{
				format(string, sizeof(string), "   %d nгo й um player ativo.", plo);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}


E por fim deixei assim:
Код:
if(strcmp(cmd, "/ir", true) == 0)
	{
		new alvo, Float:X, Float:Y, Float:Z;
		
		if(PlayerInfo[playerid][pAdmin] == 0 && AdminDuty[playerid] == 1)	return SendClientMessage(playerid, COLOR_GRAD1, "  * Sem autorizaзгo.");
		if(IsPlayerConnected(alvo))	return SendClientMessage(playerid, COLOR_GRAD1, "  * Jogador alvo invбlido.");
		if(sscanf(cmdtext, "s[4]u", cmd, alvo))	return SendClientMessage(playerid, COLOR_GRAD1, "  * Digite /ir [ID/Parte do nick alvo]");
		if(Spectate[playerid] != 255) {Spectate[playerid] = 256;}
		
		GetPlayerPos(alvo, X, Y, Z);
        SetPlayerInterior(playerid, GetPlayerInterior(alvo));
		
		if(PlayerInfo[alvo][pJailed] >= 1) {Carregar3(playerid);}
		if(Z > 530.0 && PlayerInfo[alvo][pInt] == 0) {SetPlayerInterior(playerid,1);PlayerInfo[playerid][pInt] = 1;}
        if(IsPlayerInAnyVehicle(playerid)) {SetVehiclePos(GetPlayerVehicleID(playerid), X+2, Y+2, Z);PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid), 0);}
        else SetPlayerPos(playerid, X+2, Y+2, Z);
        
		format(string, sizeof(string), "[ADMIN]%s teleportou atй %s", sendername, giveplayer);	{ABroadCast(COLOR_GREEN,string,1);}
		PayLog(string);
        format(string, sizeof(string), "  * O(A) administrador %s (%d) foi atй sua posiзгo.", GetPlayerNameEx(playerid), playerid);
        return SendClientMessage(alvo, COLOR_YELLOW, string);
	}
//-----
Pode me ajudar? Muito obrigado por sua atenзгo.
Reply
#2

Adicione isso a gamemode
PHP код:
stock GetPlayerNameEx(playerid)
{
    new 
Nome[MAX_PLAYER_NAME];
    
GetPlayerName(playeridNomeMAX_PLAYER_NAME);
    return 
Nome;

Reply
#3

Quote:
Originally Posted by pWesley
Посмотреть сообщение
Adicione isso a gamemode
PHP код:
stock GetPlayerNameEx(playerid)
{
    new 
Nome[MAX_PLAYER_NAME];
    
GetPlayerName(playeridNomeMAX_PLAYER_NAME);
    return 
Nome;

Ah, eu observei que jб havia isto nessa GM mas com outro nome:
Код:
stock PlayerName(playerid)
{
	new Name[MAX_PLAYER_NAME];
 	GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
  	return Name;
}
Esta й uma GM de 2009 mas muito boa, estou atualizando-a.
De qualquer forma, muito obrigado.
Reply
#4

Quote:
Originally Posted by pWesley
Посмотреть сообщение
Adicione isso a gamemode
PHP код:
stock GetPlayerNameEx(playerid)
{
    new 
Nome[MAX_PLAYER_NAME];
    
GetPlayerName(playeridNomeMAX_PLAYER_NAME);
    return 
Nome;

Vocк que gosta de otimizaзгo, use assim:
PHP код:
stock GetPlayerNameEx(playerid)
{
    static 
Nome[MAX_PLAYER_NAME];
    
GetPlayerName(playeridNomeMAX_PLAYER_NAME);
    return 
Nome;

[/QUOTE]
Reply
#5

Quote:
Originally Posted by XandyMello
Посмотреть сообщение
Vocк que gosta de otimizaзгo, use assim:
PHP код:
stock GetPlayerNameEx(playerid)
{
    static 
Nome[MAX_PLAYER_NAME];
    
GetPlayerName(playeridNomeMAX_PLAYER_NAME);
    return 
Nome;

Fiz pelo celular e na correria '-'
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)