Problem with arguments
#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


Messages In This Thread
Problem with arguments - by DarkPower - 04.09.2010, 23:03
Re: Problem with arguments - by willsuckformoney - 04.09.2010, 23:17
Re: Problem with arguments - by DarkPower - 04.09.2010, 23:18
Re: Problem with arguments - by woot - 04.09.2010, 23:22
Re: Problem with arguments - by DarkPower - 04.09.2010, 23:24

Forum Jump:


Users browsing this thread: 1 Guest(s)