All pastes #758182 Raw Edit

Untitled

public text v1 · immutable
·published 2007-11-01 23:38 UTC
rendered paste body
// there are 2 publics , they are already there , but they are empty , so
// i will just give you mine , and replace it with those publics..
//public OnPlayerSelectedMenuRow(playerid, row)
// and , public OnPlayerExitedMenu(playerid)
//
// ok here are mine

public OnPlayerSelectedMenuRow(playerid, row)
{
    new string[256];
	new sendername[MAX_PLAYER_NAME];
	new giveplayer[MAX_PLAYER_NAME];
 	new Menu:Current = GetPlayerMenu(playerid);
    if (Current == WMain ) // Cases of Instructor Tests//added.
 	{
 		switch(row)
 		{
 			case 0:
		 	{
		 	    TogglePlayerControllable(playerid,1);
    			new giveplayerid = GetClosestPlayer(playerid);
   				if(IsPlayerConnected(giveplayerid))
   				{
					if(GetDistanceBetweenPlayers(playerid,giveplayerid) < 5)
					{
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, sizeof(string), "*Instructor %s Gives %s a paper to read", sendername ,giveplayer);
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						format(string, sizeof(string), "* You have given The Information Outline Course to %s.", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* You have receved The Information Outline Course from %s.", sendername);
						SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
  						SendClientMessage(giveplayerid, COLOR_LIGHTRED, "|__The Information Outline Course__|");
       					SendClientMessage(giveplayerid, COLOR_YELLOW, "Welcome to the Information Outline course. In this course you");
						SendClientMessage(giveplayerid, COLOR_YELLOW, "will learn about the things that will be tested later on.");
						SetTimerEx("IO1", 10000, 0, "d", giveplayerid);
						SetTimerEx("IO2", 40000, 0, "d", giveplayerid);
						SetTimerEx("IO3", 70000, 0, "d", giveplayerid);
						SetTimerEx("IO4", 90000, 0, "d", giveplayerid);
						SetTimerEx("IO5", 120000, 0, "d", giveplayerid);
						SetTimerEx("IO6", 145000, 0, "d", giveplayerid);
						SetTimerEx("IO7", 146000, 0, "d", playerid);
					}
                    else
					{
						SendClientMessage(playerid, COLOR_GREY, "   No one near you !");
						return 1;
					}
				}
		 	}
            case 1:
		 	{
		 	    TogglePlayerControllable(playerid,1);
    			new giveplayerid = GetClosestPlayer(playerid);
   				if(IsPlayerConnected(giveplayerid))
   				{
					if(GetDistanceBetweenPlayers(playerid,giveplayerid) < 5)
					{
						GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, sizeof(string), "* You have given %s Question 1 of the driving test, wait his whisper", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Answer: 1", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Whisper %s the answer, Dont say it in public!", sendername);
						SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
  						SendClientMessage(giveplayerid, COLOR_LIGHTRED, "|____________________Questions 1____________________|");
       					SendClientMessage(giveplayerid, COLOR_YELLOW, "There is no such thing as no-risk driving.");
  						SendClientMessage(giveplayerid, COLOR_YELLOW, "1: True");
  						SendClientMessage(giveplayerid, COLOR_YELLOW, "2: False");
  						SendClientMessage(giveplayerid, COLOR_LIGHTRED, "|___________________________________________________|");
					}
                    else
					{
						SendClientMessage(playerid, COLOR_GREY, "   No one near you !");
						return 1;
					}
				}
		 	}
			case 2:
		 	{
		 	    TogglePlayerControllable(playerid,1);
    			new giveplayerid = GetClosestPlayer(playerid);
   				if(IsPlayerConnected(giveplayerid))
   				{
					if(GetDistanceBetweenPlayers(playerid,giveplayerid) < 5)
					{
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, sizeof(string), "* You have given %s Question 2 of the driving test, wait his whisper", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Answer: 2", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Whisper %s the answer, Dont say it in public!", sendername);
						SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
  						SendClientMessage(giveplayerid, COLOR_LIGHTRED, "|____________________Questions 2____________________|");
       					SendClientMessage(giveplayerid, COLOR_YELLOW, "Speed management is important because which of the following?");
  						SendClientMessage(giveplayerid, COLOR_YELLOW, "1: Speed management is not important");
  						SendClientMessage(giveplayerid, COLOR_YELLOW, "2: Speeding can cause loss of steering, life or limb");
  						SendClientMessage(giveplayerid, COLOR_YELLOW, "3: Speeding can cause negative self-esteem");
  						SendClientMessage(giveplayerid, COLOR_YELLOW, "4: Speeding can cause cancer.");
  						SendClientMessage(giveplayerid, COLOR_LIGHTRED, "|___________________________________________________|");
					}
                    else
					{
						SendClientMessage(playerid, COLOR_GREY, "   No one near you !");
						return 1;
					}
				}
		 	}
		 	case 3:
		 	{
		 	    TogglePlayerControllable(playerid,1);
    			new giveplayerid = GetClosestPlayer(playerid);
   				if(IsPlayerConnected(giveplayerid))
   				{
					if(GetDistanceBetweenPlayers(playerid,giveplayerid) < 5)
					{
     					GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, sizeof(string), "* You have given %s Question 3 of the driving test, wait his whisper", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Answer: 3", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Whisper %s the answer, Dont say it in public!", sendername);
						SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
         				SendClientMessage(giveplayerid, COLOR_LIGHTRED, "|____________________Questions 3____________________|");
               			SendClientMessage(giveplayerid, COLOR_YELLOW, "Why is talking on the phone or SMSing while driving is dangerous?");
						SendClientMessage(giveplayerid, COLOR_YELLOW, "1: SMSing while driving can cause sore thumbs");
						SendClientMessage(giveplayerid, COLOR_YELLOW, "2: Talking on the phone while driving can cause reception");
						SendClientMessage(giveplayerid, COLOR_YELLOW, "breakup or static in the phone call.");
						SendClientMessage(giveplayerid, COLOR_YELLOW, "3: Talking on the phone or SMS while driving causes increased");
						SendClientMessage(giveplayerid, COLOR_YELLOW, "risk of having a car crash.");
						SendClientMessage(giveplayerid, COLOR_YELLOW, "4: It isn't dangerous.");
						SendClientMessage(giveplayerid, COLOR_LIGHTRED, "|___________________________________________________|");
					}
                    else
					{
						SendClientMessage(playerid, COLOR_GREY, "   No one near you !");
						return 1;
					}
				}
		 	}
		 	case 4:
		 	{
		 	    TogglePlayerControllable(playerid,1);
    			new giveplayerid = GetClosestPlayer(playerid);
   				if(IsPlayerConnected(giveplayerid))
   				{
					if(GetDistanceBetweenPlayers(playerid,giveplayerid) < 5)
					{
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, sizeof(string), "* You have given %s Question 4 of the driving test, wait his whisper", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Answer: 2,3", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Whisper %s the answer, Dont say it in public!", sendername);
						SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
  						SendClientMessage(giveplayerid, COLOR_LIGHTRED, "|____________________Questions 4____________________|");
    					SendClientMessage(giveplayerid, COLOR_LIGHTRED, "                   Chose 2 answers");
      					SendClientMessage(giveplayerid, COLOR_YELLOW, "A white line painted next to a curb means what?");
						SendClientMessage(giveplayerid, COLOR_YELLOW, "1: No right turn");
						SendClientMessage(giveplayerid, COLOR_YELLOW, "2: No parking at any time, clearway restrictions apply");
						SendClientMessage(giveplayerid, COLOR_YELLOW, "3: No stopping unless medical emergency");
						SendClientMessage(giveplayerid, COLOR_YELLOW, "4: It doesn't mean anything.");
 						SendClientMessage(giveplayerid, COLOR_LIGHTRED, "|___________________________________________________|");
					}
                    else
					{
						SendClientMessage(playerid, COLOR_GREY, "   No one near you !");
						return 1;
					}
				}
		 	}
		 	case 5:
		 	{
		 	    TogglePlayerControllable(playerid,1);
    			new giveplayerid = GetClosestPlayer(playerid);
   				if(IsPlayerConnected(giveplayerid))
   				{
					if(GetDistanceBetweenPlayers(playerid,giveplayerid) < 5)
					{
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, sizeof(string), "* You have given %s Question 5 of the driving test, wait his whisper", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Answer: 1,4", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Whisper %s the answer, Dont say it in public!", sendername);
						SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
  						SendClientMessage(giveplayerid, COLOR_LIGHTRED, "|____________________Questions 5____________________|");
   						SendClientMessage(giveplayerid, COLOR_LIGHTRED, "                   Chose 2 answers.");
        				SendClientMessage(giveplayerid, COLOR_YELLOW, "When on a four lane road (2-lanes going either way), when are you");
           				SendClientMessage(giveplayerid, COLOR_YELLOW, "allowed to be in the left lane?");
   						SendClientMessage(giveplayerid, COLOR_YELLOW, "1: When turning left within 300 feet (100 meters)");
   						SendClientMessage(giveplayerid, COLOR_YELLOW, "2: When within 500 feet of a hospital");
   						SendClientMessage(giveplayerid, COLOR_YELLOW, "3: Whenever you want. There is no rule regarding this.");
   						SendClientMessage(giveplayerid, COLOR_YELLOW, "4: When overtaking another vehicle.");
   						SendClientMessage(giveplayerid, COLOR_LIGHTRED, "|___________________________________________________|");
					}
                    else
					{
						SendClientMessage(playerid, COLOR_GREY, "   No one near you !");
						return 1;
					}
				}
		 	}
		 	case 6:
		 	{
		 	    TogglePlayerControllable(playerid,1);
    			new giveplayerid = GetClosestPlayer(playerid);
   				if(IsPlayerConnected(giveplayerid))
   				{
					if(GetDistanceBetweenPlayers(playerid,giveplayerid) < 5)
					{
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, sizeof(string), "* You have given %s The weapon test, wait his whisper with the answers", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Answers:", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* 1: No", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* 2: No", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* 3: Eagle, Country rifle", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* 4: Any illigal weapons like: m4,mp5,AK47,Sniper", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Whisper %s the answers, Dont say it in public!", sendername);
						SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
  						SendClientMessage(giveplayerid, COLOR_LIGHTRED, "|____________________Weapon Test____________________|");
       					SendClientMessage(giveplayerid, COLOR_YELLOW, "1: If you have a Weapons Permit, does that grant you the right to expose your weapon in Public?");
           				SendClientMessage(giveplayerid, COLOR_YELLOW, "2: Are fully automatic Weapons Legal?");
						SendClientMessage(giveplayerid, COLOR_YELLOW, "3: What Firearms does the Permit grant you to legally own?");
						SendClientMessage(giveplayerid, COLOR_YELLOW, "4: Please Name two Illegal Weapons.");
						SendClientMessage(giveplayerid, COLOR_LIGHTRED, "|___________________________________________________|");
					}
                    else
					{
						SendClientMessage(playerid, COLOR_GREY, "   No one near you !");
						return 1;
					}
				}
		 	}
		 	case 7:
		 	{
		 	    TogglePlayerControllable(playerid,1);
    			new giveplayerid = GetClosestPlayer(playerid);
   				if(IsPlayerConnected(giveplayerid))
   				{
					if(GetDistanceBetweenPlayers(playerid,giveplayerid) < 5)
					{
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, sizeof(string), "* You have given %s The sailing test, wait his whisper with the answers", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Answers:", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* 1: Left", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* 2: 3 times", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* 3: Pull over, Stop the boat, and get out of the control room.", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* 4: $1,000 - $10,000", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Whisper %s the answer, Dont say it in public!", sendername);
						SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
	    				SendClientMessage(giveplayerid, COLOR_LIGHTRED, "|____________________Sailing Test____________________|");
        				SendClientMessage(giveplayerid, COLOR_YELLOW, "1: When passing another boat, do you pass on the left or right side?");
           				SendClientMessage(giveplayerid, COLOR_YELLOW, "2: If it's a foggy day how many times do you blow your fog horn?");
   						SendClientMessage(giveplayerid, COLOR_YELLOW, "3: If a government vessel is flashing it's lights and is behind you, what do you do?");
   						SendClientMessage(giveplayerid, COLOR_YELLOW, "4: What is the fine for spilling gasoline into the water?");
   						SendClientMessage(giveplayerid, COLOR_LIGHTRED, "|____________________________________________________|");
					}
                    else
					{
						SendClientMessage(playerid, COLOR_GREY, "   No one near you !");
						return 1;
					}
				}
		 	}
		 	case 8:
		 	{
		 	    TogglePlayerControllable(playerid,1);
    			new giveplayerid = GetClosestPlayer(playerid);
   				if(IsPlayerConnected(giveplayerid))
   				{
					if(GetDistanceBetweenPlayers(playerid,giveplayerid) < 5)
					{
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, sizeof(string), "* You have given %s The flying test, wait his whisper with the answers", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Answers:", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* 1: 1 mile.", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* 2: Gear up", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* 3: Try to land or wear the parachut and jump.", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* 4: No", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Whisper %s the answer, Dont say it in public!", sendername);
						SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
	    				SendClientMessage(giveplayerid, COLOR_LIGHTRED, "|____________________Flying Test____________________|");
     					SendClientMessage(giveplayerid, COLOR_YELLOW, "1: What is the lowest distance you can fly above the ground(Miles)?");
       					SendClientMessage(giveplayerid, COLOR_YELLOW, "2: What should you do exactly after take off?");
						SendClientMessage(giveplayerid, COLOR_YELLOW, "3: What should you do if the engine broke while you are flying?");
						SendClientMessage(giveplayerid, COLOR_YELLOW, "4: Is it legal to fly the plane upside down, and do sudden movements?");
						SendClientMessage(giveplayerid, COLOR_LIGHTRED, "|___________________________________________________|");
					}
                    else
					{
						SendClientMessage(playerid, COLOR_GREY, "   No one near you !");
						return 1;
					}
				}
		 	}
		 	case 9:
		 	{
                TogglePlayerControllable(playerid,1);
			}
		}
	}
	return 1;
}


