Advertisement
Guest User

Untitled

a guest
Jul 17th, 2010
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.83 KB | None | 0 0
  1. /*
  2. [FS]Information Box (By : ViruZZzZ_ChiLLL)
  3.  
  4. ** Dont claim this as your own!
  5. ** Do not sell this script in anyway.
  6. ** Have fun ;)
  7.  
  8. Credits :
  9. Dracoblue (DCMD)
  10. Zamaroht (Textdraw Editor)
  11. */
  12.  
  13. // Includes
  14. #include <a_samp>
  15.  
  16. // Textdraw
  17. new Text:InfoTD0;
  18. new Text:InfoTD1[MAX_PLAYERS];
  19. new Text:InfoTD2[MAX_PLAYERS];
  20. new Text:InfoTD3[MAX_PLAYERS];
  21. new Text:InfoTD4[MAX_PLAYERS];
  22. new Text:InfoTD5;
  23.  
  24. // To get the total connected players
  25. new total;
  26.  
  27. // To close it via LMB button
  28. #define PRESSED(%0) \
  29.     (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  30.  
  31. // DCMD (By : Dracoblue)
  32. #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  33.  
  34.  
  35. // OnFilterScriptInit() callback
  36. public OnFilterScriptInit()
  37. {
  38.    print("\n--------------------------------");
  39.    print("  [FS]Information Box LOADED!");
  40.    print("  By : ViruZZzZ_ChiLLL");
  41.    print("--------------------------------\n");
  42.  
  43.  
  44.    
  45.    InfoTD0 = TextDrawCreate(40.000000,154.000000,"~n~");
  46.    InfoTD5 = TextDrawCreate(256.000000,257.000000,"Press LMB to close this box.");
  47.    TextDrawUseBox(InfoTD0,1);
  48.    TextDrawBoxColor(InfoTD0,0x00000022);
  49.    TextDrawTextSize(InfoTD0,353.000000,0.000000);
  50.    TextDrawAlignment(InfoTD0,0);
  51.    TextDrawAlignment(InfoTD5,0);
  52.    TextDrawBackgroundColor(InfoTD0,0x000000ff);
  53.    TextDrawBackgroundColor(InfoTD5,0x000000ff);
  54.    TextDrawFont(InfoTD0,0);
  55.    TextDrawLetterSize(InfoTD0,1.000000,12.499999);
  56.    TextDrawFont(InfoTD5,1);
  57.    TextDrawLetterSize(InfoTD5,0.199999,1.100000);
  58.    TextDrawColor(InfoTD0,0xffffffff);
  59.    TextDrawColor(InfoTD5,0xff0000ff);
  60.    TextDrawSetOutline(InfoTD0,1);
  61.    TextDrawSetOutline(InfoTD5,1);
  62.    TextDrawSetProportional(InfoTD0,1);
  63.    TextDrawSetProportional(InfoTD5,1);
  64.    TextDrawSetShadow(InfoTD0,1);
  65.    TextDrawSetShadow(InfoTD5,1);
  66.  
  67.    return 1;
  68. }
  69.  
  70. // OnFilterScriptExit() callback
  71. public OnFilterScriptExit()
  72. {
  73.    print("\n--------------------------------");
  74.    print("  [FS]Information Box UNLOADED!");
  75.    print("  By : ViruZZzZ_ChiLLL");
  76.    print("--------------------------------\n");
  77.    return 1;
  78. }
  79.  
  80. // OnPlayerConnect(playerid) callback
  81. public OnPlayerConnect(playerid)
  82. {
  83.    InfoTD1[playerid] = TextDrawCreate(43.000000,192.000000,"~b~Current Pos : ~w~X() Y() Z()~n~~b~Current World : ~w~()~n~~b~Current Interior : ~w~()");
  84.    InfoTD2[playerid] = TextDrawCreate(43.000000,155.000000,"~b~Name : ~w~()~n~~b~Cash : ~w~()~n~~b~Current Ping : ~w~()~n~~b~Score : ~w~()");
  85.    InfoTD3[playerid] = TextDrawCreate(43.000000,219.000000,"~b~Health : ~w~()~n~~b~Armour : ~w~()");
  86.    InfoTD4[playerid] = TextDrawCreate(43.000000,238.000000,"~b~Current IP : ~w~() ~n~~b~Total Players Online :~w~ ()");
  87.    TextDrawAlignment(InfoTD1[playerid],0);
  88.    TextDrawAlignment(InfoTD2[playerid],0);
  89.    TextDrawAlignment(InfoTD3[playerid],0);
  90.    TextDrawAlignment(InfoTD4[playerid],0);
  91.    TextDrawBackgroundColor(InfoTD1[playerid],0x000000ff);
  92.    TextDrawBackgroundColor(InfoTD2[playerid],0x000000ff);
  93.    TextDrawBackgroundColor(InfoTD3[playerid],0x000000ff);
  94.    TextDrawBackgroundColor(InfoTD4[playerid],0x000000ff);
  95.    TextDrawFont(InfoTD1[playerid],1);
  96.    TextDrawLetterSize(InfoTD1[playerid],0.299999,1.000000);
  97.    TextDrawFont(InfoTD2[playerid],1);
  98.    TextDrawLetterSize(InfoTD2[playerid],0.299999,1.000000);
  99.    TextDrawFont(InfoTD3[playerid],1);
  100.    TextDrawLetterSize(InfoTD3[playerid],0.299999,1.000000);
  101.    TextDrawFont(InfoTD4[playerid],1);
  102.    TextDrawLetterSize(InfoTD4[playerid],0.299999,1.000000);
  103.    TextDrawColor(InfoTD1[playerid],0xffffffff);
  104.    TextDrawColor(InfoTD2[playerid],0xffffffff);
  105.    TextDrawColor(InfoTD3[playerid],0xffffffff);
  106.    TextDrawColor(InfoTD4[playerid],0xffffffff);
  107.    TextDrawSetOutline(InfoTD1[playerid],1);
  108.    TextDrawSetOutline(InfoTD2[playerid],1);
  109.    TextDrawSetOutline(InfoTD3[playerid],1);
  110.    TextDrawSetOutline(InfoTD4[playerid],1);
  111.    TextDrawSetProportional(InfoTD1[playerid],1);
  112.    TextDrawSetProportional(InfoTD2[playerid],1);
  113.    TextDrawSetProportional(InfoTD3[playerid],1);
  114.    TextDrawSetProportional(InfoTD4[playerid],1);
  115.    TextDrawSetShadow(InfoTD1[playerid],1);
  116.    TextDrawSetShadow(InfoTD2[playerid],1);
  117.    TextDrawSetShadow(InfoTD3[playerid],1);
  118.    TextDrawSetShadow(InfoTD4[playerid],1);
  119.    total++;
  120.    return 1;
  121. }
  122.  
  123. // OnPlayerDisconnect(playerid, reason) callback
  124. public OnPlayerDisconnect(playerid, reason)
  125. {
  126.     total--;
  127.     return 1;
  128. }
  129.  
  130. // OnPlayerSpawn(playerid) callback
  131. public OnPlayerSpawn(playerid)
  132. {
  133.     SetTimerEx("InfoTimer", 100, true, "i", playerid);
  134.     return 1;
  135. }
  136.  
  137. // OnPlayerCommandText(playerid, cmdtext[]) callback
  138. public OnPlayerCommandText(playerid, cmdtext[])
  139. {
  140.     dcmd(infobox, 7, cmdtext);
  141.     return 0;
  142. }
  143.  
  144. // Dcmd code
  145. dcmd_infobox(playerid, params[])
  146. {
  147.     #pragma unused params
  148.     TextDrawShowForPlayer(playerid, InfoTD0);
  149.     TextDrawShowForPlayer(playerid, InfoTD1[playerid]);
  150.     TextDrawShowForPlayer(playerid, InfoTD2[playerid]);
  151.     TextDrawShowForPlayer(playerid, InfoTD3[playerid]);
  152.     TextDrawShowForPlayer(playerid, InfoTD4[playerid]);
  153.     TextDrawShowForPlayer(playerid, InfoTD5);
  154.     return 1;
  155. }
  156.  
  157. // OnPlayerKeyStateChange(playerid, newkeys, oldkeys) callback
  158. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  159. {
  160.     if(PRESSED(KEY_FIRE))
  161.     {
  162.       TextDrawHideForPlayer(playerid, InfoTD0);
  163.       TextDrawHideForPlayer(playerid, InfoTD1[playerid]);
  164.       TextDrawHideForPlayer(playerid, InfoTD2[playerid]);
  165.       TextDrawHideForPlayer(playerid, InfoTD3[playerid]);
  166.       TextDrawHideForPlayer(playerid, InfoTD4[playerid]);
  167.       TextDrawHideForPlayer(playerid, InfoTD5);
  168.     }
  169.     return 1;
  170. }
  171.  
  172. // InfoTD update timer
  173. forward InfoTimer(playerid);
  174. public InfoTimer(playerid)
  175. {
  176.     new string[156];
  177.     new name[MAX_PLAYER_NAME];
  178.     new ip[56];
  179.     GetPlayerName(playerid, name, sizeof(name));
  180.     GetPlayerIp(playerid, ip, sizeof(ip));
  181.     new Float:x, Float:y, Float:z, Float:health, Float:armour;
  182.  
  183.     GetPlayerPos(playerid, x, y, z);
  184.     format(string, sizeof(string), "~b~Current Pos : ~w~X(%f) Y(%f) Z(%f)~n~~b~Current World : ~w~(%d)~n~~b~Current Interior : ~w~(%d)", x, y, z, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
  185.     TextDrawSetString(InfoTD1[playerid], string);
  186.  
  187.     format(string, sizeof(string), "~b~Name : ~w~(%s)~n~~b~Cash : ~w~($%d)~n~~b~Current Ping : ~w~(%d)~n~~b~Score : ~w~(%d)", name, GetPlayerMoney(playerid), GetPlayerPing(playerid), GetPlayerScore(playerid));
  188.     TextDrawSetString(InfoTD2[playerid], string);
  189.  
  190.     GetPlayerHealth(playerid, health); GetPlayerArmour(playerid, armour);
  191.     format(string, sizeof(string), "~b~Health : ~w~(%f)~n~~b~Armour : ~w~(%f)", health, armour);
  192.     TextDrawSetString(InfoTD3[playerid], string);
  193.  
  194.     format(string, sizeof(string), "~b~Current IP : ~w~(%s) ~n~~b~Total Players Online :~w~ (%d)", ip, total);
  195.     TextDrawSetString(InfoTD4[playerid], string);
  196.  
  197.     return 1;
  198. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement