new Float: poscord[3]; |
CMD:getco(playerid, params[]) { new giveplayerid; if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /getco [playerid]"); GetPlayerPos(giveplayerid, poscord[0], poscord[1], poscord[2]); if(IsPlayerInRangeOfPoint(playerid, 700, poscord[0], poscord[1], poscord[2])) { if(IsPlayerConnected(giveplayerid)) { SetTimer("GetLocation", 4000, 0); SendClientMessage(playerid, COLOR_GRAD4, "Analizing and Calculating Target Coordinates ( 4 Seconds )"); // SendClientMessage(playerid, COLOR_GRAD4, "Target Coordinates X - %d | Y - %d | Z - %d", poscord[0], poscord[1], poscord[2]); } } else { SendClientMessage(playerid, COLOR_GRAD4, "Target Coordinates cannot be taken, range from target is too far"); } return 1; } |
forward GetLocation(playerid); public GetLocation(playerid) { new giveplayerid; GetPlayerPos(giveplayerid, poscord[0], poscord[1], poscord[2]); SendClientMessage(playerid, COLOR_GRAD4, "Target Coordinates successfully recieved"); SendClientMessage(playerid, COLOR_GRAD4, "Target Coordinates X - %d | Y - %d | Z - %d", poscord[0], poscord[1], poscord[2]); return 1; } |
new string[128];
format(string, sizeof(string), "Target Coordinates X - %f | Y - %f | Z - %f", poscord[0], poscord[1], poscord[2]);
SendClientMessage(playerid, COLOR_GRAD4, string);
SendClientMessage does not accept all of those additional parameters and cannot be used to format a string, you need to use a function such as format for that, for example:
pawn Код:
|
forward GetLocation(playerid);
public GetLocation(playerid)
{
new giveplayerid;
new string[128];
GetPlayerPos(giveplayerid, poscord[0], poscord[1], poscord[2]);
SendClientMessage(playerid, COLOR_GRAD4, "Target Coordinates successfully recieved");
format(string, sizeof(string), "Target Coordinates X - %f | Y - %f | Z - %f", poscord[0], poscord[1], poscord[2]);
SendClientMessage(playerid, COLOR_GRAD4, string);
return 1;
}