// this is the comand to load the cases
//----------------------------------[Instructor Tests//added]-----------------------------------------------
  	if(strcmp(cmdtext, "/tests",true)==0)
	{
	    if(PlayerInfo[playerid][pMember] == 11 || PlayerInfo[playerid][pLeader] == 11)
  		{
  		    TogglePlayerControllable(playerid,0);
 			WMain = CreateMenu("Tests",1,100,200,90,25);
 			AddMenuItem(WMain,0,"Driving Course");
 			AddMenuItem(WMain,0,"DKT Question 1");
 			AddMenuItem(WMain,0,"DKT Question 2");
 			AddMenuItem(WMain,0,"DKT Question 3");
 			AddMenuItem(WMain,0,"DKT Question 4");
 			AddMenuItem(WMain,0,"DKT Question 5");
 			AddMenuItem(WMain,0,"Weapon Test");
 			AddMenuItem(WMain,0,"Sailing Test");
 			AddMenuItem(WMain,0,"Flying Test");
 			AddMenuItem(WMain,0,"Exit");
 			ShowMenuForPlayer(WMain,playerid);
 			PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
 			GetPlayerName(playerid, sendername, sizeof(sendername));
 			new length = strlen(cmdtext);
 			while ((idx < length) && (cmdtext[idx] <= ' '))
 			{
 				idx++;
 			}
 			new offset = idx;
 			new result[64];
 			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
 			{
 				result[idx - offset] = cmdtext[idx];
 				idx++;
 			}
 			result[idx - offset] = EOS;
 			if(!strlen(result))
			return 1;
		}
	}