Adding 3dtext label
#1

So, i'm trying to figure out how to add a 3dtextlabel to my gate creation and entrance system.

pawn Код:
enum _EntranceEnum
    {
        EntranceID,
        Float:eX,
        Float:eY,
        Float:eZ,
        Float:eA,
        Float:iX,
        Float:iY,
        Float:iZ,
        Float:iA,
        EntranceInt,
        EntranceWorld
    }
pawn Код:
Entrances[MAX_ENTRANCES][_EntranceEnum], tTotalEntrances,
Код:
CMD:addentrance
		{
			if(PlayerInfo[playerid][pNewAdmin] == 13)
			{
				static Float:x, Float:y, Float:z, Float:a, Float:ix, Float:iy, Float:iz, Float:ia, int, vw;
				new section[10];
				if(sscanf(params, "s[10]", section))return SendClientMessage(playerid, GREY, "Usage: /addentrance [exterior/interior/complete]");
				{
					if(strmatch(section, "interior"))
					{
						GetPlayerPos(playerid, ix, iy, iz);
						GetPlayerFacingAngle(playerid, ia);
						int = GetPlayerInterior(playerid);
						format(string, sizeof(string), "Interior set. (x: %f y: %f z: %f a: %f interior: %d", ix, iy, iz, ia, int);
						SendClientMessage(playerid, GREY, string);
					}
					else if(strmatch(section, "exterior"))
					{
						GetPlayerPos(playerid, x, y, z);
						GetPlayerFacingAngle(playerid, a);
						format(string, sizeof(string), "Exterior set (x: %f y: %f z: %f a: %f)", x, y, z, a);
						SendClientMessage(playerid, GREY, string);
					}
					else if(strmatch(section, "complete"))
					{
						SendClientMessage(playerid, GREY, "You have sucessfully added a new entrance.");
						SetPlayerPos(playerid, x, y, z);
						SetPlayerFacingAngle(playerid, a);
						SetPlayerInterior(playerid, 0);
						new rand = 10000 + random(89999);
						vw = rand;
						SaveEntrance(x, y, z, a, ix, iy, iz, ia, int, vw);
					}
					else return SendClientMessage(playerid, GREY, "Usage: /addentrance [exterior/interior/complete]");
				}
			}
			else return SendClientMessage(playerid, GREY, "You aren't an Administrator.");
			return 1;
		}
Код:
for(new i = 0; i < MAX_ENTRANCES; i++)
			{
				if(IsPlayerInRangeOfPoint(playerid, 5.0, Entrances[i][eX], Entrances[i][eY], Entrances[i][eZ]))
				{
					SetPlayerPos(playerid, Entrances[i][iX], Entrances[i][iY], Entrances[i][iZ]);
					SetPlayerFacingAngle(playerid, Entrances[i][iA]);
					SetPlayerVirtualWorld(playerid, Entrances[i][EntranceWorld]);
					SetPlayerInterior(playerid, Entrances[i][EntranceInt]);
				}
			}
			for(new i = 1; i < MAX_ENTRANCES; i++)
			{
				if(GetPlayerVirtualWorld(playerid) == Entrances[i][EntranceWorld])
				{
					if(IsPlayerInRangeOfPoint(playerid, 2.0, Entrances[i][iX], Entrances[i][iY], Entrances[i][iZ]))
					{
						SetPlayerPos(playerid, Entrances[i][eX], Entrances[i][eY], Entrances[i][eZ]);
						SetPlayerFacingAngle(playerid, Entrances[i][eA]);
						SetPlayerInterior(playerid, 0);
						SetPlayerVirtualWorld(playerid, 0);
					}
				}
			}
Код:
for(new i = 0; i < MAX_ENTRANCES; i++)
			{
				if(IsPlayerInRangeOfPoint(playerid, 5.0, Entrances[i][eX], Entrances[i][eY], Entrances[i][eZ]))
				{
					SetPlayerPos(playerid, Entrances[i][iX], Entrances[i][iY], Entrances[i][iZ]);
					SetPlayerFacingAngle(playerid, Entrances[i][iA]);
					SetPlayerVirtualWorld(playerid, Entrances[i][EntranceWorld]);
					SetPlayerInterior(playerid, Entrances[i][EntranceInt]);
				}
			}
			for(new i = 1; i < MAX_ENTRANCES; i++)
			{
				if(GetPlayerVirtualWorld(playerid) == Entrances[i][EntranceWorld])
				{
					if(IsPlayerInRangeOfPoint(playerid, 2.0, Entrances[i][iX], Entrances[i][iY], Entrances[i][iZ]))
					{
						SetPlayerPos(playerid, Entrances[i][eX], Entrances[i][eY], Entrances[i][eZ]);
						SetPlayerFacingAngle(playerid, Entrances[i][eA]);
						SetPlayerInterior(playerid, 0);
						SetPlayerVirtualWorld(playerid, 0);
					}
				}
			}
