new Menu:teleportmenu; teleportmenu = CreateMenu("Teleportmenu", 2, 200.0, 100.0, 150.0, 150.0); AddMenuItem(teleportmenu, 0, "Cars"); AddMenuItem(teleportmenu, 0, "Boats"); new Menu:CurrentMenu = GetPlayerMenu(playerid); if (CurrentMenu == teleportmenu) { switch(row) { case 0: //Cars { SetPlayerPos(playerid, 2008.595, -2382.287, 13.3382); SetPlayerInterior(playerid, 0); SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to the Car Lot"); } case 1: //Boats { SetPlayerPos(playerid, 467.115, -2534.099, 13.3382); SetPlayerInterior(playerid, 0); SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to the Boat lot" } } } if(strcmp(cmdtext, "/teleport", true) == 0) { ShowMenuForPlayer(teleportmenu,playerid); return 1; }
Originally Posted by 0ne
new Menu:teleportmenu; << This should go above OnGameModeInit.
teleportmenu = createmenu... this should go below the OnGameModeInit, If(currentmenu.... << This should go BELOW OnPlayerSelectedMenuRow if(strcmp(cmdtext,"/telport... << this should go below onplayercommandtext |
[14:58:42] [14:58:42] Server Plugins [14:58:42] -------------- [14:58:42] Loaded 0 plugins. [14:58:42] [14:58:42] Filter Scripts [14:58:42] --------------- [14:58:42] Loading filter script 'base.amx'... [14:58:42] --Base FS loaded. [14:58:42] Loading filter script 'gl_actions.amx'... [14:58:42] Loading filter script 'gl_property.amx'... [14:58:42] ----------------------------------- [14:58:42] Grand Larceny Property Filterscript [14:58:42] ----------------------------------- [14:58:42] Loading filter script 'gl_realtime.amx'... [14:58:42] Loading filter script 's&r.amx'... [14:58:42] Loading filter script 'R_Speedov2.amx'... [14:58:42] -------------------------------------- [14:58:42] Speedometer by [WsR]RyDeR - Loaded - [14:58:42] -------------------------------------- [14:58:42] Loading filter script 'teleports1.amx'... [14:58:42] Failed to load 'filterscripts/teleports1.amx.amx' filter script. [14:58:42] Unable to load filter script 'teleports1.amx'. [14:58:42] Loaded 6 filter scripts. |
new Menu:teleportmenu; // This creates a Menu with name of :teleportmenu
public OnGameModeInit();
{ // Start bracket.
teleportmenu = CreateMenu("Teleportmenu", 2, 200.0, 100.0, 150.0, 150.0); // teleportmenu = << here we put in the name of menu which we created above and do CreateMenu(functions....)
AddMenuItem(teleportmenu, 0, "Cars"); // This adds a ITEM to the specific menu, ex: AddMenuItem(MenuName, column,String.);
AddMenuItem(teleportmenu, 0, "Boats"); //same as above
return 1; // Return a 1, mostly every command returns a 1.(i don't know how to explain this to you but i know when to put in a 0 or something myself (lol))
} // Ending bracket, we put } which is ending bracket because there is a start bracket which i marked above
public OnPlayerSelectedMenuRow(playerid, row)
{ // Startbracket
new Menu:CurrentMenu = GetPlayerMenu(playerid);
if (CurrentMenu == teleportmenu)
{// 2nd bracket
switch(row)
{//3rd bracket
case 0: //Cars //A menu Always begins with case 0: and has a opening bracket. which is in this case below case 0,the //4th bracket
{//4th bracket
SetPlayerPos(playerid, >>> HERE ]2008.595, -2382.287, 13.3382 << HERE); //Set's the player position to the specific X,Y,Z Float coordinates.
SetPlayerInterior(playerid, 0); // Set's player interior, in this case its 0, SetPlayerInterior(playerid,0);
SendClientMessage(playerid, 0xFFFFFFFF, "[MESSAGE IS HERE >> Welcome to the Car Lot"); // Send the client message;
}//4th bracket closes(if u didn't get if the code is intended you should see that brackets are equal, ex:
{ // Opening bracket
| // Just to show that they're line is equal so you can see which opened bracket closes somewhere by following it.
|
|
|
} // Closing bracket
case 1: //Boats
{
SetPlayerPos(playerid, 467.115, -2534.099, 13.3382);
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to the Boat lot"
}
}
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/teleport", true) == 0) // this creates a command
{ // again starting bracket
| ShowMenuForPlayer([b]teleportmenu[/b],playerid); //show's the specific menu for player( MENU WHICH TO SHOW IS BOLD)
| return 1;
}// endingbracket of command
return 0; //Cmdtext end with a return 0 if it is a unknown command, you can change it i guess to: Return SendClientMessage(playerid,COLOR,string); which shows a msg if it's unknown command in your style.
} // ending bracket of opened commandtext