pawn Код:
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
You should understand something more now, when you compile you get the .AMX file if there is no errors while compiling, the errors always shows a line ex:
E:\Games Setup\Gta san andreas server\Install\samp02Xserver.win32\gamemodes\FreeR oam.pwn(
7360) : warning 204: symbol is assigned a value that is never used: "MiniMissionTimer"
the line is shown in bold :
7360 , we got a warning there but thats from my server nevermind it just showed u how it goes.
the .pwn file is the source where you write your code and edit or add something more
the .amx file is source compiled file.
The compiler freezes mostly when you miss a ENDING or a STARTING bracket }, {, if you want to load a filterscript, add the .AMX in the FILterscripts folder and in the SERVER.CFG file where it's filterscript line add it , like:
filterscript teleports1
if you want to add some more do like this:
filterscripts teleport1 teleport2 headshot
and so on..
edit: download a filterscript and a gamemode see their source code, if you know english pretty well you will understand half of the commands and the combinations, clicking on a Command which is shown to the right in the list will show below what functions you need to put in, while writing the command ex:
SendClientMessage(
hold SHIFT when u stop writing on the ( and it will show you the functions to put in
By the way, you're gamemode shuts down maybe because you didn't put a gamemode in your server.cfg if you want to run a server you "ALWAYS" need to put a gamemode to launch the server ex:
gamemode 0 lvdm