18.09.2012, 08:12
Hello there,
so I made my first dynamic system for small events. But I got problems with it. After I compiled it, everything seems good, no errors / warnings. Here's the code :
Defined max event points,
The point count
The enumeration and here are the commands ->
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 ...
Also when I try to /claimpoint, nothing happens...
I havent created stocks to save them, because I don't want to, they are like mini - events.
P.S. please don't laugh on my script, it's my first system
so I made my first dynamic system for small events. But I got problems with it. After I compiled it, everything seems good, no errors / warnings. Here's the code :
pawn Код:
#define MAX_EVENT_POINTS 4
pawn Код:
new ePointCount;
pawn Код:
enum EventData
{
Float: ePosX,
Float: ePosY,
Float: ePosZ,
eVW,
eInterior,
Text3D: eText,
eCapturePlace
}
new EventInfo[MAX_EVENT_POINTS][EventData];
pawn Код:
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;
}
pawn Код:
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;
}
Also when I try to /claimpoint, nothing happens...
I havent created stocks to save them, because I don't want to, they are like mini - events.
P.S. please don't laugh on my script, it's my first system
