SA-MP Forums Archive
HELP with APPLYING commands for interriors - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: HELP with APPLYING commands for interriors (/showthread.php?tid=135544)



HELP with APPLYING commands for interriors - Assyria - 20.03.2010

Hello!

I have a command like "/drink" set up with some menus. By default the "/drink" works everywhere by just typing it.
So what Im asking is how to make the "/drink" work only in some interriors and NOT everywhere?

Do I have to make like those red circles when where standing, it allows /drink?
If so, please tell me how to do that too!


Regards,
Assyria


Re: HELP with APPLYING commands for interriors - Micko9 - 20.03.2010

Quote:
Originally Posted by Assyria
Hello!

I have a command like "/drink" set up with some menus. By default the "/drink" works everywhere by just typing it.
So what Im asking is how to make the "/drink" work only in some interriors and NOT everywhere?

Do I have to make like those red circles when where standing, it allows /drink?
If so, please tell me how to do that too!


Regards,
Assyria

DCMD :
dcmd_drink(playerid, params[])
{
if (GetPlayerInterior(playerid)==interiorid)
{
// code...
}
else return SendClientMessage(playerid,red,"You're Not In The Right Interior!"
}

if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
if (GetPlayerInterior(playerid)==interiorid)
{
// code...
}
else return SendClientMessage(playerid,red,"You're Not In The Right Interior!"
}


Re: HELP with APPLYING commands for interriors - Assyria - 20.03.2010

Under what I put that?


Re: HELP with APPLYING commands for interriors - Micko9 - 20.03.2010

Quote:
Originally Posted by Assyria
Under what I put that?
where is your /drink
command anyway? is it selfmade ?


Re: HELP with APPLYING commands for interriors - Assyria - 20.03.2010

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/drinks", cmdtext, true, 10) == 0)
	{
		ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "What would you like to drink?", "Sprunk ($1)\nBeer ($2)\nWine ($3)", "Purchase", "Cancel");

		return 1;
	}
	return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
(here is the menu..)
{



Re: HELP with APPLYING commands for interriors - Micko9 - 20.03.2010

Quote:
Originally Posted by Assyria
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/drinks", cmdtext, true, 10) == 0)
	{
		ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "What would you like to drink?", "Sprunk ($1)\nBeer ($2)\nWine ($3)", "Purchase", "Cancel");

		return 1;
	}
	return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
(here is the menu..)
{
first search on the internet ...hold on... Aha Here are the Interior IDs .

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/drinks", cmdtext, true, 10) == 0)
    {
        if (GetPlayerInterior(playerid)==interiorid) // Replace Interior ID With The Interior ID you want from the link i gave you
        {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "What would you like to drink?", "Sprunk ($1)\nBeer ($2)\nWine ($3)", "Purchase", "Cancel");
        }
        else return SendClientMessage(playerid,0xAA0000AA,"Youre Not In The Right Place!");
        return 1;
    }
    return 0;
}
if you want that you can be in more interiors to purchase it add
pawn Код:
|| interiorid2
Add That Here :
pawn Код:
if (GetPlayerInterior(playerid)==interiorid || interiorid) // You Can Add as many as you want .




Re: HELP with APPLYING commands for interriors - Assyria - 21.03.2010

Ok This is what I got right now


Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/drinks", cmdtext, true, 10) == 0)
	{
		if(GetPlayerInterior(playerid)== 3 && IsPlayerInRangeOfPoint(playerid,15,-103.559165,-24.225606,1000.718750)) {
		ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "What would you like to drink?", "Sprunk ($1)\nBeer ($2)\nWine ($3)", "Purchase", "Cancel");
		}
		else return SendClientMessage(playerid,0xAA0000AA,"You have to be in a bar!");
		return 1;
	}
	return 0;
But when Im in the interior and even teleport to EXACTLY the position of it wants, I still get "You have to be in a bar" when /drinks

Anybody can tell whats wrong?

EDIT: Ok, I got it working!

But now I need to know how to make this thing available for many different positions!