Player Spec Problem
#1

Hello, how can I solve the problem occurs in tracking the player through the water

Video:
[ame="http://www.youtube.com/watch?v=xJ9E9lGVT3o"]http://www.youtube.com/watch?v=xJ9E9lGVT3o[/ame]

Код:
if(suPatlamaInmeCikma[playerid] == 1)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(IsPlayerInRangeOfPoint(playerid, 0.5, X, Y, 0.0))
{
new pName[MAX_PLAYER_NAME],string[256];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
new pID = GetClosestPlayer(playerid);
if(pID == INVALID_PLAYER_ID) {
format(string,256,"[Derby] Oyuncu %s Suya Dьştь",pName);
SendClientMessageToAll(-1,string);
SuyaDustuVeAractanIndi(playerid);
} else {
DususleriCek++;
if(DususleriCek == 1)
{
new kName[MAX_PLAYER_NAME]; //->>>>>>>>>>>>>
new oyuncu = GetPlayerName(pID, kName, MAX_PLAYER_NAME); // ->>>>>>>>
TogglePlayerSpectating(playerid, 1); // ->>>>>>>
PlayerSpectatePlayer(playerid, oyuncu); // ->>>>>>>>>
format(string, 256, "[Derby]  Oyuncu: %s >> %s Suya Dьşьrdь", kName,pName);
SendClientMessageToAll(-1,string);
format(string,256, "~y~~h~%s ~w~~h~(~r~~h~%s~w~~h~)", kName,pName);
TextDrawSetString(Dusus[0],string);
TextDrawShowForAll(Dusus[0]);
}
Reply
#2

Try this:
PHP код:
if(suPatlamaInmeCikma[playerid] == 1)
{
new 
Float:XFloat:YFloat:Z;
GetPlayerPos(playeridXYZ);
if(
IsPlayerInRangeOfPoint(playerid0.5XY0.0))
{
new 
pName[MAX_PLAYER_NAME],string[256];
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
new 
pID GetClosestPlayer(playerid);
if(
pID == INVALID_PLAYER_ID) {
format(string,256,"[Derby] Oyuncu %s Suya Dьştь",pName);
SendClientMessageToAll(-1,string);
SuyaDustuVeAractanIndi(playerid);
} else {
DususleriCek++;
if(
DususleriCek == 1)
{
new 
kName[MAX_PLAYER_NAME]; //->>>>>>>>>>>>>
GetPlayerName(pIDkNameMAX_PLAYER_NAME); // ->>>>>>>>
TogglePlayerSpectating(playerid1); // ->>>>>>>
PlayerSpectatePlayer(playeridpID); // ->>>>>>>>>
format(string256"[Derby]  Oyuncu: %s >> %s Suya Dьşьrdь"kName,pName);
SendClientMessageToAll(-1,string);
format(string,256"~y~~h~%s ~w~~h~(~r~~h~%s~w~~h~)"kName,pName);
TextDrawSetString(Dusus[0],string);
TextDrawShowForAll(Dusus[0]);

GetPlayerName doesn't return ID of the player or the name of the player. It returns only the length of the name of the player.
Reply
#3

Thank You. How can I change player
Reply
#4

Use GetClosestPlayer(pID) and find the next player to spectate.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)