Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- [FS]Information Box (By : ViruZZzZ_ChiLLL)
- ** Dont claim this as your own!
- ** Do not sell this script in anyway.
- ** Have fun ;)
- Credits :
- Dracoblue (DCMD)
- Zamaroht (Textdraw Editor)
- */
- // Includes
- #include <a_samp>
- // Textdraw
- new Text:InfoTD0;
- new Text:InfoTD1[MAX_PLAYERS];
- new Text:InfoTD2[MAX_PLAYERS];
- new Text:InfoTD3[MAX_PLAYERS];
- new Text:InfoTD4[MAX_PLAYERS];
- new Text:InfoTD5;
- // To get the total connected players
- new total;
- // To close it via LMB button
- #define PRESSED(%0) \
- (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
- // DCMD (By : Dracoblue)
- #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
- // OnFilterScriptInit() callback
- public OnFilterScriptInit()
- {
- print("\n--------------------------------");
- print(" [FS]Information Box LOADED!");
- print(" By : ViruZZzZ_ChiLLL");
- print("--------------------------------\n");
- InfoTD0 = TextDrawCreate(40.000000,154.000000,"~n~");
- InfoTD5 = TextDrawCreate(256.000000,257.000000,"Press LMB to close this box.");
- TextDrawUseBox(InfoTD0,1);
- TextDrawBoxColor(InfoTD0,0x00000022);
- TextDrawTextSize(InfoTD0,353.000000,0.000000);
- TextDrawAlignment(InfoTD0,0);
- TextDrawAlignment(InfoTD5,0);
- TextDrawBackgroundColor(InfoTD0,0x000000ff);
- TextDrawBackgroundColor(InfoTD5,0x000000ff);
- TextDrawFont(InfoTD0,0);
- TextDrawLetterSize(InfoTD0,1.000000,12.499999);
- TextDrawFont(InfoTD5,1);
- TextDrawLetterSize(InfoTD5,0.199999,1.100000);
- TextDrawColor(InfoTD0,0xffffffff);
- TextDrawColor(InfoTD5,0xff0000ff);
- TextDrawSetOutline(InfoTD0,1);
- TextDrawSetOutline(InfoTD5,1);
- TextDrawSetProportional(InfoTD0,1);
- TextDrawSetProportional(InfoTD5,1);
- TextDrawSetShadow(InfoTD0,1);
- TextDrawSetShadow(InfoTD5,1);
- return 1;
- }
- // OnFilterScriptExit() callback
- public OnFilterScriptExit()
- {
- print("\n--------------------------------");
- print(" [FS]Information Box UNLOADED!");
- print(" By : ViruZZzZ_ChiLLL");
- print("--------------------------------\n");
- return 1;
- }
- // OnPlayerConnect(playerid) callback
- public OnPlayerConnect(playerid)
- {
- InfoTD1[playerid] = TextDrawCreate(43.000000,192.000000,"~b~Current Pos : ~w~X() Y() Z()~n~~b~Current World : ~w~()~n~~b~Current Interior : ~w~()");
- InfoTD2[playerid] = TextDrawCreate(43.000000,155.000000,"~b~Name : ~w~()~n~~b~Cash : ~w~()~n~~b~Current Ping : ~w~()~n~~b~Score : ~w~()");
- InfoTD3[playerid] = TextDrawCreate(43.000000,219.000000,"~b~Health : ~w~()~n~~b~Armour : ~w~()");
- InfoTD4[playerid] = TextDrawCreate(43.000000,238.000000,"~b~Current IP : ~w~() ~n~~b~Total Players Online :~w~ ()");
- TextDrawAlignment(InfoTD1[playerid],0);
- TextDrawAlignment(InfoTD2[playerid],0);
- TextDrawAlignment(InfoTD3[playerid],0);
- TextDrawAlignment(InfoTD4[playerid],0);
- TextDrawBackgroundColor(InfoTD1[playerid],0x000000ff);
- TextDrawBackgroundColor(InfoTD2[playerid],0x000000ff);
- TextDrawBackgroundColor(InfoTD3[playerid],0x000000ff);
- TextDrawBackgroundColor(InfoTD4[playerid],0x000000ff);
- TextDrawFont(InfoTD1[playerid],1);
- TextDrawLetterSize(InfoTD1[playerid],0.299999,1.000000);
- TextDrawFont(InfoTD2[playerid],1);
- TextDrawLetterSize(InfoTD2[playerid],0.299999,1.000000);
- TextDrawFont(InfoTD3[playerid],1);
- TextDrawLetterSize(InfoTD3[playerid],0.299999,1.000000);
- TextDrawFont(InfoTD4[playerid],1);
- TextDrawLetterSize(InfoTD4[playerid],0.299999,1.000000);
- TextDrawColor(InfoTD1[playerid],0xffffffff);
- TextDrawColor(InfoTD2[playerid],0xffffffff);
- TextDrawColor(InfoTD3[playerid],0xffffffff);
- TextDrawColor(InfoTD4[playerid],0xffffffff);
- TextDrawSetOutline(InfoTD1[playerid],1);
- TextDrawSetOutline(InfoTD2[playerid],1);
- TextDrawSetOutline(InfoTD3[playerid],1);
- TextDrawSetOutline(InfoTD4[playerid],1);
- TextDrawSetProportional(InfoTD1[playerid],1);
- TextDrawSetProportional(InfoTD2[playerid],1);
- TextDrawSetProportional(InfoTD3[playerid],1);
- TextDrawSetProportional(InfoTD4[playerid],1);
- TextDrawSetShadow(InfoTD1[playerid],1);
- TextDrawSetShadow(InfoTD2[playerid],1);
- TextDrawSetShadow(InfoTD3[playerid],1);
- TextDrawSetShadow(InfoTD4[playerid],1);
- total++;
- return 1;
- }
- // OnPlayerDisconnect(playerid, reason) callback
- public OnPlayerDisconnect(playerid, reason)
- {
- total--;
- return 1;
- }
- // OnPlayerSpawn(playerid) callback
- public OnPlayerSpawn(playerid)
- {
- SetTimerEx("InfoTimer", 100, true, "i", playerid);
- return 1;
- }
- // OnPlayerCommandText(playerid, cmdtext[]) callback
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- dcmd(infobox, 7, cmdtext);
- return 0;
- }
- // Dcmd code
- dcmd_infobox(playerid, params[])
- {
- #pragma unused params
- TextDrawShowForPlayer(playerid, InfoTD0);
- TextDrawShowForPlayer(playerid, InfoTD1[playerid]);
- TextDrawShowForPlayer(playerid, InfoTD2[playerid]);
- TextDrawShowForPlayer(playerid, InfoTD3[playerid]);
- TextDrawShowForPlayer(playerid, InfoTD4[playerid]);
- TextDrawShowForPlayer(playerid, InfoTD5);
- return 1;
- }
- // OnPlayerKeyStateChange(playerid, newkeys, oldkeys) callback
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(PRESSED(KEY_FIRE))
- {
- TextDrawHideForPlayer(playerid, InfoTD0);
- TextDrawHideForPlayer(playerid, InfoTD1[playerid]);
- TextDrawHideForPlayer(playerid, InfoTD2[playerid]);
- TextDrawHideForPlayer(playerid, InfoTD3[playerid]);
- TextDrawHideForPlayer(playerid, InfoTD4[playerid]);
- TextDrawHideForPlayer(playerid, InfoTD5);
- }
- return 1;
- }
- // InfoTD update timer
- forward InfoTimer(playerid);
- public InfoTimer(playerid)
- {
- new string[156];
- new name[MAX_PLAYER_NAME];
- new ip[56];
- GetPlayerName(playerid, name, sizeof(name));
- GetPlayerIp(playerid, ip, sizeof(ip));
- new Float:x, Float:y, Float:z, Float:health, Float:armour;
- GetPlayerPos(playerid, x, y, z);
- 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));
- TextDrawSetString(InfoTD1[playerid], string);
- 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));
- TextDrawSetString(InfoTD2[playerid], string);
- GetPlayerHealth(playerid, health); GetPlayerArmour(playerid, armour);
- format(string, sizeof(string), "~b~Health : ~w~(%f)~n~~b~Armour : ~w~(%f)", health, armour);
- TextDrawSetString(InfoTD3[playerid], string);
- format(string, sizeof(string), "~b~Current IP : ~w~(%s) ~n~~b~Total Players Online :~w~ (%d)", ip, total);
- TextDrawSetString(InfoTD4[playerid], string);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement