Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <y_ini>
- #include <progress>
- enum PLAYER_DATA
- {
- PLAYER_PASS[129],
- PLAYER_CASH,
- PLAYER_SCORE,
- PLAYER_LEVEL,
- PLAYER_EXP,
- PLAYER_TOTALEXP,
- /*PLAYER_WEAP1TYPE,
- PLAYER_WEAP2TYPE,
- PLAYER_WEAP3TYPE,
- PLAYER_WEAP1SPEC,
- PLAYER_WEAP2SPEC,
- PLAYER_WEAP3SPEC,
- PLAYER_WEAP1LVL,
- PLAYER_WEAP2LVL,
- PLAYER_WEAP3LVL,*/ //Not used yet.
- PLAYER_POINTS,
- PLAYER_STRENGTH,
- PLAYER_DEFENCE,
- PLAYER_CURWEAP,
- WEAPPOINTS,
- SAWNOFF,
- SILENCED,
- DEAGLE,
- SHOTGUN,
- SPAS12,
- MICRO_UZI,
- MP5,
- AK47,
- M4,
- SNIPERRIFLE
- }
- new Text:ExpText[MAX_PLAYERS];
- new Text:LevelText[MAX_PLAYERS];
- new Bar:bar[MAX_PLAYERS], Bar:HPBar[MAX_PLAYERS], Text:HPText[MAX_PLAYERS], Bar:OpponentHPBar[MAX_PLAYERS], Text:OpponentHPText[MAX_PLAYERS], Text:OpponentHPImg, Text:OpponentHPImgFull, Text:OpponentName[MAX_PLAYERS];
- new Text3D:HP3DText[MAX_PLAYERS];
- new Text3D:LevelLabel[MAX_PLAYERS];
- new Text3D:NameTag[MAX_PLAYERS];
- new OpponentHPHide[MAX_PLAYERS];
- new PlayerInfo[MAX_PLAYERS][PLAYER_DATA];
- //You can change these values.
- #define ExpForLevel 500 //How much exp you need to pass a level. The Exp gets multiplied by the level. If you've got 1000 total exp then for lvl 2 it will be 2000
- #define MaxLevel 99 //The maximum level a player can achieve.
- #define UseProgBar // Define wheater to use the progress bar or not. Comment the line if you don't want a progress bar and leave like that if you do want a progress bar.
- #define ProgBarColor 0x0000FFFF //The experience bar's color.
- #define TextLabelColor 0x00FFFFFF // The textlabel's color.
- #define CashForLevelUp 300 //This is the cash you get for levelling up. It gets multiplied by the level you achieved and one more time by a number you define.
- #define CashMultiplier 1 //This multiplies the Cash * Level achieved by the number you want.
- #define GameTextStyle 4 //This defines the GameText's style used for the GivePlayerExp function.
- #define GameTextTime 3000 //This defines the time for which the GameText for the GivePlayerExp function will be visible
- //#define StaticNums //This defines that the numbers stay in one place with a couple of zeroes in front of them. Comment to remove the zeroes.
- //Don't change these values.
- #define mustlogin
- #define autologin
- //Declaring New
- new logged_in[MAX_PLAYERS];
- new Retries[MAX_PLAYERS];
- stock GivePlayerExp(playerid, exp, reason[])
- {
- new pfile[100], pname[MAX_PLAYER_NAME], string2[126], string3[126], string4[126], string5[64];
- GetPlayerName(playerid, pname, sizeof(pname));
- format(pfile, sizeof(pfile), "HAccounts/%s.ini",pname);
- PlayerInfo[playerid][PLAYER_EXP] += exp;
- if (PlayerInfo[playerid][PLAYER_EXP] >= PlayerInfo[playerid][PLAYER_TOTALEXP])
- {
- if (PlayerInfo[playerid][PLAYER_LEVEL] < MaxLevel)
- {
- while (PlayerInfo[playerid][PLAYER_EXP] >= PlayerInfo[playerid][PLAYER_TOTALEXP])
- {
- PlayerInfo[playerid][PLAYER_EXP] -= PlayerInfo[playerid][PLAYER_TOTALEXP];
- PlayerInfo[playerid][PLAYER_LEVEL] += 1;
- PlayerInfo[playerid][PLAYER_TOTALEXP] = PlayerInfo[playerid][PLAYER_LEVEL] * ExpForLevel;
- #if defined StaticNums
- format(string3, sizeof(string3), "Level: %02d", PlayerInfo[playerid][PLAYER_LEVEL]);
- #else
- format(string3, sizeof(string3), "Level: %d", PlayerInfo[playerid][PLAYER_LEVEL]);
- #endif
- TextDrawSetString(LevelText[playerid], string3);
- GivePlayerMoney(playerid, CashForLevelUp * PlayerInfo[playerid][PLAYER_LEVEL] * CashMultiplier);
- format(string4, sizeof(string4), "~p~You got %d Exp for ~n~%s !~n~~g~Level up!~n~~b~+1 Point.", exp, reason);
- SetProgressBarMaxValue(HPBar[playerid], (PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2);
- SetProgressBarValue(HPBar[playerid], (PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2);
- UpdateProgressBar(HPBar[playerid], playerid);
- format(string5, sizeof(string5), "%d/%d",(PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2, (PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2);
- TextDrawSetString(HPText[playerid], string5);
- UpdateBar(playerid);
- PlayerInfo[playerid][PLAYER_POINTS]++;
- PlayerInfo[playerid][WEAPPOINTS]++;
- }
- }
- else
- {
- GameTextForPlayer(playerid, "~g~Max Level Reached!", GameTextTime, GameTextStyle);
- PlayerInfo[playerid][PLAYER_EXP] = PlayerInfo[playerid][PLAYER_TOTALEXP];
- }
- }
- else
- {
- format(string4, sizeof(string4), "~p~You got %d Exp for ~n~%s !", exp, reason);
- }
- #if defined StaticNums
- format(string2, sizeof(string2), "Exp: %05d/%05d",PlayerInfo[playerid][PLAYER_EXP], PlayerInfo[playerid][PLAYER_TOTALEXP]);
- format(string3, sizeof(string3), "Level: %02d",PlayerInfo[playerid][PLAYER_LEVEL]);
- #else
- format(string2, sizeof(string2), "Exp: %d/%d",PlayerInfo[playerid][PLAYER_EXP], PlayerInfo[playerid][PLAYER_TOTALEXP]);
- format(string3, sizeof(string3), "Level: %d",PlayerInfo[playerid][PLAYER_LEVEL]);
- #endif
- TextDrawSetString(ExpText[playerid], string2);
- #if defined UseProgBar
- SetProgressBarValue(bar[playerid], PlayerInfo[playerid][PLAYER_EXP]);
- SetProgressBarMaxValue(bar[playerid], PlayerInfo[playerid][PLAYER_TOTALEXP]);
- UpdateProgressBar(bar[playerid], playerid);
- #endif
- GameTextForPlayer(playerid, string4, GameTextTime, GameTextStyle);
- Update3DTextLabelText(LevelLabel[playerid], TextLabelColor, string3);
- }
- stock ResetPlayerExp(playerid)
- {
- new string[64];
- PlayerInfo[playerid][PLAYER_EXP] = 0;
- #if defined StaticNums
- format(string, sizeof(string), "Exp: %05d/%05d",PlayerInfo[playerid][PLAYER_EXP], PlayerInfo[playerid][PLAYER_TOTALEXP]);
- #else
- format(string, sizeof(string), "Exp: %d/%d",PlayerInfo[playerid][PLAYER_EXP], PlayerInfo[playerid][PLAYER_TOTALEXP]);
- #endif
- TextDrawSetString(ExpText[playerid], string);
- }
- stock ResetPlayerExpLevel(playerid)
- {
- new string[64], string2[64];
- PlayerInfo[playerid][PLAYER_LEVEL] = 1;
- PlayerInfo[playerid][PLAYER_TOTALEXP] = ExpForLevel * PlayerInfo[playerid][PLAYER_EXPLEVEL];
- PlayerInfo[playerid][PLAYER_EXP] = 0;
- #if defined StaticNums
- format(string, sizeof(string), "Level: %02d",PlayerInfo[playerid][PLAYER_LEVEL]);
- format(string2, sizeof(string2), "Exp: %05d/%05d",PlayerInfo[playerid][PLAYER_EXP], PlayerInfo[playerid][PLAYER_TOTALEXP]);
- #else
- format(string, sizeof(string), "Level: %d",PlayerInfo[playerid][PLAYER_LEVEL]);
- format(string2, sizeof(string2), "Exp: %d/%d",PlayerInfo[playerid][PLAYER_EXP], PlayerInfo[playerid][PLAYER_TOTALEXP]);
- #endif
- TextDrawSetString(LevelText[playerid], string);
- TextDrawSetString(ExpText[playerid], string2);
- }
- stock SetPlayerExpLevel(playerid, level)
- {
- new string[64], string3[64];
- PlayerInfo[playerid][PLAYER_LEVEL] = level;
- PlayerInfo[playerid][PLAYER_TOTALEXP] = ExpForLevel * level;
- PlayerInfo[playerid][PLAYER_EXP] = 0;
- #if defined StaticNums
- format(string3, sizeof(string3), "Level: %02d",PlayerInfo[playerid][PLAYER_LEVEL]);
- format(string, sizeof(string), "Exp: %05d/%05d",PlayerInfo[playerid][PLAYER_EXP], PlayerInfo[playerid][PLAYER_TOTALEXP]);
- #else
- format(string3, sizeof(string3), "Level: %d",PlayerInfo[playerid][PLAYER_LEVEL]);
- format(string, sizeof(string), "Exp: %d/%d",PlayerInfo[playerid][PLAYER_EXP], PlayerInfo[playerid][PLAYER_TOTALEXP]);
- #endif
- TextDrawSetString(LevelText[playerid], string3);
- TextDrawSetString(ExpText[playerid], string);
- }
- stock SetPlayerExp(playerid, exp)
- {
- new string[64];
- PlayerInfo[playerid][PLAYER_EXP] = exp;
- #if defined StaticNums
- format(string, sizeof(string), "Exp: %05d/%05d",PlayerInfo[playerid][PLAYER_EXP], PlayerInfo[playerid][PLAYER_TOTALEXP]);
- #else
- format(string, sizeof(string), "Exp: %d/%d",PlayerInfo[playerid][PLAYER_EXP], PlayerInfo[playerid][PLAYER_TOTALEXP]);
- #endif
- TextDrawSetString(ExpText[playerid], string);
- }
- //The function to get a player's level. Usage: GetPlayerLevel(playerid)
- stock GetPlayerExpLevel(playerid)
- {
- new Plevel;
- Plevel = PlayerInfo[playerid][PLAYER_LEVEL];
- return Plevel;
- }
- //The function to get a player's experience. Usage: GetPlayerExp(playerid)
- stock GetPlayerExp(playerid)
- {
- new PExp;
- PExp = PlayerInfo[playerid][PLAYER_EXP];
- return PExp;
- }
- //The function to get a player's experience needed to lvl up. Usage: GetPlayerTotalExp(playerid)
- stock GetPlayerTotalExp(playerid)
- {
- new PTotalExp;
- PTotalExp = PlayerInfo[playerid][PLAYER_TOTALEXP];
- return PTotalExp;
- }
- stock UpdateBar(playerid)
- {
- new str[30];
- if(GetProgressBarValue(HPBar[playerid]) == (PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2) format(str,sizeof(str),"{00ff00}••••••••••");
- else if(GetProgressBarValue(HPBar[playerid]) >= 0.10 * ((PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2) && GetProgressBarValue(HPBar[playerid]) <= 0.20 * ((PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2)) format(str,sizeof(str),"{ff2400}•{ffffff}•••••••••");
- else if(GetProgressBarValue(HPBar[playerid]) >= 0.20 * ((PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2) && GetProgressBarValue(HPBar[playerid]) <= 0.30 * ((PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2)) format(str,sizeof(str),"{ff2400}••{ffffff}••••••••");
- else if(GetProgressBarValue(HPBar[playerid]) >= 0.30 * ((PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2) && GetProgressBarValue(HPBar[playerid]) <= 0.40 * ((PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2)) format(str,sizeof(str),"{e4650e}•••{ffffff}•••••••");
- else if(GetProgressBarValue(HPBar[playerid]) >= 0.40 * ((PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2) && GetProgressBarValue(HPBar[playerid]) <= 0.50 * ((PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2)) format(str,sizeof(str),"{e49b0f}••••{ffffff}••••••");
- else if(GetProgressBarValue(HPBar[playerid]) >= 0.50 * ((PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2) && GetProgressBarValue(HPBar[playerid]) <= 0.60 * ((PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2)) format(str,sizeof(str),"{f4c430}•••••{ffffff}•••••");
- else if(GetProgressBarValue(HPBar[playerid]) >= 0.60 * ((PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2) && GetProgressBarValue(HPBar[playerid]) <= 0.70 * ((PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2)) format(str,sizeof(str),"{f7f21a}••••••{ffffff}••••");
- else if(GetProgressBarValue(HPBar[playerid]) >= 0.70 * ((PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2) && GetProgressBarValue(HPBar[playerid]) <= 0.80 * ((PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2)) format(str,sizeof(str),"{ccff00}•••••••{ffffff}•••");
- else if(GetProgressBarValue(HPBar[playerid]) >= 0.80 * ((PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2) && GetProgressBarValue(HPBar[playerid]) <= 0.90 * ((PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2)) format(str,sizeof(str),"{7fff00}••••••••{ffffff}••");
- else if(GetProgressBarValue(HPBar[playerid]) >= 0.90 * ((PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2) && GetProgressBarValue(HPBar[playerid]) <= 0.99 * ((PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2)) format(str,sizeof(str),"{66ff00}•••••••••{ffffff}•");
- else if(GetProgressBarValue(HPBar[playerid]) >= 0.99 * ((PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2)) format(str,sizeof(str),"{ff2400}•••••••••{ffffff}•");
- //UpdatePlayer3DTextLabelText(playerid, HP3DText[playerid], -1, str);
- Update3DTextLabelText(HP3DText[playerid], -1, str);
- return 1;
- }
- forward yini(playerid, name[], value[]);
- public yini(playerid, name[], value[])
- {
- INI_Int("password", PlayerInfo[playerid][PLAYER_PASS]);
- INI_Int("cash", PlayerInfo[playerid][PLAYER_CASH]);
- INI_Int("score", PlayerInfo[playerid][PLAYER_SCORE]);
- INI_Int("level", PlayerInfo[playerid][PLAYER_LEVEL]);
- INI_Int("exp", PlayerInfo[playerid][PLAYER_EXP]);
- INI_Int("totalexp", PlayerInfo[playerid][PLAYER_TOTALEXP]);
- /*INI_Int("weap1type", PlayerInfo[playerid][PLAYER_WEAP1TYPE]);
- INI_Int("weap2type", PlayerInfo[playerid][PLAYER_WEAP2TYPE]);
- INI_Int("weap3type", PlayerInfo[playerid][PLAYER_WEAP3TYPE]);
- INI_Int("weap1spec", PlayerInfo[playerid][PLAYER_WEAP1SPEC]);
- INI_Int("weap2spec", PlayerInfo[playerid][PLAYER_WEAP2SPEC]);
- INI_Int("weap3spec", PlayerInfo[playerid][PLAYER_WEAP3SPEC]);
- INI_Int("weap1lvl", PlayerInfo[playerid][PLAYER_WEAP1LVL]);
- INI_Int("weap2lvl", PlayerInfo[playerid][PLAYER_WEAP2LVL]);
- INI_Int("weap3lvl", PlayerInfo[playerid][PLAYER_WEAP3LVL]);*/
- INI_Int("points", PlayerInfo[playerid][PLAYER_POINTS]);
- INI_Int("strength", PlayerInfo[playerid][PLAYER_STRENGTH]);
- INI_Int("defence", PlayerInfo[playerid][PLAYER_DEFENCE]);
- INI_Int("weappoints", PlayerInfo[playerid][WEAPPOINTS]);
- INI_Int("sawnoff", PlayerInfo[playerid][SAWNOFF]);
- INI_Int("silenced", PlayerInfo[playerid][SILENCED]);
- INI_Int("deagle", PlayerInfo[playerid][DEAGLE]);
- INI_Int("shotgun", PlayerInfo[playerid][SHOTGUN]);
- INI_Int("spas12", PlayerInfo[playerid][SPAS12]);
- INI_Int("micro_uzi", PlayerInfo[playerid][MICRO_UZI]);
- INI_Int("mp5", PlayerInfo[playerid][MP5]);
- INI_Int("ak47", PlayerInfo[playerid][AK47]);
- INI_Int("m4", PlayerInfo[playerid][M4]);
- INI_Int("sniperrifle", PlayerInfo[playerid][SNIPERRIFLE]);
- return 1;
- }
- stock YINI_SAVE(playerid)
- {
- new playerName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
- new userFile[32];
- format(userFile, sizeof (userFile), "HAccounts/%s.ini", playerName);
- new INI:file = INI_Open(userFile);
- INI_WriteInt(file, "cash", GetPlayerMoney(playerid));
- INI_WriteInt(file, "score", GetPlayerScore(playerid));
- INI_WriteInt(file, "level", PlayerInfo[playerid][PLAYER_LEVEL]);
- INI_WriteInt(file, "exp", PlayerInfo[playerid][PLAYER_EXP]);
- INI_WriteInt(file, "totalexp", ExpForLevel * PlayerInfo[playerid][PLAYER_LEVEL]);
- /*INI_WriteInt(file, "weap1type", PlayerInfo[playerid][PLAYER_WEAP1TYPE]);
- INI_WriteInt(file, "weap2type", PlayerInfo[playerid][PLAYER_WEAP2TYPE]);
- INI_WriteInt(file, "weap3type", PlayerInfo[playerid][PLAYER_WEAP3TYPE]);
- INI_WriteInt(file, "weap1spec", PlayerInfo[playerid][PLAYER_WEAP1SPEC]);
- INI_WriteInt(file, "weap2spec", PlayerInfo[playerid][PLAYER_WEAP2SPEC]);
- INI_WriteInt(file, "weap3spec", PlayerInfo[playerid][PLAYER_WEAP3SPEC]);
- INI_WriteInt(file, "weap1lvl", PlayerInfo[playerid][PLAYER_WEAP1LVL]);
- INI_WriteInt(file, "weap2lvl", PlayerInfo[playerid][PLAYER_WEAP2LVL]);
- INI_WriteInt(file, "weap3lvl", PlayerInfo[playerid][PLAYER_WEAP3LVL]);*/
- INI_WriteInt(file, "points", PlayerInfo[playerid][PLAYER_POINTS]);
- INI_WriteInt(file, "strength", PlayerInfo[playerid][PLAYER_STRENGTH]);
- INI_WriteInt(file, "defence", PlayerInfo[playerid][PLAYER_DEFENCE]);
- INI_WriteInt(file, "weappoints", PlayerInfo[playerid][WEAPPOINTS]);
- INI_WriteInt(file, "sawnoff", PlayerInfo[playerid][SAWNOFF]);
- INI_WriteInt(file, "silenced", PlayerInfo[playerid][SILENCED]);
- INI_WriteInt(file, "deagle", PlayerInfo[playerid][DEAGLE]);
- INI_WriteInt(file, "shotgun", PlayerInfo[playerid][SHOTGUN]);
- INI_WriteInt(file, "spas12", PlayerInfo[playerid][SPAS12]);
- INI_WriteInt(file, "micro_uzi", PlayerInfo[playerid][MICRO_UZI]);
- INI_WriteInt(file, "mp5", PlayerInfo[playerid][MP5]);
- INI_WriteInt(file, "ak47", PlayerInfo[playerid][AK47]);
- INI_WriteInt(file, "m4", PlayerInfo[playerid][M4]);
- INI_WriteInt(file, "sniperrifle", PlayerInfo[playerid][SNIPERRIFLE]);
- INI_Close(file);
- }
- stock RegisterPlayer(playerid, password[])
- {
- new playerName[MAX_PLAYER_NAME], playerip[20];
- GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
- GetPlayerIp(playerid, playerip, sizeof(playerip));
- new userFile[32];
- format(userFile, sizeof (userFile), "HAccounts/%s.ini", playerName);
- new INI:file = INI_Open(userFile);
- INI_WriteString(file, "IP", playerip);
- INI_WriteInt(file, "password", udb_hash(password));
- INI_WriteInt(file, "class", 0);
- INI_WriteInt(file, "cash", 0);
- INI_WriteInt(file, "score", 0);
- INI_WriteInt(file, "level", 0);
- INI_WriteInt(file, "exp", 0);
- INI_WriteInt(file, "totalexp", ExpForLevel);
- INI_WriteInt(file, "weap1type", 0);
- INI_WriteInt(file, "weap2type", 0);
- INI_WriteInt(file, "weap3type", 0);
- INI_WriteInt(file, "weap1spec", 0);
- INI_WriteInt(file, "weap2spec", 0);
- INI_WriteInt(file, "weap3spec", 0);
- INI_WriteInt(file, "weap1lvl", 0);
- INI_WriteInt(file, "weap2lvl", 0);
- INI_WriteInt(file, "weap3lvl", 0);
- INI_WriteInt(file, "points", 0);
- INI_WriteInt(file, "strength", 1);
- INI_WriteInt(file, "defence", 1);
- INI_WriteInt(file, "weappoints", 0);
- INI_WriteInt(file, "sawnoff", 1);
- INI_WriteInt(file, "silenced", 1);
- INI_WriteInt(file, "deagle", 1);
- INI_WriteInt(file, "shotgun", 1);
- INI_WriteInt(file, "spas12", 1);
- INI_WriteInt(file, "micro_uzi", 1);
- INI_WriteInt(file, "mp5", 1);
- INI_WriteInt(file, "ak47", 1);
- INI_WriteInt(file, "m4", 1);
- INI_WriteInt(file, "sniperrifle", 1);
- INI_Close(file);
- PlayerInfo[playerid][PLAYER_CASH] = 0;
- PlayerInfo[playerid][PLAYER_SCORE] = 0;
- PlayerInfo[playerid][PLAYER_LEVEL] = 1;
- PlayerInfo[playerid][PLAYER_EXP] = 0;
- PlayerInfo[playerid][PLAYER_TOTALEXP] = ExpForLevel;
- /*PlayerInfo[playerid][PLAYER_WEAP1TYPE] = 0;
- PlayerInfo[playerid][PLAYER_WEAP2TYPE] = 0;
- PlayerInfo[playerid][PLAYER_WEAP3TYPE] = 0;
- PlayerInfo[playerid][PLAYER_WEAP1SPEC] = 0;
- PlayerInfo[playerid][PLAYER_WEAP2SPEC] = 0;
- PlayerInfo[playerid][PLAYER_WEAP3SPEC] = 0;
- PlayerInfo[playerid][PLAYER_WEAP1LVL] = 0;
- PlayerInfo[playerid][PLAYER_WEAP2LVL] = 0;
- PlayerInfo[playerid][PLAYER_WEAP3LVL] = 0;*/
- PlayerInfo[playerid][PLAYER_POINTS] = 0;
- PlayerInfo[playerid][PLAYER_STRENGTH] = 1;
- PlayerInfo[playerid][PLAYER_DEFENCE] = 1;
- PlayerInfo[playerid][WEAPPOINTS] = 0;
- PlayerInfo[playerid][SAWNOFF] = 1;
- PlayerInfo[playerid][SILENCED] = 1;
- PlayerInfo[playerid][DEAGLE] = 1;
- PlayerInfo[playerid][SHOTGUN] = 1;
- PlayerInfo[playerid][SPAS12] = 1;
- PlayerInfo[playerid][MICRO_UZI] = 1;
- PlayerInfo[playerid][MP5] = 1;
- PlayerInfo[playerid][AK47] = 1;
- PlayerInfo[playerid][M4] = 1;
- PlayerInfo[playerid][SNIPERRIFLE] = 1;
- SendClientMessage(playerid, 0xffff00ff, "It appears you just registered. Type /help to see help for this gamemode");
- }
- main()
- {
- }
- public OnGameModeInit()
- {
- print("\n--------------------------------------");
- print(" King_Hual's MMORPG For SA:MP");
- print("--------------------------------------\n");
- SetGameModeText("MMORPG by King_Hual");
- ShowNameTags(0);
- AddPlayerClass(267,1958.3783,1343.1572,15.3746,270.1425,10,1,32,1000,24,100);
- OpponentHPImg = TextDrawCreate(200.0, 0, "LD_OTB2:butnAo"); // Text is txdfile:texture
- TextDrawFont(OpponentHPImg, 4); // Font ID 4 is the sprite draw font
- TextDrawColor(OpponentHPImg,0xFFFFFF22);
- TextDrawTextSize(OpponentHPImg,256,32); // Text size is the Width:Height
- OpponentHPImgFull = TextDrawCreate(200.0, 0, "LD_OTB2:butnAo"); // Text is txdfile:texture
- TextDrawFont(OpponentHPImgFull, 4); // Font ID 4 is the sprite draw font
- TextDrawColor(OpponentHPImgFull,0xFFFFFFFF);
- TextDrawTextSize(OpponentHPImgFull,256,32); // Text size is the Width:Height
- }
- public OnGameModeExit()
- {
- }
- public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
- {
- if (logged_in[playerid] == 1)
- {
- new string[32], Float:HP;
- GetPlayerHealth(playerid, HP);
- if (HP > 0)
- {
- if (issuerid != INVALID_PLAYER_ID)
- {
- if ((amount / 2) + (PlayerInfo[issuerid][PLAYER_STRENGTH] / 10) - (PlayerInfo[playerid][PLAYER_DEFENCE] / 10) < 0)
- {
- SetProgressBarValue(HPBar[playerid], GetProgressBarValue(HPBar[playerid]) - 1);
- UpdateProgressBar(HPBar[playerid], playerid);
- }
- else
- {
- SetProgressBarValue(HPBar[playerid], GetProgressBarValue(HPBar[playerid]) - ((amount + (PlayerInfo[issuerid][PLAYER_STRENGTH] / 10) - (PlayerInfo[playerid][PLAYER_DEFENCE] / 10)) / 2));
- UpdateProgressBar(HPBar[playerid], playerid);
- }
- }
- else
- {
- SetProgressBarValue(HPBar[playerid], GetProgressBarValue(HPBar[playerid]) - (amount / 2));
- UpdateProgressBar(HPBar[playerid], playerid);
- }
- if (GetProgressBarValue(HPBar[playerid]) <= 0.4)
- {
- SetPlayerHealth(playerid, 0);
- TextDrawSetString(HPText[playerid], "DEAD");
- }
- else
- {
- format(string, sizeof(string), "%.0f/%d", GetProgressBarValue(HPBar[playerid]), (PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2);
- TextDrawSetString(HPText[playerid], string);
- UpdateBar(playerid);
- SetPlayerHealth(playerid, 100);
- }
- }
- if (issuerid != INVALID_PLAYER_ID)
- {
- new oppstr1[64], oppstr2[32], pname[MAX_PLAYER_NAME];
- KillTimer(OpponentHPHide[issuerid]);
- GetPlayerName(playerid, pname, sizeof(pname));
- format(oppstr1, sizeof(oppstr1), "%s's HP:", pname);
- TextDrawSetString(OpponentName[issuerid], oppstr1);
- format(oppstr2, sizeof(oppstr2), "%.0f/%d", GetProgressBarValue(HPBar[playerid]), (PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2);
- TextDrawSetString(OpponentHPText[issuerid], oppstr2);
- SetProgressBarMaxValue(OpponentHPBar[issuerid], (PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2);
- SetProgressBarValue(OpponentHPBar[issuerid], GetProgressBarValue(HPBar[playerid]));
- ShowProgressBarForPlayer(issuerid, OpponentHPBar[issuerid]);
- UpdateProgressBar(OpponentHPBar[issuerid], issuerid);
- TextDrawShowForPlayer(issuerid, OpponentHPText[issuerid]);
- TextDrawShowForPlayer(issuerid, OpponentName[issuerid]);
- TextDrawHideForPlayer(issuerid, OpponentHPImg);
- TextDrawShowForPlayer(issuerid, OpponentHPImgFull);
- OpponentHPHide[playerid] = SetTimerEx("OppHPHideTimer", 15000, 0, "i", issuerid);
- }
- }
- }
- forward OppHPHideTimer(playerid);
- public OppHPHideTimer(playerid)
- {
- HideProgressBarForPlayer(playerid, OpponentHPBar[playerid]);
- TextDrawHideForPlayer(playerid, OpponentHPText[playerid]);
- TextDrawHideForPlayer(playerid, OpponentName[playerid]);
- TextDrawShowForPlayer(playerid, OpponentHPImg);
- TextDrawHideForPlayer(playerid, OpponentHPImgFull);
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerInterior(playerid,14);
- SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
- SetPlayerFacingAngle(playerid, 270.0);
- SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
- SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new pname[MAX_PLAYER_NAME];
- Retries[playerid] = 0;
- logged_in[playerid] = 0;
- SendDeathMessage(INVALID_PLAYER_ID, playerid, 200);
- new pfile[100];
- GetPlayerName(playerid, pname, sizeof(pname));
- format(pfile, sizeof(pfile), "HAccounts/%s.ini",pname);
- if(!fexist(pfile)) {
- ShowPlayerDialog(playerid,101,DIALOG_STYLE_PASSWORD,"Registration","Please enter a password to register this account!","Register","Cancel");
- }
- else
- {
- INI_ParseFile(pfile, "yini", .bExtra = true, .extra = playerid);
- ShowPlayerDialog(playerid,100,DIALOG_STYLE_PASSWORD,"Login","Please enter a password to login to this account!","Login","Cancel");
- }
- #if defined UseProgBar
- bar[playerid] = CreateProgressBar(500.00, 5.00, 137.50, 15.19, ProgBarColor, 100.0);
- #endif
- ExpText[playerid] = TextDrawCreate(500.000000,3.000000,"_");
- TextDrawAlignment(ExpText[playerid],0);
- TextDrawBackgroundColor(ExpText[playerid],0x000000ff);
- TextDrawFont(ExpText[playerid],1);
- TextDrawLetterSize(ExpText[playerid],0.399999,1.800000);
- TextDrawColor(ExpText[playerid],0xffff00ff);
- TextDrawSetOutline(ExpText[playerid],1);
- TextDrawSetProportional(ExpText[playerid],1);
- LevelText[playerid] = TextDrawCreate(546.000000,25.000000,"_");
- TextDrawAlignment(LevelText[playerid],0);
- TextDrawBackgroundColor(LevelText[playerid],0x000000ff);
- TextDrawFont(LevelText[playerid],2);
- TextDrawLetterSize(LevelText[playerid],0.299999,1.400000);
- TextDrawColor(LevelText[playerid],0x00ff0099);
- TextDrawSetOutline(LevelText[playerid],1);
- TextDrawSetProportional(LevelText[playerid],1);
- TextDrawSetShadow(LevelText[playerid],1);
- HPBar[playerid] = CreateProgressBar(548.00, 68.2, 58.50, 5.50, -16776961, 100.0);
- HPText[playerid] = TextDrawCreate(556.500000,66.500000,"_");
- TextDrawAlignment(HPText[playerid],0);
- TextDrawBackgroundColor(HPText[playerid],0x000000ff);
- TextDrawFont(HPText[playerid],3);
- TextDrawLetterSize(HPText[playerid],0.30,0.80);
- TextDrawColor(HPText[playerid],0xffffffff);
- TextDrawSetOutline(HPText[playerid],1);
- TextDrawSetProportional(HPText[playerid],1);
- TextDrawSetShadow(HPText[playerid],1);
- HP3DText[playerid] =Create3DTextLabel("_", -1, 0, 0, 0, 50, 0, 1);
- NameTag[playerid] = Create3DTextLabel(pname, 0xFFFFFFFF, 0,0,0, 50, 0, 1);
- LevelLabel[playerid] = Create3DTextLabel("_", TextLabelColor, 0, 0, 0, 50, 1);
- OpponentHPBar[playerid] = CreateProgressBar(234.00, 15.00, 184.50, 5.19, -16776961, 100.0);
- /*OpponentHPText[playerid] = TextDrawCreate(556.500000,66.500000,"100/100");
- TextDrawAlignment(OpponentHPText[playerid],0);
- TextDrawBackgroundColor(OpponentHPText[playerid],0x000000ff);
- TextDrawFont(OpponentHPText[playerid],3);
- TextDrawLetterSize(OpponentHPText[playerid],0.30,0.80);
- TextDrawColor(OpponentHPText[playerid],0xffffffff);
- TextDrawSetOutline(OpponentHPText[playerid],1);
- TextDrawSetProportional(OpponentHPText[playerid],1);
- TextDrawSetShadow(HPText[OpponentHPText],1);*/
- OpponentHPText[playerid] = TextDrawCreate(286.000000,12.900000,"_");
- OpponentName[playerid] = TextDrawCreate(233.000000,2.000000,"_");
- TextDrawAlignment(OpponentHPText[playerid],0);
- TextDrawAlignment(OpponentName[playerid],0);
- TextDrawBackgroundColor(OpponentHPText[playerid],0x000000ff);
- TextDrawBackgroundColor(OpponentName[playerid],0x000000ff);
- TextDrawFont(OpponentHPText[playerid],3);
- TextDrawLetterSize(OpponentHPText[playerid],0.599999,0.899999);
- TextDrawFont(OpponentName[playerid],1);
- TextDrawLetterSize(OpponentName[playerid],0.499999,0.899999);
- TextDrawColor(OpponentHPText[playerid],0xffffffff);
- TextDrawColor(OpponentName[playerid],0xff0000cc);
- TextDrawSetOutline(OpponentHPText[playerid],1);
- TextDrawSetOutline(OpponentName[playerid],1);
- TextDrawSetProportional(OpponentHPText[playerid],1);
- TextDrawSetProportional(OpponentName[playerid],1);
- TextDrawSetShadow(OpponentHPText[playerid],5);
- TextDrawSetShadow(OpponentName[playerid],1);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(logged_in[playerid] == 1)
- {
- YINI_SAVE(playerid);
- }
- DestroyProgressBar(HPBar[playerid]);
- TextDrawDestroy(HPText[playerid]);
- TextDrawDestroy(ExpText[playerid]);
- TextDrawDestroy(ExpText[playerid]);
- Delete3DTextLabel(HP3DText[playerid]);
- #if defined UseProgBar
- DestroyProgressBar(bar[playerid]);
- #endif
- Delete3DTextLabel(LevelLabel[playerid]);
- Retries[playerid] = 0;
- logged_in[playerid] = 0;
- SendDeathMessage(INVALID_PLAYER_ID, playerid, 201);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- SetPlayerInterior(playerid, 0);
- new string[16], string2[32];
- TextDrawShowForPlayer(playerid, OpponentHPImg);
- #if defined StaticNums
- format(string, sizeof(string), "Level: %02i",PlayerInfo[playerid][PLAYER_LEVEL]);
- #else
- format(string, sizeof(string), "Level: %i",PlayerInfo[playerid][PLAYER_LEVEL]);
- #endif
- format(string2, sizeof(string2), "%i/%i",(PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2, (PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2);
- TextDrawSetString(HPText[playerid], string2);
- SetProgressBarMaxValue(HPBar[playerid], (PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2);
- SetProgressBarValue(HPBar[playerid], (PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2);
- UpdateProgressBar(HPBar[playerid], playerid);
- ShowProgressBarForPlayer(playerid, HPBar[playerid]);
- TextDrawShowForPlayer(playerid, HPText[playerid]);
- Attach3DTextLabelToPlayer(HP3DText[playerid], playerid, 0, 0, 0.2);
- Attach3DTextLabelToPlayer(NameTag[playerid], playerid, 0, 0, 0.4);
- UpdateBar(playerid);
- Update3DTextLabelText(LevelLabel[playerid], TextLabelColor, string);
- Attach3DTextLabelToPlayer(LevelLabel[playerid], playerid, 0, 0, 0.6);
- TextDrawShowForPlayer(playerid, ExpText[playerid]);
- TextDrawShowForPlayer(playerid, LevelText[playerid]);
- UpdateProgressBar(bar[playerid], playerid);
- if (PlayerInfo[playerid][PLAYER_POINTS] > 0 || PlayerInfo[playerid][WEAPPOINTS] > 0)
- {
- GameTextForPlayer(playerid, "~p~You have unused points!~n~Press your ~g~~k~~CONVERSATION_NO~ key ~w~or ~g~~k~~CONVERSATION_YES~ key ~w~to open the upgrade stations!", 5000, 4);
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if (killerid != INVALID_PLAYER_ID)
- {
- KillTimer(OpponentHPHide[killerid]);
- KillTimer(OpponentHPHide[playerid]);
- HideProgressBarForPlayer(playerid, OpponentHPBar[playerid]);
- TextDrawHideForPlayer(playerid, OpponentHPText[playerid]);
- TextDrawHideForPlayer(playerid, OpponentName[playerid]);
- TextDrawShowForPlayer(playerid, OpponentHPImg);
- TextDrawHideForPlayer(playerid, OpponentHPImgFull);
- HideProgressBarForPlayer(killerid, OpponentHPBar[killerid]);
- TextDrawHideForPlayer(killerid, OpponentHPText[killerid]);
- TextDrawHideForPlayer(killerid, OpponentName[killerid]);
- TextDrawShowForPlayer(killerid, OpponentHPImg);
- TextDrawHideForPlayer(killerid, OpponentHPImgFull);
- }
- if (killerid != playerid) {
- if (GetPlayerExpLevel(playerid) < GetPlayerExpLevel(killerid))
- {
- GivePlayerExp(killerid, 100, "killing a lower level player");
- }
- else if (GetPlayerExpLevel(playerid) > GetPlayerExpLevel(killerid))
- {
- GivePlayerExp(killerid, 300, "killing a higher level player");
- }
- else
- {
- GivePlayerExp(killerid, 200, "killing a player at your own level");
- }
- Update3DTextLabelText(HP3DText[playerid],-1, "{ff2400}DEAD");
- } // An example of using my exp system.
- 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(cmdtext, "/help", true))
- {
- SendClientMessage(playerid, 0xffff00ff, "Level up by gaining EXP. With every level, you get one Passive Point and one Weapon Point.");
- SendClientMessage(playerid, 0xffff00ff, "Open the Weapon upgrade station by pressing your 'Conversation Yes' key.");
- SendClientMessage(playerid, 0xffff00ff, "Open the Passive Skill upgrade station by pressing your 'Conversation No' key.");
- SendClientMessage(playerid, 0xffff00ff, "If you don't know which these keys are, type /yes for the yes key or /no for the no key to see them.");
- }
- if(!strcmp(cmdtext, "/yes", true))
- {
- GameTextForPlayer(playerid, "Your 'Yes' key is bound to ~g~~k~~CONVERSATION_YES~", 6000, 5);
- }
- if(!strcmp(cmdtext, "/no", true))
- {
- GameTextForPlayer(playerid, "Your 'No' key is bound to ~g~~k~~CONVERSATION_NO~", 6000, 5);
- }
- return 1;
- }
- 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)
- {
- if (logged_in[playerid] == 0)
- {
- SendClientMessage(playerid, 0xFF00FFFF, "*You need to login to spawn.*");
- return 0;
- }
- else
- {
- 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_NO)
- {
- if (logged_in[playerid] == 1)
- {
- new string[45], string2[90];
- format(string2, sizeof(string2), "Upgrade Strength - Current Level: %i\r\nUpgrade Defence - Current Level: %i", PlayerInfo[playerid][PLAYER_STRENGTH], PlayerInfo[playerid][PLAYER_DEFENCE]);
- format(string, sizeof(string), "Upgrade Station - Upgrade Points Left: %i", PlayerInfo[playerid][PLAYER_POINTS]);
- ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,string,string2,"Accept", "Cancel");
- }
- }
- if (newkeys & KEY_YES)
- {
- if (logged_in[playerid] == 1)
- {
- new string[45], string2[180];
- format(string, sizeof(string), "Weapon Station - Upgrade Points Left: %i", PlayerInfo[playerid][WEAPPOINTS]);
- format(string2, sizeof(string2), "Sawnoff: %i\r\nSilenced Pistol: %i\r\nDeagle: %i\r\nShotgun: %i\r\nSpas12: %i\r\nUzi: %i\r\nMP5: %i\r\nAK47: %i\r\nM4: %i\r\nSniper Rifle: %i", PlayerInfo[playerid][SAWNOFF], PlayerInfo[playerid][SILENCED],PlayerInfo[playerid][DEAGLE], PlayerInfo[playerid][SHOTGUN], PlayerInfo[playerid][SPAS12],PlayerInfo[playerid][MICRO_UZI], PlayerInfo[playerid][MP5], PlayerInfo[playerid][AK47], PlayerInfo[playerid][M4], PlayerInfo[playerid][SNIPERRIFLE]);
- ShowPlayerDialog(playerid,2,DIALOG_STYLE_LIST,string,string2,"Accept", "Cancel");
- }
- }
- 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 == 101)
- {
- if(!strlen(inputtext) || !response) return ShowPlayerDialog(playerid,101,DIALOG_STYLE_PASSWORD,"Registration","ERROR: You did not enter a password.\nPlease enter a password to register this account!","Register","Cancel");
- new string2[64], string3[32], string4[64];
- RegisterPlayer(playerid, inputtext);
- logged_in[playerid] = 1;
- SendClientMessage(playerid, 0x00FF00FF, "*You have been registered! You have also been logged in!*");
- #if defined StaticNums
- format(string2, sizeof(string2), "Exp: %05d/%05d", PlayerInfo[playerid][PLAYER_EXP], PlayerInfo[playerid][PLAYER_TOTALEXP]));
- format(string3, sizeof(string3), "Level: %02d", PlayerInfo[playerid][PLAYER_LEVEL]);
- #else
- format(string2, sizeof(string2), "Exp: %d/%d",PlayerInfo[playerid][PLAYER_EXP], PlayerInfo[playerid][PLAYER_TOTALEXP]);
- format(string3, sizeof(string3), "Level: %d",PlayerInfo[playerid][PLAYER_LEVEL]);
- #endif
- TextDrawSetString(ExpText[playerid], string2);
- TextDrawSetString(LevelText[playerid], string3);
- #if defined UseProgBar
- SetProgressBarMaxValue(bar[playerid], PlayerInfo[playerid][PLAYER_TOTALEXP]);
- SetProgressBarValue(bar[playerid], PlayerInfo[playerid][PLAYER_EXP]);
- #endif
- SetProgressBarMaxValue(HPBar[playerid], (PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2);
- SetProgressBarValue(HPBar[playerid], (PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2);
- format(string4, sizeof(string4), "%d/%d",(PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2, (PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2);
- TextDrawSetString(HPText[playerid], string4);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, 1);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, 1);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, 1);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_SPAS12_SHOTGUN, 1);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 1);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, 1);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, 1);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, 1);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_SNIPERRIFLE, 1);
- }
- if(dialogid == 100)
- {
- if(!strlen(inputtext) || !response) return ShowPlayerDialog(playerid,100,DIALOG_STYLE_PASSWORD,"Login","ERROR: You did not enter a password.\nPlease enter a password to login to this account!","Login","Cancel");
- LoginPlayer(playerid, inputtext);
- }
- if (dialogid == 1)
- {
- if (response)
- {
- if (PlayerInfo[playerid][PLAYER_POINTS] > 0)
- {
- switch(listitem)
- {
- case 0:
- {
- PlayerInfo[playerid][PLAYER_STRENGTH]++;
- SendClientMessage(playerid, 0x00FF00FF, "You have upgraded your strength by 1 point!");
- }
- case 1:
- {
- PlayerInfo[playerid][PLAYER_DEFENCE]++;
- SendClientMessage(playerid, 0x00FF00FF, "You have upgraded your defence by 1 point!");
- }
- }
- new string[45], string2[90];
- format(string2, sizeof(string2), "Upgrade Strength - Current Level: %i\r\nUpgrade Defence - Current Level: %i", PlayerInfo[playerid][PLAYER_STRENGTH], PlayerInfo[playerid][PLAYER_DEFENCE]);
- format(string, sizeof(string), "Upgrade Station - Upgrade Points Left: %i", PlayerInfo[playerid][PLAYER_POINTS]);
- PlayerInfo[playerid][PLAYER_POINTS] -= 1;
- ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,string,string2,"Accept", "Cancel");
- }
- else
- {
- SendClientMessage(playerid, 0x00FF00FF, "You do not have enough points!");
- }
- }
- }
- if (dialogid == 2)
- {
- if (response)
- {
- if (PlayerInfo[playerid][WEAPPOINTS] > 0)
- {
- switch(listitem)
- {
- case 0:
- {
- PlayerInfo[playerid][SAWNOFF]++;
- SendClientMessage(playerid, 0x00FF00FF, "You have upgraded your Sawnoff skills by 1 point!");
- SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, PlayerInfo[playerid][SAWNOFF] * 10);
- }
- case 1:
- {
- PlayerInfo[playerid][SILENCED]++;
- SendClientMessage(playerid, 0x00FF00FF, "You have upgraded your Silenced Pistol skills by 1 point!");
- SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, PlayerInfo[playerid][SILENCED] * 10);
- }
- case 2:
- {
- PlayerInfo[playerid][DEAGLE]++;
- SendClientMessage(playerid, 0x00FF00FF, "You have upgraded your Deagle skills by 1 point!");
- SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, PlayerInfo[playerid][DEAGLE] * 10);
- }
- case 3:
- {
- PlayerInfo[playerid][SHOTGUN]++;
- SendClientMessage(playerid, 0x00FF00FF, "You have upgraded your Shotgun skills by 1 point!");
- SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, PlayerInfo[playerid][SHOTGUN] * 10);
- }
- case 4:
- {
- PlayerInfo[playerid][SPAS12]++;
- SendClientMessage(playerid, 0x00FF00FF, "You have upgraded your Spas12 skills by 1 point!");
- SetPlayerSkillLevel(playerid, WEAPONSKILL_SPAS12_SHOTGUN, PlayerInfo[playerid][SPAS12] * 10);
- }
- case 5:
- {
- PlayerInfo[playerid][MICRO_UZI]++;
- SendClientMessage(playerid, 0x00FF00FF, "You have upgraded your Micro Uzi skills by 1 point!");
- SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, PlayerInfo[playerid][MICRO_UZI] * 10);
- }
- case 6:
- {
- PlayerInfo[playerid][MP5]++;
- SendClientMessage(playerid, 0x00FF00FF, "You have upgraded your MP5 skills by 1 point!");
- SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, PlayerInfo[playerid][MP5] * 10);
- }
- case 7:
- {
- PlayerInfo[playerid][AK47]++;
- SendClientMessage(playerid, 0x00FF00FF, "You have upgraded your AK47 skills by 1 point!");
- SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, PlayerInfo[playerid][AK47] * 10);
- }
- case 8:
- {
- PlayerInfo[playerid][M4]++;
- SendClientMessage(playerid, 0x00FF00FF, "You have upgraded your M4 skills by 1 point!");
- SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, PlayerInfo[playerid][M4] * 10);
- }
- case 9:
- {
- PlayerInfo[playerid][SNIPERRIFLE]++;
- SendClientMessage(playerid, 0x00FF00FF, "You have upgraded your Sniper Rifle skills by 1 point!");
- SetPlayerSkillLevel(playerid, WEAPONSKILL_SNIPERRIFLE, PlayerInfo[playerid][SNIPERRIFLE] * 10);
- }
- }
- new string[45], string2[180];
- PlayerInfo[playerid][WEAPPOINTS] -= 1;
- format(string, sizeof(string), "Weapon Station - Upgrade Points Left: %i", PlayerInfo[playerid][WEAPPOINTS]);
- format(string2, sizeof(string2), "Sawnoff: %i\r\nSilenced Pistol: %i\r\nDeagle: %i\r\nShotgun: %i\r\nSpas12: %i\r\nUzi: %i\r\nMP5: %i\r\nAK47: %i\r\nM4: %i\r\nSniper Rifle: %i", PlayerInfo[playerid][SAWNOFF], PlayerInfo[playerid][SILENCED],PlayerInfo[playerid][DEAGLE], PlayerInfo[playerid][SHOTGUN], PlayerInfo[playerid][SPAS12],PlayerInfo[playerid][MICRO_UZI], PlayerInfo[playerid][MP5], PlayerInfo[playerid][AK47], PlayerInfo[playerid][M4], PlayerInfo[playerid][SNIPERRIFLE]);
- ShowPlayerDialog(playerid,2,DIALOG_STYLE_LIST,string,string2,"Accept", "Cancel");
- }
- else
- {
- SendClientMessage(playerid, 0x00FF00FF, "You do not have enough points!");
- }
- }
- }
- return 1;
- }
- stock LoginPlayer(playerid, password[])
- {
- if (udb_hash(password) == PlayerInfo[playerid][PLAYER_PASS])
- {
- new string2[64], string3[64], string4[64];
- GivePlayerMoney(playerid, PlayerInfo[playerid][PLAYER_CASH]);
- SetPlayerScore(playerid, PlayerInfo[playerid][PLAYER_SCORE]);
- logged_in[playerid] = 1;
- SendClientMessage(playerid, 0x00FF00FF, "*You have been logged in!*");
- #if defined StaticNums
- format(string2, sizeof(string2), "Exp: %05d/%05d",PlayerInfo[playerid][PLAYER_EXP], PlayerInfo[playerid][PLAYER_TOTALEXP]);
- format(string3, sizeof(string3), "Level: %02d",PlayerInfo[playerid][PLAYER_LEVEL]);
- #else
- format(string2, sizeof(string2), "Exp: %d/%d",PlayerInfo[playerid][PLAYER_EXP], PlayerInfo[playerid][PLAYER_TOTALEXP]);
- format(string3, sizeof(string3), "Level: %d",PlayerInfo[playerid][PLAYER_LEVEL]);
- #endif
- TextDrawSetString(ExpText[playerid], string2);
- TextDrawSetString(LevelText[playerid], string3);
- #if defined UseProgBar
- SetProgressBarMaxValue(bar[playerid], PlayerInfo[playerid][PLAYER_TOTALEXP]);
- SetProgressBarValue(bar[playerid], PlayerInfo[playerid][PLAYER_EXP]);
- #endif
- TextDrawColor(HPText[playerid], 0xffffffff);
- format(string4, sizeof(string4), "%d/%d",(PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2, (PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2);
- TextDrawSetString(HPText[playerid], string4);
- SetProgressBarMaxValue(HPBar[playerid], (PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2);
- SetProgressBarValue(HPBar[playerid], (PlayerInfo[playerid][PLAYER_LEVEL] * 50) / 2);
- Attach3DTextLabelToPlayer(HP3DText[playerid], playerid, 0, 0, 0.2);
- Attach3DTextLabelToPlayer(NameTag[playerid], playerid, 0, 0, 0.4);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, PlayerInfo[playerid][SAWNOFF] * 10);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, PlayerInfo[playerid][SILENCED] * 10);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, PlayerInfo[playerid][DEAGLE] * 10);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, PlayerInfo[playerid][SHOTGUN] * 10);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_SPAS12_SHOTGUN, PlayerInfo[playerid][SPAS12] * 10);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, PlayerInfo[playerid][MICRO_UZI] * 10);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, PlayerInfo[playerid][MP5] * 10);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, PlayerInfo[playerid][AK47] * 10);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, PlayerInfo[playerid][M4] * 10);
- SetPlayerSkillLevel(playerid, WEAPONSKILL_SNIPERRIFLE, PlayerInfo[playerid][SNIPERRIFLE] * 10);
- }
- else
- {
- ShowPlayerDialog(playerid,100,DIALOG_STYLE_PASSWORD,"Login","ERROR: Invalid Password.\nPlease enter a password to login to this account!","Login","Cancel");
- Retries[playerid]++;
- if (Retries[playerid] == 5)
- {
- SendClientMessage(playerid, 0xFF0000, "*You have been kicked for 5 incorrect password inputs.*");
- Kick(playerid);
- }
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- stock udb_hash(buf[]) {
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment