Jump to content

Question

Posted

Problemă întâlnită (descriere): Nu reusesc sa iau coordonatele playerului de langa mine.
De exemplu daca folosesc o comanda si un player se afla langa mine sa-mi returneze un mesaj..
Ero(area / rile) / warning-(ul / urile):
Liniile de cod / sursa / script-ul:
[pawn]new Float:Xp, Float:Yp, Float:Zp;
GetPlayerPos(playerid, Xp, Yp, Zp);
if(IsPlayerInRangeOfPoint(playerid, 30.0, Xp, Yp, Zp)) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Move away from any close player before getting the work.");[/pawn]
Imagini / Video (optional):
Aţi încercat să rezolvaţi singur?: Da

5 answers to this question

Recommended Posts

Posted

Incearca asa:

[pawn]new Float:Xp, Float:Yp, Float:Zp, Target; GetPlayerPos(target, Xp, Yp, Zp);if(IsPlayerInRangeOfPoint(playerid, 30.0, Xp, Yp, Zp)) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Move away from any close player before getting the work.");[/pawn]

35012l1.png.aee1a3398b9bd9f8eec50574d2cd

  • Administrator
Posted

Trebuie sa faci un for care sa stie daca un jucator este aprope de el.

 

[pawn]if(IsPlayerInRangeOfPoint(playerid, 30.0, Xp, Yp, Zp)) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Move away from any close player before getting the work.");[/pawn]

 

asta trebuie s-o inlocuiesti cu asta

 

[pawn]for(new i = 0; i < MAX_PLAYERS; i++)

{

        if(IsPlayerConnected(i))

              if(IsPlayerInRangeOfPoint(i, 30.0, Xp, Yp, Zp))

                     return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Move away from any close player before getting the work.");

}[/pawn]

 

Aici mergi prin toti playeri, vezi daca e online, daca e online verifici daca e aproape de jucatorul respectiv, daca e ii trimiti mesajul si opresti executarea.

Posted

Trebuie sa faci un for care sa stie daca un jucator este aprope de el.

 

[pawn]if(IsPlayerInRangeOfPoint(playerid, 30.0, Xp, Yp, Zp)) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Move away from any close player before getting the work.");[/pawn]

 

asta trebuie s-o inlocuiesti cu asta

 

[pawn]for(new i = 0; i < MAX_PLAYERS; i++)

{

        if(IsPlayerConnected(i))

              if(IsPlayerInRangeOfPoint(i, 30.0, Xp, Yp, Zp))

                     return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Move away from any close player before getting the work.");

}[/pawn]

 

Aici mergi prin toti playeri, vezi daca e online, daca e online verifici daca e aproape de jucatorul respectiv, daca e ii trimiti mesajul si opresti executarea.

Parcurge toti playeri online inclusiv si pe mine.

  • Administrator
Posted

Mai pui o verificare, daca i este egal cu playerid sa continue sau sa verifice daca playerid este diferit de i. (Tot acelasi lucru e)

Posted

Mai precis , daca nu intelegi : 

 

if( i == playerid) continue;

public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.