Player Spec Problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Player Spec Problem (
/showthread.php?tid=567625)
Player Spec Problem -
sampkinq - 15.03.2015
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]);
}
Re: Player Spec Problem -
ATGOggy - 15.03.2015
Try this:
PHP код:
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]; //->>>>>>>>>>>>>
GetPlayerName(pID, kName, MAX_PLAYER_NAME); // ->>>>>>>>
TogglePlayerSpectating(playerid, 1); // ->>>>>>>
PlayerSpectatePlayer(playerid, pID); // ->>>>>>>>>
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]);
}
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.
Re: Player Spec Problem -
sampkinq - 15.03.2015
Thank You. How can I change player
Re: Player Spec Problem -
ATGOggy - 15.03.2015
Use GetClosestPlayer(pID) and find the next player to spectate.