SA-MP Forums Archive
How do i do this? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How do i do this? (/showthread.php?tid=628973)



How do i do this? - Stones - 17.02.2017

So, basically, i want to add a 3dtextlabel when adding an interior, like an interior enter/exit point.

So when i'm in game, i type my command i create the interior and then it gives me the option to name it with a 3d text label.

Код:
		if(strcmp(cmd, "/addentrance", true) == 0)
		{
			if(PlayerInfo[playerid][pNewAdmin] == 8)
			{
				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;
		}
Код:
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;
}



Re: How do i do this? - Stones - 18.02.2017

bump


Re: How do i do this? - JesterlJoker - 18.02.2017

No one would reply since you aren't showing what the problem is, you are not even pointing something out from your codes since it looks good already.

Are you implying that your code does not work? or are you implying that you want that code to be improved?


Re: How do i do this? - Stones - 18.02.2017

Quote:
Originally Posted by JesterlJoker
Посмотреть сообщение
No one would reply since you aren't showing what the problem is, you are not even pointing something out from your codes since it looks good already.

Are you implying that your code does not work? or are you implying that you want that code to be improved?
No, nothing is wrong with it, i'm simply just asking how do i edit this so that it creates 3d text labels are interior entrance points.



Re: How do i do this? - JesterlJoker - 18.02.2017

PHP код:
stock SaveEntrance(Float:xFloat:yFloat:zFloat:aFloat:ixFloat:iyFloat:izFloat:iaintvw)
{
    new 
query[512];
    
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;

    
Create3DTextLabel("Entrance"Your color herexyz+0.520.0vw);
    
CreatePickup(12391xyz0);
    return 
1;

That would suffice and you do the same with the interior entrances

but there is also
CreateDynamic3DTextLabel() from streamer if you want it, you can set both vw and int for both interior and exterior entrances. It depends on your

for the down part the dialog thing
PHP код:
if(strcmp(cmd"editentrancename"true) == 1)
{
    
ShowPlayerDialog(playeridDIALOG_EDITDNAMEDIALOG_STYLE_INPUT"Type specified door name""NOTE: Must be valid length for name.""Change""Cancel");
    return 
1;
}

// on your dialog response add this
if(dialogid == DIALOG_EDITNAME)
{
    if(
strval(inputtext) < || strval(inputtext) > 24) return ShowPlayerDialog(playeridDIALOG_EDITDNAMEDIALOG_STYLE_INPUT"Type specified door name""NOTE: Must be valid length for name.""Change""Cancel");
    new 
name[25];
    
name strval(inputtext);
    
//you'll know the rest