#define MAX_EVENT_POINTS 4
new ePointCount;
enum EventData
{
Float: ePosX,
Float: ePosY,
Float: ePosZ,
eVW,
eInterior,
Text3D: eText,
eCapturePlace
}
new EventInfo[MAX_EVENT_POINTS][EventData];
command(createpoint, playerid, params[])
{
if(Player[playerid][AdminLevel] >= 2)
{
new text[30], string[128], id = ePointCount;
if(sscanf(params, "s", text)) return SendClientMessage(playerid, WHITE, "SYNTAX: /createpoint [text]");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
EventInfo[id][ePosX] = x;
EventInfo[id][ePosY] = y;
EventInfo[id][ePosZ] = z;
EventInfo[id][eVW] = GetPlayerVirtualWorld(playerid);
EventInfo[id][eInterior] = GetPlayerInterior(playerid);
format(string, sizeof(string), "*Capture Point ID %d created at PosX(%d), PosY(%d), PosZ(%d)", ePointCount, EventInfo[id][ePosX], EventInfo[id][ePosY], EventInfo[id][ePosZ]);
SendClientMessage(playerid, NICESKY, string);
ePointCount++;
EventInfo[id][eCapturePlace] = CreatePickup(1274, 1, EventInfo[id][ePosX], EventInfo[id][ePosY], EventInfo[id][ePosZ]);
new labelstring[60];
format(labelstring, sizeof(labelstring), "Capture Point ID %d \n Prize: %s \n /claimpoint to claim the point", ePointCount, text);
EventInfo[id][eText] = Create3DTextLabel(labelstring, NICESKY, EventInfo[id][ePosX], EventInfo[id][ePosY], EventInfo[id][ePosZ], 15.0, -1, 0);
}
return 1;
}
command(claimpoint, playerid, params[])
{
new id = ePointCount;
if(IsPlayerInRangeOfPoint(playerid, 5.0, EventInfo[id][ePosX], EventInfo[id][ePosY], EventInfo[id][ePosZ]))
{
new string[128], name[24];
GetPlayerName(playerid, name, sizeof(name));
DestroyPickup(EventInfo[id][eCapturePlace]);
Delete3DTextLabel(EventInfo[id][eText]);
format(string, sizeof(string), "AdmWarning: %s has claimed Event Point ID %d", name, ePointCount);
SendToAdmins(ADMINORANGE, string, 1);
}
return 1;
}
|
So the problem is when I create the point with /createpoint, it's good, creating it, but the 3D Text is just dissapearing .... and only the icon stays ...
|
Create3DTextLabel(text[], color, Float:X, Float:Y, Float:Z, Float:DrawDistance, virtualworld, testLOS)
Create3DTextLabel(labelstring, NICESKY, EventInfo[id][ePosX], EventInfo[id][ePosY], EventInfo[id][ePosZ], 15.0, -1, 0);
Create3DTextLabel(labelstring, NICESKY, EventInfo[id][ePosX], EventInfo[id][ePosY], EventInfo[id][ePosZ], 100.0, -1, 0);
|
Код:
enum EventData
{
Float: ePosX,
Float: ePosY,
Float: ePosZ,
eVW,
eInterior,
Text3D: eText,
eCapturePlace
}
|
#define MAX_EVENT_POINTS 4
enum EventData {
Float: ePosX,
Float: ePosY,
Float: ePosZ,
eVW,
eInterior,
Text3D: eText,
eCapturePlace,
ePrize
}
new EventInfo[MAX_EVENT_POINTS][EventData], ePointCount = -1;
command(createpoint, playerid, params[])
{
if(Player[playerid][AdminLevel] < 2)
return 1;
new string[128],
prize,
id = (ePointCount += 1); //Equal: ePointCount++; id = ePointCount;
if(sscanf(params, "i", prize))
return SendClientMessage(playerid, NICESKY, "SYNTAX: /createpoint [prize/money/amount]");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
EventInfo[id][ePosX] = x;
EventInfo[id][ePosY] = y;
EventInfo[id][ePosZ] = z;
EventInfo[id][eVW] = GetPlayerVirtualWorld(playerid);
EventInfo[id][eInterior] = GetPlayerInterior(playerid);
EventInfo[id][ePrize] = prize;
format(string, sizeof(string), "Capture Point ID %d \n Prize: %d \n /claimpoint to claim the point", ePointCount, prize);
EventInfo[id][eText] = CreateDynamic3DTextLabel(string, NICESKY, EventInfo[id][ePosX], EventInfo[id][ePosY], EventInfo[id][ePosZ], 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, EventInfo[id][eVW], EventInfo[id][eInterior], -1, 100.0);
EventInfo[id][eCapturePlace] = CreateDynamicPickup(1274, 1, EventInfo[id][ePosX], EventInfo[id][ePosY], EventInfo[id][ePosZ], EventInfo[id][eVW], EventInfo[id][eInterior], -1, 100.0);
format(string, sizeof(string), "*Capture Point ID %d created at PosX(%.3f), PosY(%.3f), PosZ(%.3f)", ePointCount, EventInfo[id][ePosX], EventInfo[id][ePosY], EventInfo[id][ePosZ]);
SendClientMessage(playerid, NICESKY, string);
return 1;
}
command(claimpoint, playerid, params[])
{
new id = ePointCount;
if(id == -1) {
SendClientMessage(playerid, ADMINORANGE, "CLAIMPOINT: No capture point created");
return 1;
}
if(IsPlayerInRangeOfPoint(playerid, 7.0, EventInfo[id][ePosX], EventInfo[id][ePosY], EventInfo[id][ePosZ])) {
new string[128], name[24];
GetPlayerName(playerid, name, sizeof(name));
//The line below is a comment because I did not understand for what purpose is created players[to take take the prize]/admin [to remove the capture point] ???
//GivePlayerMoney(playerid, EventInfo[id][ePrize]);
DestroyDynamicPickup(EventInfo[id][eCapturePlace]);
DestroyDynamic3DTextLabel(EventInfo[id][eText]);
format(string, sizeof(string), "AdmWarning: %s has claimed Event Point ID %d", name, ePointCount);
SendToAdmins(ADMINORANGE, string, 1);
ePointCount -= 1; //Equal: ePointCount--;
}
else {
SendClientMessage(playerid, ADMINORANGE, "CLAIMPOINT: You must be in the last capture point created");
}
return 1;
}
Specifier(s) Name Example values i, d Integer 1, 42, -10 c Character a, o, * l Logical true, false b Binary 01001, 0b1100 h, x Hex 1A, 0x23 o Octal 045 12 n Number 42, 0b010, 0xAC, 045 f Float 0.7, -99.5 g IEEE Float 0.7, -99.5, INFINITY, -INFINITY, NAN, NAN_E u User name/id (bots and players) ******, 0 q Bot name/id ShopBot, 27 r Player name/id ******, 42