הנה הXYZ שעשיתי בשרת שלך:
PHP Code:
AddPlayerClass(265,330.7865,-1784.5262,4.9115,9.9309,0,0,0,0,0,0); //
עכשיו זה לא XYZ זה XYZA וצריך רק XYZ אז תראה קודם כל מעתיקים רק תמספרים תתעלם מהפסיק הראשון וספור שני פסיקים אחרי הפסיק השני תעתיק על לשלישי ככה:
PHP Code:
330.7865,-1784.5262,4.9115
הפונקציה PlayerToPoint תעזור פה
למעלה במוד:
PHP Code:
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
למטה:
PHP Code:
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}
עכשיו נקח את הXYZ שהעתקתי ונעשה כך:
if(
PlayerToPoint(
25.0,playerid,
330.7865,-1784.5262,4.9115))
ירוק:XYZ
כחול:רדיוס
כתום:פונקציה
יופי עכשיו נוסיף לשני הפקודות את זה:
PHP Code:
if(PlayerToPoint(25.0,playerid,330.7865,-1784.5262,4.9115)) {
ובסוף לפני הRETURN
PHP Code:
}
else { SendClientMessage(playerid, COLOR_GREY,"Destination is too far."); }
}
הפקודות:
PHP Code:
if(strcmp(cmdtext, "/close", true) == 0) {
if(PlayerToPoint(25.0,playerid,330.7865,-1784.5262,4.9115)) {
SendClientMessage(playerid, 0x990000AA, "!äùòø ðñâø");
MoveObject(Bar,330.228027, -1781.839111, 6.714324,2.5);
}
else { SendClientMessage(playerid, COLOR_GREY,"Destination is too far."); }
}
return 1;
}
//
if(strcmp(cmdtext, "/open", true) == 0) {
if(PlayerToPoint(25.0,playerid,330.7865,-1784.5262,4.9115)) {
MoveObject(Bar,330.239166, -1781.812866, 1.002223, 3.0);
SendClientMessage(playerid, 0x12900BBF, "!äùòø ðôúç");
}
else { SendClientMessage(playerid, COLOR_GREY,"Destination is too far."); }
}
return 1;}