Jump to content

Creare teleport menu


Jack

Recommended Posts

Pentru inceput aveti nevoie de Pawno.

Sa incepem.

Intrati in GM/FS si creati o variabila

new Menu:teleportmenu;
Adaugati asta sub OnGameModInit()
teleportmenu = CreateMenu("Teleportmenu", 2, 200.0, 100.0, 150.0, 150.0);
O mica explicatie pentru
CreateMenu(title, columns, Float:x, Float:y, Float:col1width, Float:col2width);
Title: titlul de meniu Columns: Numarul de aici defineste modul in care coloanele sunt folosite [2 este de maximum] Float: x: Inaltimea meniului de pe ecran [la stanga la dreapta] Float: y: Latimea meniului de pe ecran [sus si in jos] Float: col1width: latimea primei coloane Float: col2width: latimea coloanei a doua Ok, acum am creat meniul, dar avem nevoie de unele elemente, in care puteti alege din meniu. Sa le adaugati sub CreateMenu pe cele create mai devreme.
AddMenuItem(teleportmenu, 0, "LS");
AddMenuItem(teleportmenu, 0, "LS");
AddMenuItem(teleportmenu, 0, "SF");
AddMenuItem(teleportmenu, 0, "SF");
AddMenuItem(teleportmenu, 0, "LV");
AddMenuItem(teleportmenu, 0, "LV");

AddMenuItem(teleportmenu, 1, "Grove Street");
AddMenuItem(teleportmenu, 1, "Starfish Tower");
AddMenuItem(teleportmenu, 1, "Wheel Arch Angels");
AddMenuItem(teleportmenu, 1, "Jizzys");
AddMenuItem(teleportmenu, 1, "4 Dragons");
AddMenuItem(teleportmenu, 1, "Come-a-Lot");
O mica explicatie pentru
AddMenuItem(menuid, column, text);
menuid: idiul meniului column: coloana in care elementul va fi indicat text: textul elementului Bine, acum ca am creat un meniu complet, cu elemente ce ar trebui sa se intample atunci cand va alegeti un element?Mai intai vom crea o variabil? care detine ceea ce playerul se uita la meniu,acest lucru se face cu "GetPlayerMenu":
new Menu:CurrentMenu = GetPlayerMenu(playerid);
Acum, cand cineva alege ceva pe meniu, menuid va fi salvat în "CurrentMenu". Acum trebuie sa verifice ca au selectat pe meniu:
if(CurrentMenu == teleportmenu)
{
    switch(row)
    {
        case 0: //Grove Street
        {
            SetPlayerPos(playerid, 2493.9133, -1682.3986, 13.3382);
            SetPlayerInterior(playerid, 0);
            SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to Grove Street");
        }
        case 1: //Starfish Tower
        {
            SetPlayerPos(playerid, 1541.2833, -1362.4741, 329.6457);
            SetPlayerInterior(playerid, 0);
            SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to the top of Starfish Tower");
        }
        case 2: //Wheel Arch Angels
        {
            SetPlayerPos(playerid, -2705.5503, 206.1621, 4.1797);
            SetPlayerInterior(playerid, 0);
            SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to the Wheel Arch Angels tuning-shop");
        }
        case 3: //Jizzys
        {
            SetPlayerPos(playerid, -2617.5156, 1390.6353, 7.1105);
            SetPlayerInterior(playerid, 0);
            SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to Jizzy's Nightclub!");
        }
        case 4: //4Dragons
        {
            SetPlayerPos(playerid, 2028.5538, 1008.3543, 10.8203);
            SetPlayerInterior(playerid, 0);
            SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to the Four Dragons Casino");
        }
        case 5: //Com-a-Lot
        {
            SetPlayerPos(playerid, 2169.1838, 1122.5426, 12.6107);
            SetPlayerInterior(playerid, 0);
            SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to the Come-a-Lot casino!");
        }
    }
}[/pawn]
Acum, avem nevoie de o comanda pentru a afisa meniul. Acesta este cel mai usor pas. Doar o comparatie cu strcmp si cu ShowMenuForPlayer. Dupa cum ar trebui sa stiti, acest lucru vine sub OnPlayerCommandText:
[pawn]if(strcmp(cmdtext, "/teleport", true) == 0)
{
    ShowMenuForPlayer(teleportmenu,playerid);
    return 1;
}

Sper ca va placut acest tutorial,astept pareri/note/critici

tumblr_ll5sj3LUoZ1qgjpfvo1_250.gif
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.