whats wrong in this command?
#1

Quote:

public OnPlayerCommandText(cmdtext, playerid)

new Menu:tele;
{

if(strcmp(cmdtext, "/tele", true) == 0)

ShowMenuForPlayer(tele, playerid);
tele = CreateMenu(...);
return 1;

}

Errors:

C:\Users\JordiX\Desktop\samp server\gamemodes\learn.pwn(46) : error 025: function heading differs from prototype
C:\Users\JordiX\Desktop\samp server\gamemodes\learn.pwn(47) : error 003: declaration of a local variable must appear in a compound block
C:\Users\JordiX\Desktop\samp server\gamemodes\learn.pwn(47) : error 010: invalid function or declaration
C:\Users\JordiX\Desktop\samp server\gamemodes\learn.pwn(49) : error 010: invalid function or declaration
C:\Users\JordiX\Desktop\samp server\gamemodes\learn.pwn(51) : error 021: symbol already defined: "ShowMenuForPlayer"
C:\Users\JordiX\Desktop\samp server\gamemodes\learn.pwn(53) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Reply
#2

BUMP - urgent ^^
Reply
#3

pawn Код:
new Menu:tele;
if(strcmp(cmdtext, "/tele", true) == 0)
{
    tele = CreateMenu(...);
    ShowMenuForPlayer(tele, playerid);
    return 1;
}
Try that.
Helps to add "{" xD
Reply
#4

So, you can't put the function CreateMenu in OnPlayerCommandText, you have to put things like this in OnPlayerSelectedMenuRow and OnGameModeInit, look:


pawn Код:
new Menu:Example;//It is in the top of the gamemode. It is a global variable
 

public OnGameModeInit()
{
    Example = CreateMenu("Example Menu", 1, 50.0, 180.0, 200.0, 200.0);
    AddMenuItem(menu, 0, "Item 1");
    AddMenuItem(menu, 0, "Item 2");
    return 1;
}
 
public OnPlayerSelectedMenuRow(playerid, row)
{
    new Menu:current;
    current = GetPlayerMenu(playerid);
    if(current == Example)
    {
        switch(row)
        {
            case 0: print("Item 1");
            case 1: print("Item 2");
        }
    }
    return 1;
}

And after this you will be able to use functions to open the menu. You can put this in a command:

pawn Код:
ShowMenuForPlayer(Example, playerid);//Open the "Example" menu

I hope i have helped
Reply
#5

or you can do this
pawn Код:
if(strcmp(cmdtext, "/tele", true) == 0)
{
     ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Where Do You Want To Go?","tele1here/ntele2here/ntele3here", "Chose", "Cancel");
     return 1;
}
then you would got down to Public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        if(response)
        {
        switch(dialogid)
        {
        case 1:
        {
        switch(listitem)
        {
        case 0:
        {
                 SetPlayerPos(playerid, x, y, z);
        }
        case 1:
        {
                 SetPlayerPos(playerid, x, y, z);
        }
        case 2:
        {
                 SetPlayerPos(playerid, x, y, z);
                 }
                 return 1;
        }
   }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)