SA-MP Forums Archive
Could you help me with a script :) - 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: Could you help me with a script :) (/showthread.php?tid=259364)



Could you help me with a script :) - OoAMoO - 04.06.2011

I want to make a script that when you enter a command like /setlocation a menu comes up with a list of locations and you pick which one and then its appears in your radar then when you fly to the location you get an ammount of money

Can you help me with this?


Re: Could you help me with a script :) - xalith - 04.06.2011

its easy, you could do it on your own. everything you need is on the wiki,
you'll need to do the menu https://sampwiki.blast.hk/wiki/Creating_a_simple_Menu
then when a player chooses one create a map icon for him/her https://sampwiki.blast.hk/wiki/SetPlayerMapIcon

then use a timer to check if the player reached the point:
https://sampwiki.blast.hk/wiki/SetTimerEx
DOWNLOAD UF.INC and use GetPlayerDistanceToPoint https://sampwiki.blast.hk/wiki/Useful_Functions

and last but not least, GivePlayerMoney and RemovePlayerMapIcon and KillTimer. i think thats all

EDIT: and if you want to know if he flew to the point instead of drove use IsPlayerInPlane (which can be found in uf.inc as well),


Re: Could you help me with a script :) - OoAMoO - 04.06.2011

Thank you so much (wish me luck lol) gonna check it out and see what happens


Re: Could you help me with a script :) - AlternativeDC - 04.06.2011

Quote:
Originally Posted by xalith
Посмотреть сообщение
its easy, you could do it on your own. everything you need is on the wiki,
you'll need to do the menu https://sampwiki.blast.hk/wiki/Creating_a_simple_Menu
then when a player chooses one create a map icon for him/her https://sampwiki.blast.hk/wiki/SetPlayerMapIcon

then use a timer to check if the player reached the point:
https://sampwiki.blast.hk/wiki/SetTimerEx
DOWNLOAD UF.INC and use GetPlayerDistanceToPoint https://sampwiki.blast.hk/wiki/Useful_Functions

and last but not least, GivePlayerMoney and RemovePlayerMapIcon and KillTimer. i think thats all

EDIT: and if you want to know if he flew to the point instead of drove use IsPlayerInPlane (which can be found in uf.inc as well),
Great man i will create this for my server WoW AMAZING HELPFULL!
Yeap


Re: Could you help me with a script :) - OoAMoO - 04.06.2011

Quote:
Originally Posted by AlternativeDC
Посмотреть сообщение
Great man i will create this for my server WoW AMAZING HELPFULL!
Yeap
Isn't it just!


Re: Could you help me with a script :) - OoAMoO - 04.06.2011

"then when a player chooses one create a map icon for him/her"

How do I add that to:

Код:
// Test menu functionality filterscipt
 
#include <a_samp>
 
#define TEST_MENU_ITEMS 6
 
new Menu:TestMenu;
new TestMenuStrings[6][16] = {"Test1", "Test2", "Test3", "Test4", "Test5", "Test6"};
 
HandleTestMenuSelection(playerid, row)
{
	new s[256];
 
	if(row < TEST_MENU_ITEMS) {
		format(s,256,"You selected item %s",TestMenuStrings[row]);
		SendClientMessage(playerid,0xFFFFFFFF,s);
	}
}
 
InitTestMenu()
{
	TestMenu = CreateMenu("Test Menu", 1, 200.0, 150.0, 200.0, 200.0);
 
	for(new x=0; x < TEST_MENU_ITEMS; x++) {
    	        AddMenuItem(TestMenu, 0, TestMenuStrings[x]);
	}
}
 
public OnFilterScriptInit()
{
   	InitTestMenu();
}
 
public OnPlayerSelectedMenuRow(playerid, row)
{
        new Menu:PlayerMenu = GetPlayerMenu(playerid);
 
        if(PlayerMenu == TestMenu) {
	     HandleTestMenuSelection(playerid, row);
	}
}
 
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(!strcmp(cmdtext, "/menutest", true))	{
    	     ShowMenuForPlayer(TestMenu, playerid);
    	     return 1;
	}
	return 0;
}



Re: Could you help me with a script :) - xalith - 04.06.2011

hmm you know what, using a dialog is much easier than a menu, here's a link, https://sampwiki.blast.hk/wiki/ShowPlayerDialog

after you create the dialog use this ,
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOGID) //use the ID of the dialog you created,
    {
        if(response)
        {
            if(listitem == 0)  && IsPlayerInPlane(playerid) // so only people in planes can use this
            {
                SetPlayerMapIcon(playerid,0,x,y,z,type,color);
 //you also need to put the timer here
                          }
                  }
        }
}