Problem with arguments
#1

I try to make this function...

pawn Код:
HideMenuEx(playerid,bool:header,bool:text)
And when i try to use that func.

pawn Код:
HideMenuEx(playerid,1,1);
i get these warnings

warning 213: tag mismatch
warning 213: tag mismatch

So miss 2 arguments, can someone tell me the problem in this code?
Reply
#2

Doesn't bool:header mean the name of the menu? And bool:text mean the text?
Reply
#3

No, its text example

CreateMenuEx(playerid,"header","text");

so it can be false or true ....

paramerters

HideMenuEx(playerid,bool:header,bool:text)

HideMenuEx(playerid,1,0);

so if is 1,1 it will hide all menu ( text and header )

if is 1,0 then will hide just header

else if 0,1 the will hide just text

here it is func

pawn Код:
stock HideMenuEx(playerid,bool:header,bool:text)
{
     if(header == true)
     {
       if(GetPVarInt(playerid,"KoristiMenuExHeader") == 1)
       {
         TextDrawHideForPlayer(playerid,Text:Header[playerid]);
         SetPVarInt(playerid,"KoristiMenuExHeader",0);
         TogglePlayerControllable(playerid, 1);
       }
       else
       {
          print("MenuEx: MenuEx header nemoze biti ugasen jer nije aktivan.");
       }
     }
     else if(text == true)
     {
        if(GetPVarInt(playerid,"KoristiMenuEx") == 1)
        {
           TextDrawHideForPlayer(playerid,Text:Text[playerid]);
           SetPVarInt(playerid,"KoristiMenuEx",0);
           TogglePlayerControllable(playerid, 1);
        }
        else
        {
          print("MenuEx: MenuEx text nemoze biti ugasen jer nije aktivan.");
        }
     }
     return 1;
}
Reply
#4

A bool (boolean) can be either "true" or "false". I don't really know what that function should do, pastebin it all.

Quote:

This forum requires that you wait 120 seconds between posts. Please try again in 9 seconds.

Reply
#5

Here it is ALL INC FILE

pawn Код:
#if defined _menu_included
  #endinput
#endif
#define _menu_included
#pragma library menu
#include <foreach>

new
Text:Header[MAX_PLAYERS],
Text:Text[MAX_PLAYERS];

/*

CreateMenuEx(playerid,header[],text[])

HideMenuEx(playerid,bool:header,bool:text)

CreateMenuExToAll(header[],text[],bool:freeze)

HideMenuExToAll(bool:header,bool:text)

*/


public OnPlayerConnect(playerid)
{
     Header[playerid] = TextDrawCreate(2.000000, 135.000000, "~g~he");
     TextDrawBackgroundColor(Header[playerid], 255);
     TextDrawFont(Header[playerid], 3);
     TextDrawLetterSize(Header[playerid], 0.840000, 2.100000);
     TextDrawColor(Header[playerid], -16776961);
     TextDrawSetOutline(Header[playerid], 1);
     TextDrawSetProportional(Header[playerid], 1);
     TextDrawUseBox(Header[playerid], 1);
     TextDrawBoxColor(Header[playerid], -84215159);
     TextDrawTextSize(Header[playerid], 172.000000, 0.000000);

     Text[playerid] = TextDrawCreate(2.000000, 160.000000, "~g~he");
     TextDrawBackgroundColor(Text[playerid], 255);
     TextDrawFont(Text[playerid], 2);
     TextDrawLetterSize(Text[playerid], 0.480000, 1.100000);
     TextDrawColor(Text[playerid], -16776961);
     TextDrawSetOutline(Text[playerid], 1);
     TextDrawSetProportional(Text[playerid], 1);
     TextDrawUseBox(Text[playerid], 1);
     TextDrawBoxColor(Text[playerid], 168430212);
     TextDrawTextSize(Text[playerid], 172.000000, 0.000000);
     return 1;
}
stock CreateMenuEx(playerid,header[],text[])
{
    new
    string[128];
    format(string, sizeof string,"~g~%s",header);
    TextDrawSetString(Text:Header[playerid],string);
    TextDrawShowForPlayer(playerid,Text:Header[playerid]);
    // Text
    format(string, sizeof string,"~w~%s",text);
    TextDrawSetString(Text:Text[playerid],string);
    TextDrawShowForPlayer(playerid,Text:Text[playerid]);
    SetPVarInt(playerid,"KoristiMenuEx",1);
    SetPVarInt(playerid,"KoristiMenuExHeader",1);
    return 1;
}
stock HideMenuEx(playerid,bool:header,bool:text)
{
     if(header == true)
     {
       if(GetPVarInt(playerid,"KoristiMenuExHeader") == 1)
       {
         TextDrawHideForPlayer(playerid,Text:Header[playerid]);
         SetPVarInt(playerid,"KoristiMenuExHeader",0);
         TogglePlayerControllable(playerid, 1);
       }
       else
       {
          print("MenuEx: MenuEx header nemoze biti ugasen jer nije aktivan.");
       }
     }
     else if(text == true)
     {
        if(GetPVarInt(playerid,"KoristiMenuEx") == 1)
        {
           TextDrawHideForPlayer(playerid,Text:Text[playerid]);
           SetPVarInt(playerid,"KoristiMenuEx",0);
           TogglePlayerControllable(playerid, 1);
        }
        else
        {
          print("MenuEx: MenuEx text nemoze biti ugasen jer nije aktivan.");
        }
     }
     return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
     if(newkeys & KEY_FIRE)
     {
        if(GetPVarInt(playerid,"KoristiMenuEx") == 1)
        {
          HideMenuEx(playerid,0,1);
        }
        if(GetPVarInt(playerid,"KoristiMenuExHeader") == 1)
        {
          HideMenuEx(playerid,1,0);
        }
     }
     return 1;
}
stock CreateMenuExToAll(header[], text[],bool:freeze)
{
    new
    string[128];
    foreach(Player, z)
    {
      HideMenuEx(z,1,1);
      format(string, sizeof string,"~g~%s",header);
      TextDrawShowString(Text:Header,string);
      TextDrawShowToAll(Text:Header);
      // Text
      format(string, sizeof string,"~g~%s",text);
      TextDrawShowString(Text:Text,string);
      TextDrawShowToAll(Text:Text);
      SetPVarInt(z,"KoristiMenuEx",1);
      SetPVarInt(z,"KoristiMenuExHeader",1);
      if(freeze == true)
      {
        TogglePlayerControllable(z, 0);
      }
    }
    return 1;
}
stock HideMenuExToAll(bool:header,bool:text)
{
    foreach(Player, z)
    {
       if(header == true)
       {
         HideMenuEx(z,1,0);
       }
       else if(text == true)
       {
         HideMenuEx(z,0,1);
       }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)