Dynamic Lockers(small fix probably)
#1

Hi!

So, I have this dynamic locker system for a faction(LSPD).

When I click 'move to my location' it creates a locker point at my location and creates 3DText, it all works and I can /locker and that exact point

but when I try to set ANOTHER locker point nothing happens..

Code:


Код:
CMD:lockers(playerid, params[])
{
	new rank = PlayerInfo[playerid][pLSPD];
    if(rank < 1) return SCM(playerid, COLOR_WHITE, "You are not authorised to use that command.");
    {
	for(new i=1; i < MAX_FUEL_STATIONS; i++)
	{
		if(LockersPointCreated[i])
		{
			if(IsPlayerInRangeOfPoint(playerid, 15.0, LockerPos[i][0], LockerPos[i][1], LockerPos[i][2]))
			{
				ShowPlayerDialog(playerid, 249, DIALOG_STYLE_LIST, "Lockers", "Duty\nEquipment\nClothing\nUnder-Cover", "Select", "Cancel");
				return 1;
			}
		}
	}
	}
	return 1;
}
Код:
new LockersPointCreated[MAX_LOCKERS_POINT];
new Float:LockerPos[MAX_LOCKERS_POINT][3];
#define MAX_LOCKERS_POINT 50
Dialog response:
Код:
	if(dialogid == 1352) // LSPD LOCKER POINTS RESPONSES
	{
	if(response)
	{
	if(listitem == 0)
	{
	for(new i=1; i < MAX_LOCKERS_POINT; i++)
	{
	if(!LockersPointCreated[i])
	{
	new  Float: fTextPos[3];
	GetPlayerPos(playerid, fTextPos[0], fTextPos[1], fTextPos[2]);
	Create3DTextLabel(labelstr, 0xFFFFFFFF, fTextPos[0], fTextPos[1], fTextPos[2], 5.0, GetPlayerVirtualWorld(playerid), .testLOS = 1);
	GetPlayerPos(playerid, LockerPos[i][0], LockerPos[i][1], LockerPos[i][2]);
    LockersPointCreated[i] = 1;
    SaveFactionSystem(i);
	}
	if(listitem == 1)
	{
	SendClientMessage(playerid, COLOR_WHITE, "You have cancelled the locker position.");
	}
	}
	}
	}
	}
I dont get any warnings or errors either
Ignore the save faction system too, I added that a few minutes ago, that has nothing to do with it

Thanks so much ;3
Reply
#2

Anyone?

+rep for anyone who can even help
Reply
#3

the bug is at the response,what your cmd does is making all lockers on one point,
make a new variable like CURRENT_MADE_LOCKERS,
stock CountLockers and make it count current made lockers and set the value for the variable.
then at the dialog response make a new variable and define it as CURRENT_MADE_LOCKERS + 1(makes the next id)
and use the variable instead of the i which goes to the limit.

hope it helped
if you want help more detailfully pm me
Reply
#4

PM'd you :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)