Pattypat Geplaatst: 21 mei 2009 Rapport Geplaatst: 21 mei 2009 (bewerkt) /* Vehilce Spawn Menu Door [JD]jordy_nl */ #include <a_samp> #define COLOR_BASIC 0x0066FFAA //Menu's new Menu:HoofdMenu; new Menu:Motors; new Menu:AutosVrachtwagens; new Menu:VliegtuigenHelikopters; new Menu:Booten; //--- //Spawn Pos new Float:PosX; new Float:PosY; new Float:PosZ; new Float:Angle; //--- public OnGameModeInit() { print("\n--------------------------------------"); print("Vehilce Spawn Menu - Door [JD]jordy_nl"); print(" Gestart "); print("--------------------------------------\n"); //------------------------------------------- HoofdMenu = CreateMenu("Menu", 1, 50.0, 180.0, 200.0, 200.0); AddMenuItem(HoofdMenu, 0, "Motors"); AddMenuItem(HoofdMenu, 0, "Auto's en vrachtwagens"); AddMenuItem(HoofdMenu, 0, "Vliegtuigen en helikopters"); AddMenuItem(HoofdMenu, 0, "Boten"); AddMenuItem(HoofdMenu, 0, "Sluit Menu"); //------------------------------------------- Motors = CreateMenu("Menu", 1, 50.0, 180.0, 200.0, 200.0); AddMenuItem(Motors, 0, "Nrg-500"); AddMenuItem(Motors, 0, "Quad"); AddMenuItem(Motors, 0, "Fcr-900"); AddMenuItem(Motors, 0, "Sanchez"); AddMenuItem(Motors, 0, "Sluit Menu"); //------------------------------------------- AutosVrachtwagens = CreateMenu("Menu", 1, 50.0, 180.0, 200.0, 200.0); AddMenuItem(AutosVrachtwagens, 0, "Infernus"); AddMenuItem(AutosVrachtwagens, 0, "Turismo"); AddMenuItem(AutosVrachtwagens, 0, "Swat Tank"); AddMenuItem(AutosVrachtwagens, 0, "RoadTrain"); AddMenuItem(AutosVrachtwagens, 0, "Sluit Menu"); //------------------------------------------- VliegtuigenHelikopters = CreateMenu("Menu", 1, 50.0, 180.0, 200.0, 200.0); AddMenuItem(VliegtuigenHelikopters, 0, "Maverick"); AddMenuItem(VliegtuigenHelikopters, 0, "Dodo"); AddMenuItem(VliegtuigenHelikopters, 0, "Beagle"); AddMenuItem(VliegtuigenHelikopters, 0, "Hydra"); AddMenuItem(VliegtuigenHelikopters, 0, "Sluit Menu"); //------------------------------------------- Booten = CreateMenu("Menu", 1, 50.0, 180.0, 200.0, 200.0); AddMenuItem(Booten, 0, "Jetmax"); AddMenuItem(Booten, 0, "Predator"); AddMenuItem(Booten, 0, "Marguis"); AddMenuItem(Booten, 0, "Tropic"); AddMenuItem(Booten, 0, "Sluit Menu"); //------------------------------------------- return 1; } public OnGameModeExit() { print("\n--------------------------------------"); print("Vehilce Spawn Menu - Door [JD]jordy_nl"); print(" Gestopt "); print("--------------------------------------\n"); //------------------------------------------- DestroyMenu(HoofdMenu); DestroyMenu(Motors); DestroyMenu(AutosVrachtwagens); DestroyMenu(VliegtuigenHelikopters); //------------------------------------------- return 1; } public OnPlayerConnect(playerid) { SendClientMessage(playerid,COLOR_BASIC,"Om een auto, vliegtuig, boot of wat anders te spawnen, Typ: '/Menu' Registeer jezelf !Gebruik daarvoor /register [wachtwoord] Heb je al een account ? Gebruik /login [wachtwoord].. "); return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/Menu", cmdtext, true, 10) == 0) { ShowMenuForPlayer(HoofdMenu,playerid); GameTextForPlayer(playerid,"~w~Menu Geopend",2000,5); TogglePlayerControllable(playerid,0); return 1; } return 0; } public OnPlayerSelectedMenuRow(playerid, row) { //------------------------------------------- new Menu:current; current = GetPlayerMenu(playerid); //------------------------------------------- if(current == HoofdMenu) { switch(row) { case 0:{ //Row 1 code ShowMenuForPlayer(Motors,playerid); } case 1:{ //Row 2 code ShowMenuForPlayer(AutosVrachtwagens,playerid); } case 2:{ //Row 3 code ShowMenuForPlayer(VliegtuigenHelikopters,playerid); } case 3:{ //Row 4 code ShowMenuForPlayer(Booten,playerid); } case 4:{ //Row 5 code HideMenuForPlayer(HoofdMenu,playerid); TogglePlayerControllable(playerid,1); } } } //------------------------------------------- if(current == Motors) { switch(row) { case 0:{ //Row 1 code GetPlayerPos(playerid,PosX,PosY,PosZ); GetPlayerFacingAngle(playerid,Angle); CreateVehicle(522,PosX+2,PosY,PosZ,Angle,-1,-1,0); TogglePlayerControllable(playerid,1); } case 1:{ //Row 2 code GetPlayerPos(playerid,PosX,PosY,PosZ); GetPlayerFacingAngle(playerid,Angle); CreateVehicle(471,PosX+2,PosY,PosZ,Angle,-1,-1,0); TogglePlayerControllable(playerid,1); } case 2:{ //Row 3 code GetPlayerPos(playerid,PosX,PosY,PosZ); GetPlayerFacingAngle(playerid,Angle); CreateVehicle(521,PosX+2,PosY,PosZ,Angle,-1,-1,0); TogglePlayerControllable(playerid,1); } case 3:{ //Row 4 code GetPlayerPos(playerid,PosX,PosY,PosZ); GetPlayerFacingAngle(playerid,Angle); CreateVehicle(468,PosX+2,PosY,PosZ,Angle,-1,-1,0); TogglePlayerControllable(playerid,1); } case 4:{ //Row 5 code HideMenuForPlayer(Motors,playerid); TogglePlayerControllable(playerid,1); } } } //------------------------------------------- if(current == AutosVrachtwagens) { switch(row) { case 0:{ //Row 1 code GetPlayerPos(playerid,PosX,PosY,PosZ); GetPlayerFacingAngle(playerid,Angle); CreateVehicle(411,PosX+2,PosY,PosZ,Angle,-1,-1,0); TogglePlayerControllable(playerid,1); } case 1:{ //Row 2 code GetPlayerPos(playerid,PosX,PosY,PosZ); GetPlayerFacingAngle(playerid,Angle); CreateVehicle(451,PosX+2,PosY,PosZ,Angle,-1,-1,0); TogglePlayerControllable(playerid,1); } case 2:{ //Row 3 code GetPlayerPos(playerid,PosX,PosY,PosZ); GetPlayerFacingAngle(playerid,Angle); CreateVehicle(601,PosX+2,PosY,PosZ,Angle,-1,-1,0); TogglePlayerControllable(playerid,1); } case 3:{ //Row 4 code GetPlayerPos(playerid,PosX,PosY,PosZ); GetPlayerFacingAngle(playerid,Angle); CreateVehicle(515,PosX+2,PosY,PosZ,Angle,-1,-1,0); TogglePlayerControllable(playerid,1); } case 4:{ //Row 5 code HideMenuForPlayer(AutosVrachtwagens,playerid); TogglePlayerControllable(playerid,1); } } } //------------------------------------------- if(current == VliegtuigenHelikopters) { switch(row) { case 0:{ //Row 1 code GetPlayerPos(playerid,PosX,PosY,PosZ); GetPlayerFacingAngle(playerid,Angle); CreateVehicle(487,PosX+2,PosY,PosZ,Angle,-1,-1,0); TogglePlayerControllable(playerid,1); } case 1:{ //Row 2 code GetPlayerPos(playerid,PosX,PosY,PosZ); GetPlayerFacingAngle(playerid,Angle); CreateVehicle(593,PosX+2,PosY,PosZ,Angle,-1,-1,0); TogglePlayerControllable(playerid,1); } case 2:{ //Row 3 code GetPlayerPos(playerid,PosX,PosY,PosZ); GetPlayerFacingAngle(playerid,Angle); CreateVehicle(511,PosX+2,PosY,PosZ,Angle,-1,-1,0); TogglePlayerControllable(playerid,1); } case 3:{ //Row 4 code GetPlayerPos(playerid,PosX,PosY,PosZ); GetPlayerFacingAngle(playerid,Angle); CreateVehicle(520,PosX+2,PosY,PosZ,Angle,-1,-1,0); TogglePlayerControllable(playerid,1); } case 4:{ //Row 5 code HideMenuForPlayer(VliegtuigenHelikopters,playerid); TogglePlayerControllable(playerid,1); } } } //------------------------------------------- if(current == Booten) { switch(row) { case 0:{ //Row 1 code GetPlayerPos(playerid,PosX,PosY,PosZ); GetPlayerFacingAngle(playerid,Angle); CreateVehicle(493,PosX+2,PosY,PosZ,Angle,-1,-1,0); TogglePlayerControllable(playerid,1); } case 1:{ //Row 2 code GetPlayerPos(playerid,PosX,PosY,PosZ); GetPlayerFacingAngle(playerid,Angle); CreateVehicle(430,PosX+2,PosY,PosZ,Angle,-1,-1,0); TogglePlayerControllable(playerid,1); } case 2:{ //Row 3 code GetPlayerPos(playerid,PosX,PosY,PosZ); GetPlayerFacingAngle(playerid,Angle); CreateVehicle(484,PosX+2,PosY,PosZ,Angle,-1,-1,0); TogglePlayerControllable(playerid,1); } case 3:{ //Row 4 code GetPlayerPos(playerid,PosX,PosY,PosZ); GetPlayerFacingAngle(playerid,Angle); CreateVehicle(454,PosX+2,PosY,PosZ,Angle,-1,-1,0); TogglePlayerControllable(playerid,1); } case 4:{ //Row 5 code HideMenuForPlayer(Booten,playerid); TogglePlayerControllable(playerid,1); } } } //------------------------------------------- return 1; } public OnPlayerExitedMenu(playerid) { TogglePlayerControllable(playerid,1); return 1; } Hoe kan ik ervoor zorgen dat het alleen door Admins kan worden gebruikt ? Bewerkt: 21 mei 2009 door Pattypat Reageren
Remi-X Geplaatst: 21 mei 2009 Rapport Geplaatst: 21 mei 2009 (bewerkt) public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/Menu", cmdtext, true, 10) == 0) { if(IsPlayerAdmin(playerid))//Dit dus, kijk of de speler een admin is. { ShowMenuForPlayer(HoofdMenu,playerid); GameTextForPlayer(playerid,"~w~Menu Geopend",2000,5); TogglePlayerControllable(playerid,0); return 1; } return 1; } return 0; } Bewerkt: 21 mei 2009 door Remi-X Reageren
Recommended Posts
Een reactie plaatsen
Je kan nu een reactie plaatsen en pas achteraf registreren. Als je al lid bent, log eerst in om met je eigen account een reactie te plaatsen.