Код:
stock SaveEntrance(Float:x, Float:y, Float:z, Float:a, Float:ix, Float:iy, Float:iz, Float:ia, int, vw)
{
	new query[512];
	format(query, sizeof(query), "INSERT INTO `entrances` (`ex`, `ey`, `ez`, `ea`, `ix`, `iy`, `iz`, `ia`, `int`, `vw`) VALUES(%f, %f, %f, %f, %f, %f, %f, %f, %d, %d)", x, y, z, a, ix, iy, iz, ia, int, vw);
	mysql_query(query);

	tTotalEntrances++;

	Entrances[tTotalEntrances][EntranceID] = mysql_insert_id();
	Entrances[tTotalEntrances][eX] = x;
	Entrances[tTotalEntrances][eY] = y;
	Entrances[tTotalEntrances][eZ] = z;
	Entrances[tTotalEntrances][eA] = a;
	Entrances[tTotalEntrances][iX] = ix;
	Entrances[tTotalEntrances][iY] = iy;
	Entrances[tTotalEntrances][iZ] = iz;
	Entrances[tTotalEntrances][iA] = ia;
	Entrances[tTotalEntrances][EntranceInt] = int;
	Entrances[tTotalEntrances][EntranceWorld] = vw;

	CreatePickup(1239, 1, x, y, z, 0);
	return 1;
}
Reply
#2

PHP код:
enum _EntranceEnum
{
    
EntranceID,
    
Float:eX,
    
Float:eY,
    
Float:eZ,
    
Float:eA,
    
Float:iX,
    
Float:iY,
    
Float:iZ,
    
Float:iA,
    
EntranceInt,
    
EntranceWorld,
    
Text3DElabel

PHP код:
stock SaveEntrance(Float:xFloat:yFloat:zFloat:aFloat:ixFloat:iyFloat:izFloat:iaintvw)
{
    new 
query[200];
    
format(querysizeof(query), "INSERT INTO `entrances` (`ex`, `ey`, `ez`, `ea`, `ix`, `iy`, `iz`, `ia`, `int`, `vw`) VALUES(%f, %f, %f, %f, %f, %f, %f, %f, %d, %d)"xyzaixiyiziaintvw);
    
mysql_query(query);
    
tTotalEntrances ++;
    
Entrances[tTotalEntrances][EntranceID] = mysql_insert_id();
    
Entrances[tTotalEntrances][eX] = x;
    
Entrances[tTotalEntrances][eY] = y;
    
Entrances[tTotalEntrances][eZ] = z;
    
Entrances[tTotalEntrances][eA] = a;
    
Entrances[tTotalEntrances][iX] = ix;
    
Entrances[tTotalEntrances][iY] = iy;
    
Entrances[tTotalEntrances][iZ] = iz;
    
Entrances[tTotalEntrances][iA] = ia;
    
Entrances[tTotalEntrances][EntranceInt] = int;
    
Entrances[tTotalEntrances][EntranceWorld] = vw;
    
format(querysizeof query"Gate #%d"Entrances[tTotalEntrances][EntranceID]);
    
Entrances[tTotalEntrances][Elabel] = CreateDynamic3DTextLabel(query, -1xyz30.0, .testlos 0, .worldid vwinteriorid int);
    
CreateDynamicPickup(12391xyz, .worldid vw, .interiorid int);
    return 
1;

Mind showing the loading part as well?

Rest will stay the same
Reply
#3

Oh yeah, sorry for missing that out and also the late reply, i posted this last night, here's the load to.

Код:
stock LoadEntrances()
{
	new Str[512], eID, Float:ex, Float:ey, Float:ez, Float:ea, Float:ix, Float:iy, Float:iz, Float:ia, int, vw, i = 1;
	mysql_query("SELECT * FROM `entrances`");
	mysql_store_result();
	if(mysql_num_rows() > 0)
	{
		while(mysql_fetch_row(Str))
		{
			sscanf(Str, "p<|>iffffffffii", eID, ex, ey, ez, ea, ix, iy, iz, ia, int, vw);
			Entrances[i][EntranceID] = eID;
			Entrances[i][eX] = ex;
			Entrances[i][eY] = ey;
			Entrances[i][eZ] = ez;
			Entrances[i][eA] = ea;
			Entrances[i][iX] = ix;
			Entrances[i][iY] = iy;
			Entrances[i][iZ] = iz;
			Entrances[i][iA] = ia;
			Entrances[i][EntranceInt] = int;
			Entrances[i][EntranceWorld] = vw;

			CreatePickup(1239, 1, ex, ey, ez, -1);

			tTotalEntrances++;
			i++;
		}
	}
	mysql_free_result();
	return 1;
}
Reply
#4

Any help would be greatly appreciated.
Reply
#5

PHP код:
stock LoadEntrances()
{
    new 
Str[100], eIDFloat:exFloat:eyFloat:ezFloat:eaFloat:ixFloat:iyFloat:izFloat:iaintvw0strz[10];
    
mysql_query("SELECT * FROM `entrances`");
    
mysql_store_result();
    if(
mysql_num_rows() > 0)
    {
        while(
mysql_fetch_row(Str))
        {
            
sscanf(Str"p<|>iffffffffii"eIDexeyezeaixiyiziaintvw);
            
+=1;
            
Entrances[i][EntranceID] = eID;
            
Entrances[i][eX] = ex;
            
Entrances[i][eY] = ey;
            
Entrances[i][eZ] = ez;
            
Entrances[i][eA] = ea;
            
Entrances[i][iX] = ix;
            
Entrances[i][iY] = iy;
            
Entrances[i][iZ] = iz;
            
Entrances[i][iA] = ia;
            
Entrances[i][EntranceInt] = int;
            
Entrances[i][EntranceWorld] = vw;
            
format(strzsizeof strz"Gate #%d"Entrances[tTotalEntrances][EntranceID]); 
            
Entrances[i][Elabel] = CreateDynamic3DTextLabel(strz, -1xyz30.0, .testlos 0, .worldid vwinteriorid int);
            
CreateDynamicPickup(12391xyz, .worldid vw, .interiorid int);
        }
    }
    
tTotalEntrances i;
    
mysql_free_result();
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)