SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 14/04/2019, 05:23 AM   #1
AngeloBrand98
Big Clucker
 
Join Date: Sep 2016
Posts: 66
Reputation: 0
Question Need help with /addhouseint commands

I make an simple house system with interoir and its work, but still have little problem, here is the code:

Code:
CMD:addhouseint(playerid, params[])
{
	new giveplayerid, moneys1, string[256], tmp2[256];
	if (adlvl[playerid] < 6) return 0;
	if (sscanf(params, "dd", giveplayerid, moneys1)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /addhouseint [houseid] [door]");
	format(string, 10, "prop%d", giveplayerid);
	if (!dini_Exists(AddDirFile(dir_propfiles, string))) return SendClientMessage2(playerid, COLOR_RED, "Invalid house id.");
	if (moneys1 < 1 || moneys1 > MAX_PROP_INTS) return SendClientMessage2(playerid, COLOR_RED, "Invalid door id.");
	if (GetPlayerShamalID(playerid) != 0) return SendClientMessage2(playerid, COLOR_RED, "You can't add house interiors to this interior.");
	new temp1, temp2;
	temp1 = dini_Int(AddDirFile(dir_datafiles, FILE_TOTALSTAT), "maxpropint");
	temp2 = dini_Isset(AddDirFile(dir_propfiles, string), "interior") ? dini_Int(AddDirFile(dir_propfiles, string), "interior") : temp1+1;
	format(tmp2, 12, "propint%d", temp2);
	if (temp2 == temp1+1)
	{
		dini_IntSet(AddDirFile(dir_datafiles, FILE_TOTALSTAT), "maxpropint", temp2);
		dini_Create(AddDirFile(dir_propints, tmp2));
		dini_IntSet(AddDirFile(dir_propints, tmp2), "propid", giveplayerid);
		dini_IntSet(AddDirFile(dir_propfiles, string), "interior", temp2);
	}
	temp1 = temp2 + dini_Int(AddDirFile(dir_datafiles, FILE_TOTALSTAT), "enterexits");
	GetPlayerPos(playerid, adata[temp1][ax], adata[temp1][ay], adata[temp1][az]);
	GetPlayerFacingAngleFix(playerid, adata[temp1][aa]);
	adata[temp1][aa] = adata[temp1][aa] < 180.0 ? adata[temp1][aa] + 180.0 : adata[temp1][aa] - 180.0;
	adata[temp1][linkto] = propdoors[moneys1-1];
	adata[temp1][ax] += floatsin(-adata[temp1][aa], degrees) * 0.3;
	adata[temp1][ay] += floatcos(-adata[temp1][aa], degrees) * 0.3;
	dini_IntSet(AddDirFile(dir_propints, string), "locked", 0);
	dini_IntSet(AddDirFile(dir_propints, tmp2), "door", propdoors[moneys1-1]);
	dini_FloatSet(AddDirFile(dir_propints, tmp2), "X", adata[temp1][ax]);
	dini_FloatSet(AddDirFile(dir_propints, tmp2), "Y", adata[temp1][ay]);
	dini_FloatSet(AddDirFile(dir_propints, tmp2), "Z", adata[temp1][az]);
	dini_FloatSet(AddDirFile(dir_propints, tmp2), "A", adata[temp1][aa]);
	if (propints[temp2] != 0)
	{
		DestroyDynamicObject(propints[temp2]);
		propints[temp2] = 0;
		for (new i = 1; i <= MAX_AREAS; i++)
		{
			if (areatype[i][1] == temp1)
			{
				DestroyDynamicArea(i);
				areatype[i][0] = 0;
				areatype[i][1] = 0;
				break;
			}
		}
	}
	propints[temp2] = CreateDynamicObject(19198, adata[temp1][ax], adata[temp1][ay], adata[temp1][az]+0.35, 0.0, 0.0, 0.0, -1, -1, -1, 50.0);
	moneys1 = CreateDynamicSphere(adata[temp1][ax], adata[temp1][ay], adata[temp1][az], 1.0, -1, -1, -1);
	areatype[moneys1][0] = AREA_TYPE_ENTEREXIT;
	areatype[moneys1][1] = temp1;
	areatype[moneys1][2] = temp2;
	for (new i = 0; i < PLAYERS; i++)
	{
		if (IsPlayerInRangeOfPoint(i, 50.0, adata[temp1][ax], adata[temp1][ay], adata[temp1][az]+0.35)) Streamer_Update(i);
	}
	format(string, 64, "Added interior to house ID %d", giveplayerid);
	SendClientMessage2(playerid, COLOR_WHITE, string);
	return 1;
}
Can you help me to fix? when i added a house interior, it created an yellow marker, but the yellow marker not animated (go up-down) like a normal interior marker in gta san andreas. Did i miss something from the code above? really need help for this.
AngeloBrand98 is offline   Reply With Quote
Old 14/04/2019, 07:29 AM   #2
Crayder
Banned
 
Join Date: Sep 2013
Location: Flames of Hell
Posts: 3,324
Reputation: 652
Default Re: Need help with /addhouseint commands

Create[Dynamic]Pickup is the function you're looking for, or you can fancy your own pickup system that moves the object up and down.

Currently you just create the object and an area to detect entry, which is not a pickup.
Crayder is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Login/Register using ZCMD SSCANF & Y_INI.( Admin commands + VIP System + VIP Commands! ) Zh3r0 Filterscripts 116 09/01/2015 10:57 AM
Few problems with admin commands + player commands. zClaw Scripting Help 0 05/12/2013 11:36 AM
My Filterscript makes it so no server commands work (IE. Commands in the GM) [MM]18240[FMB] Scripting Help 16 18/07/2012 11:46 PM
Transforming zcmd's commands to regular commands nuriel8833 Help Archive 17 08/01/2011 05:41 AM
DCMD Commands not working after adding some ZCMD commands :S [L3th4l] Help Archive 4 20/01/2010 09:57 PM


All times are GMT. The time now is 05:21 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.