Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*===================================[Credits]==================================
- Thank you for downloading my filterscript. As far as I know there are no bugs
- but you can always report them if you may find one.
- Credits: Xeriuk
- =====================================[Credits]=================================*/
- #define FILTERSCRIPT
- #include <a_samp>
- #include <YSI\y_ini>
- #include <zcmd>
- #if defined FILTERSCRIPT
- //===============================[COLORS]=======================================
- #define COL_WHITE "{FFFFFF}"
- #define COL_RED "{F81414}"
- #define COLOR_GREY 0xAFAFAFAA
- //==============================[SYMBOLS MAX_PLAYERS]===========================
- new gPlayerLogged[MAX_PLAYERS];
- new gPlayerLogTries[MAX_PLAYERS];
- //===================================[Defines]==================================
- #define PRESSED(%0) \
- (((newkeys&(%0))==(%0)) && ((oldkeys & (%0)) != (%0))) //Define for pressing keys
- #define PATH "/Users/%s.ini" //This is where the info will be saved
- #define strlen(%0,%1,%2) %0="",strcat(%0,%2,%1)
- //===================================[Playerinfo]===============================
- enum pInfo //Here we specify the players info that it should save.
- {
- pPass,
- pKills,
- pDeaths,
- pCash,
- pAdmin,
- pWarns,
- pMuted,
- pMuteTime,
- pModel,
- pVip,
- };
- new PlayerInfo[MAX_PLAYERS][pInfo];
- forward LoadUser_data(playerid,name[],value[]);
- public LoadUser_data(playerid,name[],value[])
- {
- INI_Int("Password",PlayerInfo[playerid][pPass]);
- INI_Int("Kills",PlayerInfo[playerid][pKills]);
- INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
- INI_Int("Money",PlayerInfo[playerid][pCash]);
- INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
- INI_Int("Model",PlayerInfo[playerid][pModel]);
- INI_Int("Warns",PlayerInfo[playerid][pWarns]);
- INI_Int("Muted",PlayerInfo[playerid][pMuted]);
- INI_Int("MuteTime",PlayerInfo[playerid][pMuteTime]);
- INI_Int("Vip",PlayerInfo[playerid][pVip]);
- return 1;
- }
- //========================[Textdraws]===========================================
- new Text:StatsText0; //All the textdraws we need to make the actual screen
- new Text:StatsText1;
- new Text:StatsText2;
- new Text:StatsText3;
- new Text:StatsText4;
- new Text:StatsText5;
- new Text:StatsText6;
- new Text:StatsText7;
- new Text:StatsText8;
- new Text:StatsText9;
- new Text:StatsText10;
- new Text:StatsText11;
- new Text:StatsText13;
- //======================[Stocks]================================================
- stock UserPath(playerid)
- {
- new string[128],playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid,playername,sizeof(playername));
- format(string,sizeof(string),PATH,playername);
- return string;
- }
- stock udb_hash(buf[]) { // Credits to DracoBlue
- new length=strlen(buf);
- new s1 = 1;
- new s2 = 0;
- new n;
- for (n=0; n<length; n++)
- {
- s1 = (s1 + buf[n]) % 65521;
- s2 = (s2 + s1) % 65521;
- }
- return (s2 << 16) + s1;
- }
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Textdraw playerstats v1");
- print("--------------------------------------\n");
- StatsText0 = TextDrawCreate(200.000000, 110.000000, "New Textdraw");
- TextDrawBackgroundColor(StatsText0, 255);
- TextDrawFont(StatsText0, 1);
- TextDrawLetterSize(StatsText0, 0.000000, 11.899996);
- TextDrawColor(StatsText0, -1);
- TextDrawSetOutline(StatsText0, 0);
- TextDrawSetProportional(StatsText0, 1);
- TextDrawSetShadow(StatsText0, 1);
- TextDrawUseBox(StatsText0, 1);
- TextDrawBoxColor(StatsText0, 0x0000008B);
- TextDrawTextSize(StatsText0, 20.000000, 0.000000);
- StatsText1 = TextDrawCreate(112.000000, 116.000000, "Player Information");
- TextDrawAlignment(StatsText1, 2);
- TextDrawBackgroundColor(StatsText1, 255);
- TextDrawFont(StatsText1, 3);
- TextDrawLetterSize(StatsText1, 0.389999, 1.700000);
- TextDrawColor(StatsText1, 65535);
- TextDrawSetOutline(StatsText1, 0);
- TextDrawSetProportional(StatsText1, 1);
- TextDrawSetShadow(StatsText1, 1);
- StatsText2 = TextDrawCreate(110.000000, 136.000000, "Name:");
- TextDrawAlignment(StatsText2, 2);
- TextDrawBackgroundColor(StatsText2, 255);
- TextDrawFont(StatsText2, 1);
- TextDrawLetterSize(StatsText2, 0.219999, 1.000000);
- TextDrawColor(StatsText2, -65281);
- TextDrawSetOutline(StatsText2, 0);
- TextDrawSetProportional(StatsText2, 1);
- TextDrawSetShadow(StatsText2, 1);
- StatsText3 = TextDrawCreate(110.000000, 146.000000, "Kills:");
- TextDrawAlignment(StatsText3, 2);
- TextDrawBackgroundColor(StatsText3, 255);
- TextDrawFont(StatsText3, 1);
- TextDrawLetterSize(StatsText3, 0.219999, 1.000000);
- TextDrawColor(StatsText3, -65281);
- TextDrawSetOutline(StatsText3, 0);
- TextDrawSetProportional(StatsText3, 1);
- TextDrawSetShadow(StatsText3, 1);
- StatsText4 = TextDrawCreate(110.000000, 156.000000, "Deaths:");
- TextDrawAlignment(StatsText4, 2);
- TextDrawBackgroundColor(StatsText4, 255);
- TextDrawFont(StatsText4, 1);
- TextDrawLetterSize(StatsText4, 0.219999, 1.000000);
- TextDrawColor(StatsText4, -65281);
- TextDrawSetOutline(StatsText4, 0);
- TextDrawSetProportional(StatsText4, 1);
- TextDrawSetShadow(StatsText4, 1);
- StatsText5 = TextDrawCreate(112.000000, 173.000000, "General Information");
- TextDrawAlignment(StatsText5, 2);
- TextDrawBackgroundColor(StatsText5, 255);
- TextDrawFont(StatsText5, 2);
- TextDrawLetterSize(StatsText5, 0.219999, 1.000000);
- TextDrawColor(StatsText5, -1);
- TextDrawSetOutline(StatsText5, 0);
- TextDrawSetProportional(StatsText5, 1);
- TextDrawSetShadow(StatsText5, 1);
- StatsText6 = TextDrawCreate(110.000000, 186.000000, "Money:");
- TextDrawAlignment(StatsText6, 2);
- TextDrawBackgroundColor(StatsText6, 255);
- TextDrawFont(StatsText6, 1);
- TextDrawLetterSize(StatsText6, 0.219999, 1.000000);
- TextDrawColor(StatsText6, -16776961);
- TextDrawSetOutline(StatsText6, 0);
- TextDrawSetProportional(StatsText6, 1);
- TextDrawSetShadow(StatsText6, 1);
- StatsText7 = TextDrawCreate(110.000000, 196.000000, "Skin:");
- TextDrawAlignment(StatsText7, 2);
- TextDrawBackgroundColor(StatsText7, 255);
- TextDrawFont(StatsText7, 1);
- TextDrawLetterSize(StatsText7, 0.219999, 1.000000);
- TextDrawColor(StatsText7, -16776961);
- TextDrawSetOutline(StatsText7, 0);
- TextDrawSetProportional(StatsText7, 1);
- TextDrawSetShadow(StatsText7, 1);
- StatsText8 = TextDrawCreate(110.000000, 206.000000, "VIP:");
- TextDrawAlignment(StatsText8, 2);
- TextDrawBackgroundColor(StatsText8, 255);
- TextDrawFont(StatsText8, 1);
- TextDrawLetterSize(StatsText8, 0.219999, 1.000000);
- TextDrawColor(StatsText8, -16776961);
- TextDrawSetOutline(StatsText8, 0);
- TextDrawSetProportional(StatsText8, 1);
- TextDrawSetShadow(StatsText8, 1);
- StatsText9 = TextDrawCreate(62.000000, 233.000000, "Extra Informations");
- TextDrawBackgroundColor(StatsText9, 255);
- TextDrawFont(StatsText9, 2);
- TextDrawLetterSize(StatsText9, 0.219999, 1.000000);
- TextDrawColor(StatsText9, -1);
- TextDrawSetOutline(StatsText9, 0);
- TextDrawSetProportional(StatsText9, 1);
- TextDrawSetShadow(StatsText9, 1);
- StatsText10 = TextDrawCreate(110.000000, 246.000000, "Muted:");
- TextDrawAlignment(StatsText10, 2);
- TextDrawBackgroundColor(StatsText10, 255);
- TextDrawFont(StatsText10, 1);
- TextDrawLetterSize(StatsText10, 0.219999, 1.000000);
- TextDrawColor(StatsText10, 16711935);
- TextDrawSetOutline(StatsText10, 0);
- TextDrawSetProportional(StatsText10, 1);
- TextDrawSetShadow(StatsText10, 1);
- StatsText11 = TextDrawCreate(110.000000, 256.000000, "Warnings:");
- TextDrawAlignment(StatsText11, 2);
- TextDrawBackgroundColor(StatsText11, 255);
- TextDrawFont(StatsText11, 1);
- TextDrawLetterSize(StatsText11, 0.219999, 1.000000);
- TextDrawColor(StatsText11, 16711935);
- TextDrawSetOutline(StatsText11, 0);
- TextDrawSetProportional(StatsText11, 1);
- TextDrawSetShadow(StatsText11, 1);
- StatsText13 = TextDrawCreate(111.000000, 314.000000, "~G~- ~Y~Press LMB to close");
- TextDrawAlignment(StatsText13, 2);
- TextDrawBackgroundColor(StatsText13, 255);
- TextDrawFont(StatsText13, 1);
- TextDrawLetterSize(StatsText13, 0.189999, 0.699998);
- TextDrawSetOutline(StatsText13, 0);
- TextDrawSetProportional(StatsText13, 1);
- TextDrawSetShadow(StatsText13, 1);
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #endif
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- if(fexist(UserPath(playerid)))
- {
- INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
- ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
- }
- else
- {
- ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
- }
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/mycommand", cmdtext, true, 10) == 0)
- {
- // Do something here
- return 1;
- }
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- return 1;
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(newkeys == KEY_FIRE)
- {
- TextDrawHideForPlayer(playerid,StatsText0);
- TextDrawHideForPlayer(playerid,StatsText1);
- TextDrawHideForPlayer(playerid,StatsText2);
- TextDrawHideForPlayer(playerid,StatsText3);
- TextDrawHideForPlayer(playerid,StatsText4);
- TextDrawHideForPlayer(playerid,StatsText5);
- TextDrawHideForPlayer(playerid,StatsText6);
- TextDrawHideForPlayer(playerid,StatsText7);
- TextDrawHideForPlayer(playerid,StatsText8);
- TextDrawHideForPlayer(playerid,StatsText9);
- TextDrawHideForPlayer(playerid,StatsText10);
- TextDrawHideForPlayer(playerid,StatsText11);
- TextDrawHideForPlayer(playerid,StatsText13);
- }
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- return 1;
- }
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- return 1;
- }
- public OnPlayerStreamOut(playerid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamOut(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == 1234)
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- if(fexist(UserPath(playerid)))
- {
- INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
- ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
- }
- else
- {
- ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
- }
- }
- }
- if(dialogid == 1)
- {
- if (!response) return Kick(playerid);
- if(response)
- {
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
- gPlayerLogged[playerid] = 1;
- SetSpawnInfo( playerid, 0, 23, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
- SpawnPlayer(playerid);
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"Password",udb_hash(inputtext));
- INI_WriteInt(File, "Kills",PlayerInfo[playerid][pKills] = 0);
- INI_WriteInt(File, "Deaths",PlayerInfo[playerid][pDeaths] = 0);
- INI_WriteInt(File, "Money",PlayerInfo[playerid][pCash] = 0);
- INI_WriteInt(File, "Admin",PlayerInfo[playerid][pAdmin] = 0);
- INI_WriteInt(File, "Vip", PlayerInfo[playerid][pVip] = 0);
- INI_WriteInt(File, "Model", PlayerInfo[playerid][pModel] = 23);
- INI_WriteInt(File, "Warns", PlayerInfo[playerid][pWarns] = 0);
- INI_WriteInt(File, "Muted", PlayerInfo[playerid][pMuted] = 0);
- INI_WriteInt(File, "MuteTime", PlayerInfo[playerid][pMuteTime] = 0);
- INI_Close(File);
- }
- }
- if(dialogid == 2)
- {
- if(!response ) return Kick (playerid);
- if(response)
- {
- if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
- {
- SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
- GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
- INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
- SetSpawnInfo( playerid, 0, PlayerInfo[playerid][pModel], 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
- SpawnPlayer(playerid);
- gPlayerLogged[playerid] = 1;
- }
- else
- {
- ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
- gPlayerLogTries[playerid] += 1;
- if(gPlayerLogTries[playerid] == 3)
- {
- Kick(playerid);
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- //===============================[Commands]=====================================
- //---------[Stats]-------
- CMD:stats(playerid, params[])
- {
- if(gPlayerLogged[playerid] == 1) //Check if the player is logged in.
- {
- //Defines all the variables to show in the string
- new string[128];
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- new cash = GetPlayerMoney(playerid);
- new atext[20];
- if(PlayerInfo[playerid][pMuted] == 0)
- { atext = "No"; }
- else if(PlayerInfo[playerid][pMuted] == 1)
- { atext = "Yes"; }
- new drank[20];
- if(PlayerInfo[playerid][pVip] == 1)
- { drank = "Bronze Donator"; }
- else if(PlayerInfo[playerid][pVip] == 2)
- { drank = "Silver Donator"; }
- else if(PlayerInfo[playerid][pVip] == 3)
- { drank = "Gold Donator"; }
- else if(PlayerInfo[playerid][pVip] == 4)
- { drank = "Platinum Donator"; }
- else { drank = "None"; }
- new warns = PlayerInfo[playerid][pWarns];
- new skin = PlayerInfo[playerid][pModel];
- //Here the script will show the variables in a string and parse them to the textdraws
- format(string,sizeof(string),"~G~- ~Y~Name: %s",name);
- TextDrawSetString(Text:StatsText2,string);
- format(string,sizeof(string),"~G~- ~Y~Kills: %d",PlayerInfo[playerid][pKills]);
- TextDrawSetString(Text:StatsText3,string);
- format(string,sizeof(string),"~G~- ~Y~Deaths: %d",PlayerInfo[playerid][pDeaths]);
- TextDrawSetString(Text:StatsText4,string);
- format(string,sizeof(string),"~G~- ~Y~Money: %d",cash);
- TextDrawSetString(Text:StatsText6,string);
- format(string,sizeof(string),"~G~- ~Y~Skin: %d",skin);
- TextDrawSetString(Text:StatsText7,string);
- format(string,sizeof(string),"~G~- ~Y~VIP: %s",drank);
- TextDrawSetString(Text:StatsText8,string);
- format(string,sizeof(string),"~G~- ~Y~Muted: %s",atext);
- TextDrawSetString(Text:StatsText10,string);
- format(string,sizeof(string),"~G~- ~Y~Warnings: %d",warns);
- TextDrawSetString(Text:StatsText11,string);
- //Shows all the textdraws with the correct info!
- TextDrawShowForPlayer(playerid, StatsText0);
- TextDrawShowForPlayer(playerid, StatsText1);
- TextDrawShowForPlayer(playerid, StatsText2);
- TextDrawShowForPlayer(playerid, StatsText3);
- TextDrawShowForPlayer(playerid, StatsText4);
- TextDrawShowForPlayer(playerid, StatsText5);
- TextDrawShowForPlayer(playerid, StatsText6);
- TextDrawShowForPlayer(playerid, StatsText7);
- TextDrawShowForPlayer(playerid, StatsText8);
- TextDrawShowForPlayer(playerid, StatsText9);
- TextDrawShowForPlayer(playerid, StatsText10);
- TextDrawShowForPlayer(playerid, StatsText11);
- TextDrawShowForPlayer(playerid, StatsText13);
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY,"You are not logged in!");
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement