How to add Questions before spawn?
#1

I want to add some questions and peoples who join in server need to answer on it if he answer correctly he will join if not he will got kick. Help pls.
Reply
#2

Use dialogs

https://sampwiki.blast.hk/wiki/How_to_Create_a_Dialog
https://sampwiki.blast.hk/wiki/Dialog
https://sampwiki.blast.hk/wiki/ShowPlayerDialog
https://sampwiki.blast.hk/wiki/OnDialogResponse
Reply
#3

OnPlayerConnect.
ShowPlayerDialog
OnDialogResponse
if(response)CanPlay(playerid);
else Kick(playerid);
Reply
#4

and if you want that he can't spawn before he answered it:

OnPlayerRequestSpawn
Reply
#5

so i have added questions and i connect in server to check it work but when i finish answering questions tutorial not starting what i need to add to tutorial start ? Im using GTA RolePlay
Reply
#6

I don't know anything about your GM
Reply
#7

https://sampforum.blast.hk/showthread.php?tid=113124

This is the GM GTA RolePlay but i edit it and now i put questions but i need to add when questions finish not to spawn to load the Tutorial can you see gm and help me please.
Reply
#8

bump can anyone help me?
Reply
#9

Tutorial after if(response) into if(dialogid == ID_DIALOG)
Reply
#10

So look..

Here is the questions where i added.

Код:
//---------------------------<[ OnDialogResponse ]>--------------------------------------------------------

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	new sendername[MAX_PLAYER_NAME];
	new string[128];
	if(response)
	{
		if(dialogid == 12346 || dialogid == 12347)
		{
		    if(strlen(inputtext))
		    {
				new tmppass[64];
				strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
				//Encrypt(tmppass);
				OnPlayerLogin(playerid,tmppass);
			}
			else
			{
				new loginstring[128];
				new loginname[64];
				GetPlayerName(playerid,loginname,sizeof(loginname));
				format(loginstring,sizeof(loginstring),"WRONG PASSWORD\nPlease enter the correct password:",loginname);
				ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
				gPlayerLogTries[playerid] += 1;
				if(gPlayerLogTries[playerid] == 5) { Ban(playerid); }
			}
		}
		if(dialogid == 12345)
		{
		    if(strlen(inputtext))
		    {
				GetPlayerName(playerid, sendername, sizeof(sendername));
				format(string, sizeof(string), "%s.ini", sendername);
				new File: hFile = fopen(string, io_read);
				if (hFile)
				{
					SendClientMessage(playerid, COLOR_YELLOW, "That Username is already taken, please choose a different one.");
					fclose(hFile);
					return 1;
				}
				new tmppass[64];
				strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
				//Encrypt(tmppass);
				OnPlayerRegister(playerid,tmppass);
                SendClientMessage(playerid, COLOR_RED,"Morate odgovoriti tacno na sljedeca pitanja kako bi pristupili igri");
		        ShowPlayerDialog(playerid, 1249, DIALOG_STYLE_LIST, "Sta je RolePlay?", "Gluma stvarnog zivota\nUbijanje sto vise ljudi je moguce\nDa se ponasamo onako kako se ne bi ponasali u RL"," .", " .");
			}
			else
			{
 				new regstring[128];
				new regname[64];
				GetPlayerName(playerid,regname,sizeof(regname));
				format(regstring,sizeof(regstring),"Welcome, %s\nYou dont have an account.\nPlease register:",regname);
				ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Exit");
			}
		}
	}
	else
	{
		Kick(playerid);
	}
	if(dialogid == 1249)
		{
		    if(response)
		    {
		        if(listitem == 0)
		        {
		            ShowPlayerDialog(playerid, 1248, DIALOG_STYLE_LIST, "Sta je SpawnKill?", "Ubijanje na mjestu spawna i to je nedozvoljeno\nUbijanje na mjestu spawna i to je dozvoljeno\nPljacka banke"," .", " .");
		            SendClientMessage(playerid, COLOR_GREY,"* Tacan odgovor");
				}
				else if(listitem == 1)
		        {
		            SendClientMessage(playerid, COLOR_GREY,"* Netacan odgovor");
		            Kick(playerid);
				}
				else if(listitem == 2)
		        {
		            SendClientMessage(playerid, COLOR_GREY,"* Netanac odgovor");
		            Kick(playerid);
				}
			}
			else
			{
			    Kick(playerid);
			}
		}
		if(dialogid == 1248)
		{
		    if(response)
		    {
		        if(listitem == 0)
		        {
		            ShowPlayerDialog(playerid, 1251, DIALOG_STYLE_LIST, "Sta je DeathMatch?", "Ubijanje bez razloga i to je dozvoljeno\nUbijanje bez razloga i to je dozvoljeno\nUbijanje i nije dozvoljeno,ide se u zatvor"," .", " .");
		            SendClientMessage(playerid, COLOR_GREY,"* Tacan odgovor");
				}
				else if(listitem == 1)
		        {
		            SendClientMessage(playerid, COLOR_GREY,"* Netacan odgovor");
		            Kick(playerid);
				}
				else if(listitem == 2)
		        {
		            SendClientMessage(playerid, COLOR_GREY,"* Netanac odgovor");
		            Kick(playerid);
				}
			}
			else
			{
			    Kick(playerid);
			}
		}
		if(dialogid == 1251)
		{
		    if(response)
		    {
		        if(listitem == 0)
		        {
		            SendClientMessage(playerid, COLOR_GREY,"* NETacan odgovor");
		            Kick(playerid);
				}
				else if(listitem == 1)
		        {
		            SendClientMessage(playerid, COLOR_GREY,"* Netacan odgovor");
		            Kick(playerid);
				}
				else if(listitem == 2)
		        {
		            SendClientMessage(playerid, COLOR_GREY,"* Tacan odgovor");
				}
			}
			else
			{
			    Kick(playerid);
			}
		}
			return 1;
}
and down on other line is tutorial:

Код:
			if(TutTime[i] >= 1)
			{
			    TutTime[i] += 1;
                if(TutTime[i] == 3)
			    {
			        ClearChatbox(i, 10);
			        SetPlayerCameraPos(i, 2247.0215,-1655.0173,17.2856);
					SetPlayerCameraLookAt(i, 2244.6536,-1663.9304,15.4766);
					SetPlayerInterior(i, 0);
					SetPlayerVirtualWorld(i, 0);
					SetPlayerPos(i, 2256.3555,-1646.6377,-5.00);
			        SendClientMessage(i, COLOR_GREEN, "~ CLOTHES SHOP ~");
			        SendClientMessage(i, COLOR_WHITE, " ");
			        SendClientMessage(i, COLOR_WHITE, "First of all you'll need some clothes, you can buy them at any clothes shop.");
			        SendClientMessage(i, COLOR_WHITE, "When you're in the shop type /clothes and then type next untill you find the clothes that you like.");
			        ClearChatbox(i, 2);
			    }
			    else if(TutTime[i] == 16)
			    {
			        ClearChatbox(i, 10);
			        SetPlayerPos(i, 2089.6624,-1901.7891,-5.00);
			        SetPlayerCameraPos(i, 2070.8093,-1914.6747,18.5469);
					SetPlayerCameraLookAt(i, 2055.2405,-1906.4608,13.5469);
					SetPlayerInterior(i, 0);
			        SendClientMessage(i, COLOR_GREEN, "~ LICENSES CENTER ~");
			        SendClientMessage(i, COLOR_WHITE, " ");
			        SendClientMessage(i, COLOR_WHITE, "You still have no driving/flying/sailing licenses? Shame on you!");
			        SendClientMessage(i, COLOR_WHITE, "You must first buy any of a kind licenses to get a license.");
			        SendClientMessage(i, COLOR_WHITE, "You can see the list of buyable licenses by just typing /buylic.");
			        ClearChatbox(i, 2);
			    }
			    else if(TutTime[i] == 25)
			    {
			        ClearChatbox(i, 10);
			        SetPlayerPos(i, 1514.3059,-1667.8116,-5.00);
			        SetPlayerCameraPos(i, 1535.9584,-1676.1428,18.3828);
					SetPlayerCameraLookAt(i, 1553.7861,-1676.4270,16.1953);
					SetPlayerInterior(i, 0);
			        SendClientMessage(i, COLOR_GREEN, "~ POLICE DEPARTMENT ~");
			        SendClientMessage(i, COLOR_WHITE, " ");
			        SendClientMessage(i, COLOR_WHITE, "The Los Santos Police Department and FBI are in the city for your protection.");
			        SendClientMessage(i, COLOR_WHITE, "People who commit crimes will dealt with swiftly and with force if necessary.");
			        SendClientMessage(i, COLOR_WHITE, "To call a police officer, call the emergency hotline using /call 911.");
			        ClearChatbox(i, 2);
			    }
			    else if(TutTime[i] == 35)
			    {
			        ClearChatbox(i, 10);
			        SetPlayerPos(i, 1221.7010,-1328.6449,-5.00);
			        SetPlayerCameraPos(i, 1204.3781,-1313.3323,16.3984);
					SetPlayerCameraLookAt(i, 1174.7167,-1323.4485,14.5938);
					SetPlayerInterior(i, 0);
			        SendClientMessage(i, COLOR_GREEN, "~ ALL SAINTS GENERAL HOSPITAL ~");
			        SendClientMessage(i, COLOR_WHITE, " ");
			        SendClientMessage(i, COLOR_WHITE, "Feeling sick? You need to see the doctor of Los Santos.");
			        SendClientMessage(i, COLOR_WHITE, "To call a paramedic, call the emergency hotline using /call 911");
			        SendClientMessage(i, COLOR_WHITE, "You'll spawn here after death");
			        ClearChatbox(i, 2);
			    }
			    else if(TutTime[i] == 45)
			    {
			        ClearChatbox(i, 10);
			        SetPlayerPos(i, 1786.1758,-1258.4976,-5.00);
			        SetPlayerCameraPos(i, 1779.4259,-1275.1025,15.6328);
					SetPlayerCameraLookAt(i, 1785.7263,-1296.0200,13.4213);
					SetPlayerInterior(i, 0);
			        SendClientMessage(i, COLOR_GREEN, "~ ABC STUDIO ~");
			        SendClientMessage(i, COLOR_WHITE, " ");
			        SendClientMessage(i, COLOR_WHITE, "Got some fresh news to announce? Go to the ABC Studio reporters and ask them to do it.");
			        SendClientMessage(i, COLOR_WHITE, "You can also post your advertisment at local newspaper.");
			        ClearChatbox(i, 2);
			    }
			    else if(TutTime[i] == 53)
			    {
			        ClearChatbox(i, 10);
			        SetPlayerPos(i, 1475.7020,-1050.9489,-5.00);
			        SetPlayerCameraPos(i, 1458.3872,-1042.2423,24.8281);
					SetPlayerCameraLookAt(i, 1458.5930,-1019.9205,24.5264);
					SetPlayerInterior(i, 0);
			        SendClientMessage(i, COLOR_GREEN, "~ BANK OF THE STATE ~");
			        SendClientMessage(i, COLOR_WHITE, " ");
			        SendClientMessage(i, COLOR_WHITE, "You won't keep all your money in your pocket, someone will try to steal it.");
			        SendClientMessage(i, COLOR_WHITE, "You can /deposit, or /withdraw your money at the bank.");
			        SendClientMessage(i, COLOR_WHITE, "You'll get you payday at your bank account too.");
			        ClearChatbox(i, 2);
			    }
			    else if(TutTime[i] == 63)
			    {
			        ClearChatbox(i, 10);
			        SetPlayerInterior(i, 3);
			        SetPlayerPos(i, 1742.8252,-1861.2283,13.5778);
			        SetCameraBehindPlayer(i);
			        SetPlayerVirtualWorld(i, 0);
			        SendClientMessage(i, COLOR_GREEN, "~ END OF TUTORIAL ~");
			        SendClientMessage(i, COLOR_WHITE, " ");
			        SendClientMessage(i, COLOR_WHITE, "There are a lot of places in Los Santos, but you need to discover them on your own.");
			        SendClientMessage(i, COLOR_WHITE, "Don't forget Role-Play rules, because non-rping causes warns and bans!");
			        SendClientMessage(i, COLOR_WHITE, "  - Enjoy, GTA:RP Admin Team.");
			        ClearChatbox(i, 2);
			    }
			    else if(TutTime[i] == 73)
			    {
			        ClearChatbox(i, 10);
			        SendClientMessage(i, COLOR_YELLOW2, "Welcome to the Los Santos.");
			        SendClientMessage(i, COLOR_GRAD1, "To call a taxi use call 444");
			        SendClientMessage(i, COLOR_GRAD1, "To change your outfit you have to go to clothes shop");
					SendClientMessage(i, COLOR_GRAD1, " ");
					TextDrawHideForPlayer(i,lbt);
					TextDrawHideForPlayer(i,lbb);
			        TutTime[i] = 0; PlayerInfo[i][pTut] = 1;
					gOoc[i] = 0; gNews[i] = 0; gFam[i] = 0;
					TogglePlayerControllable(i, 1);
					MedicBill[i] = 0;
					AfterTutorial[i] = 1;
					SetTimerEx("UnsetAfterTutorial", 2500, false, "i", i);
					SetTimerEx("UnsetFirstSpawn", 5000, false, "i", i);
					SetPlayerSpawn(i);
			    }
			}
What i need to add when questions finish to start this tutorial?
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)