Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*******************************************************************
- * Credits...... *
- * *
- * *
- * >>>>>>>>>>> Don't remove credits..............<<<<<<<<<<< *
- * *
- * >>>>>>>>>>>>Don't release it without my permission...<<<<<<< *
- * *
- * >>>>CaptainBoi: Working on it all the time.. <<< *
- * *
- * >>>>Morken: Helping me... <<<< *
- * *
- * Includes : <a_samp> | SA:MP || <sscanf2> | [well]idk ||<dini> | Dracoblue || <zcmd> | Zeex
- * *
- *>>>>>>>>>>>>> Comment Below How Is It.... <<<<<<<<<<<< *
- * *
- ******************************************************************/
- #define FILTERSCRIPT
- /* Includes */
- #include <a_samp>
- #include <sscanf2>
- #include <dini>
- #include <zcmd>
- /* Colors */
- #define COLOR_RED 0xFF0000FF
- #define COLOR_WHITE 0xFFFFFFFF
- #define COLOR_YELLOW 0xFFFF00FF
- #define COLOR_GREEN 0x00FF00FF
- #define COLOR_ORANGE 0xFF9900FF
- /* Dialogs */
- #define DIALOG_PERKS 1
- /* Variables */
- new perkpoints[MAX_PLAYERS];
- new perks[MAX_PLAYERS][10][5];
- new perkcd[MAX_PLAYERS][10];
- new perkregentimer[MAX_PLAYERS];
- new Float:pmaxhealth[MAX_PLAYERS];
- new Float:pmaxarmour[MAX_PLAYERS];
- new Float:phealth[MAX_PLAYERS];
- /* Account Location */
- #define accounts "accounts"
- /* File Location */
- FileDirectory(location[], file[])
- {
- new dname[128];
- format(dname, sizeof(dname), "%s/%c/%s.ini", location, file[0] != '.' ? file[0] : '#', file);
- return dname;
- }
- /* Player Name */
- playername(playerid)
- {
- new pname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
- return pname;
- }
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Perk System By CaptainBoi");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- phealth[playerid] = 0.0;
- pmaxhealth[playerid] = 0.0;
- pmaxarmour[playerid] = 0.0;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- pmaxhealth[playerid] = dini_Int(FileDirectory(accounts, playername(playerid)), "maxhealth");
- perkpoints[playerid] = dini_Int(FileDirectory(accounts, playername(playerid)), "perkpoints");
- perks[playerid][0][0] = dini_Int(FileDirectory(accounts, playername(playerid)), "invur");
- perks[playerid][1][0] = dini_Int(FileDirectory(accounts, playername(playerid)), "jugg");
- perks[playerid][2][0] = dini_Int(FileDirectory(accounts, playername(playerid)), "regenlevel");
- perks[playerid][3][0] = dini_Int(FileDirectory(accounts, playername(playerid)), "stunlevel");
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- phealth[playerid] = pmaxhealth[playerid];
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_PERKS)
- {
- if(response)
- {
- switch(listitem)
- {
- case 0:
- {
- new pname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
- if (perks[playerid][0][0] == 0) return SendClientMessage(playerid, COLOR_RED, "Error: You Haven't Unlocked This Perk Yet!!");
- new str[90];
- format(str, sizeof(str), "Error: Your Perk is Cooling Down, Wait For %i Seconds Until It is Usable Again.", perks[playerid][0][2]);
- if (perks[playerid][0][1] == 1) return SendClientMessage(playerid, COLOR_RED, str);
- if (perkpoints[playerid] < 200) return SendClientMessage(playerid, COLOR_RED, "Error: You Don't have enough points.");
- SendClientMessage(playerid, COLOR_ORANGE, "You Are Now Immune To Almost Everything in this world");
- SetPlayerHealth(playerid, 99999);
- SetTimerEx("EndInvur", 30000, false, "%d", playerid);
- dini_IntSet(FileDirectory(accounts, pname), "perkpoints", perkpoints[playerid] - 200);
- perkpoints[playerid] -= 200;
- perks[playerid][0][2] = 180;
- perkcd[playerid][0] = SetTimerEx("PerkCoolDown", 1000, true, "%i%i", playerid, listitem);
- perks[playerid][0][1] = 1;
- }
- case 1:
- {
- new pname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
- if(perks[playerid][1][0] == 0) return SendClientMessage(playerid, COLOR_RED, "Error: You Haven't Unlokced This Perk Yet!!");
- if(perkpoints[playerid] < 120) return SendClientMessage(playerid, COLOR_RED, "Error: You Don't Have Enough Points!");
- new str[90];
- format(str, sizeof(str), "Error: Your Perk is Cooling Down, Wait For %i Seconds Until It is Usable Again.", perks[playerid][1][2]);
- if(perks[playerid][1][1] == 1) return SendClientMessage(playerid, COLOR_RED, str);
- dini_IntSet(FileDirectory(accounts, pname), "perkpoints", perkpoints[playerid] - 120);
- perkpoints[playerid] = perkpoints[playerid] - 120;
- SetPlayerHealth(playerid, 200);
- SetPlayerArmour(playerid, 300);
- SetPlayerSkin(playerid, 149);
- GivePlayerWeapon(playerid, 38, 1500);
- perks[playerid][1][1] = 1;
- perks[playerid][1][2] = 300;
- perkcd[playerid][2] = SetTimerEx("PerkCoolDown", 1000, true, "%i%i", playerid, listitem);
- SendClientMessage(playerid, COLOR_ORANGE, "PERK ACTIVATED: Juggernaut Mode!! Your Health And Armoured Has Been Boosted To A Huge Degreee.");
- }
- case 2:
- {
- new pname[MAX_PLAYER_NAME], rhm[64], rhm1[12];
- GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
- if(perks[playerid][2][0] == 0) return SendClientMessage(playerid, COLOR_RED, "Error: You Haven't Unlocked This Perk Yet!!");
- new str[90];
- format(str, sizeof(str), "Error: Your Perk is Cooling Down, Wait For %i Seconds Until It is Usable Again.", perks[playerid][2][2]);
- if(perks[playerid][2][1] == 1) return SendClientMessage(playerid, COLOR_RED, str);
- if(perkpoints[playerid] < 50) return SendClientMessage(playerid, COLOR_RED, "Error: You Don't Have Enough Points!");
- SetTimer("EndRegenTimer", 50000, false);
- perkregentimer[playerid] = SetTimerEx("RegeneratePlayerHealth", 2000, true, "%i", playerid);
- dini_IntSet(FileDirectory(accounts, pname), "perkpoints", perkpoints[playerid] - 50);
- perkpoints[playerid] -= 50;
- perks[playerid][2][1] = 1;
- perks[playerid][2][2] = 60;
- perkcd[playerid][2] = SetTimerEx("PerkCoolDown", 1000, true, "%i%i", playerid, listitem);
- if(perks[playerid][2][0] == 1)
- {
- format(rhm, sizeof(rhm), "Your Health Will Start Regenerating A Small Amount Overtime.");
- SendClientMessage(playerid, COLOR_WHITE, rhm);
- }
- else if(perks[playerid][2][0] == 2)
- {
- rhm1 = "Average";
- format(rhm, sizeof(rhm), "Your Health Will Start Regenerate An Average Amount Overtime.");
- SendClientMessage(playerid, COLOR_WHITE, rhm);
- }
- else if(perks[playerid][2][0] == 3)
- {
- rhm1 = "Large";
- format(rhm, sizeof(rhm), "Your Health Will Start Regenerate A Large Amount Overtime.");
- SendClientMessage(playerid, COLOR_WHITE, rhm);
- }
- else if(perks[playerid][2][0] == 4)
- {
- rhm1 = "Massive";
- format(rhm, sizeof(rhm), "Your Health Will Start Regenerate A Massive Amount Overtime.");
- SendClientMessage(playerid, COLOR_WHITE, rhm);
- }
- }
- case 3:
- {
- new pname[MAX_PLAYER_NAME];
- if(perks[playerid][3][0] == 0) return SendClientMessage(playerid, COLOR_RED, "Error: You Haven't Unlokced This Perk Yet!!");
- if(perkpoints[playerid] < 75) return SendClientMessage(playerid, COLOR_RED, "Error: You Don't Have Enough Points!");
- new str[90];
- format(str, sizeof(str), "Error: Your Perk is Cooling Down, Wait For %i Seconds Until It is Usable Again.", perks[playerid][3][2]);
- if(perks[playerid][3][1] == 1) return SendClientMessage(playerid, COLOR_RED, str);
- GetPlayerName(playerid, pname, sizeof(pname));
- dini_IntSet(FileDirectory(accounts, pname), "perkpoints", perkpoints[playerid] - 75);
- perkpoints[playerid] = perkpoints[playerid] - 75;
- perks[playerid][3][1] = 1;
- perks[playerid][3][2] = 40;
- perkcd[playerid][3] = SetTimerEx("PerkCoolDown", 1000, true, "%i%i", playerid, listitem);
- SendClientMessage(playerid, COLOR_YELLOW, "You Have Stunned All Nearby Players.");
- for(new i = 0; i > MAX_PLAYERS ; i++)
- {
- if(!IsPlayerConnected(i) || i == playerid) continue;
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- if(!IsPlayerInRangeOfPoint(i, 10, x, y, z)) continue;
- if(IsPlayerInAnyVehicle(i)) return TogglePlayerControllable(i, 0);
- ApplyAnimation(i, "ped", "FALL_collapse", 4.1, 0, 1, 1, 0, 7500, 0);
- perks[playerid][3][3] = SetTimerEx("StunEnd", 8000, 0, "%i%i", playerid, i);
- TogglePlayerControllable(i, 0);
- GameTextForPlayer(i, "~r~You Have Been Stunned!!", 3000, 5);
- }
- }
- }
- return 1;
- }
- return 0;
- }
- return 1;
- }
- /* Commands */
- CMD:perks(playerid, params[])
- {
- new perktitle[256], pname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pname, sizeof(pname));
- if(perkpoints[playerid]<=0) return SendClientMessage(playerid, COLOR_RED, "Error: You Don't Have Any Perks Points");
- format(perktitle, sizeof(perktitle), "Choose Your Perk!! Current Points: %d", perkpoints[playerid]);
- ShowPlayerDialog(playerid, DIALOG_PERKS, DIALOG_STYLE_TABLIST_HEADERS, perktitle, "Perk\tCost\tMain Effect\nUntouchable\t200 Points\tTemporary Invurability\nJuggernaut\t120 Points\tSuper Heavy Armour\nRecovering\t50 Points\tRegenerate Health\nShockwave\t75 Points\tStun Players", "Activate", "Cancel");
- return 1;
- }
- CMD:setperkpoints(playerid, params[])
- {
- new giveplayerid, moneys1, giveplayer[25], string[256];
- if (sscanf(params, "ud", giveplayerid, moneys1)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /setperkpoints [playerid] [level 0-10000]");
- if (!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "Error: Inactive player id!");
- if (moneys1 < 0 || moneys1 > 10000) return SendClientMessage(playerid, COLOR_RED, "Error: Invalid amount.");
- GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME);
- if (moneys1 == perkpoints[giveplayerid])
- {
- format(string, 64, "%s has %d points already.", giveplayer, moneys1);
- SendClientMessage(playerid, COLOR_WHITE, string);
- return 1;
- }
- dini_IntSet(FileDirectory(accounts, giveplayer), "perkpoints", moneys1);
- perkpoints[giveplayerid] = moneys1;
- format(string, 64, "Your perk points has been set to %d.", moneys1);
- SendClientMessage(giveplayerid, COLOR_YELLOW, string);
- format(string, 64, "You set %s points to %d.", giveplayer, moneys1);
- SendClientMessage(playerid, COLOR_YELLOW, string);
- return 1;
- }
- CMD:setplevel(playerid, params[])
- {
- new pname[MAX_PLAYER_NAME], moneys1, moneys2, giveplayerid, rgl, str[90];
- if (sscanf(params, "uid", giveplayerid, moneys1, moneys2)) return SendClientMessage(playerid, -1, "Usage: /setpplevel [playerid] [perkid] [level]");
- GetPlayerName(giveplayerid, pname, MAX_PLAYER_NAME);
- if (!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "Error: Invalid player id!");
- if (moneys1 < 0 || moneys1 > 3) return SendClientMessage(playerid, COLOR_RED, "Error: Invalid Perk ID!!");
- if (moneys2 < 0 || moneys2 > 5) return SendClientMessage(playerid, COLOR_RED, "Error: Invalid Level!! Choose Between 0-5");
- if (moneys1 == 2 && moneys2 > 4) return SendClientMessage(playerid, COLOR_RED, "Error: Regen Perk Level Range 0-4");
- if ((moneys1 == 1 || moneys1 == 0) && moneys2 > 1) return SendClientMessage(playerid, COLOR_RED, "Error: Perk Level Range 0 - 1");
- if (moneys1 == 2)
- {
- rgl = dini_Int(FileDirectory(accounts, pname), "regenlevel");
- if (moneys2 == rgl)
- {
- format(str, sizeof(str), "Error: %s's Regeneration Level is already %i.", pname, moneys2);
- SendClientMessage(playerid, COLOR_WHITE, str);
- }
- else if(rgl == 0)
- {
- new str1[90];
- new str2[90];
- format(str2, sizeof(str2), "An Admin has Unlocked Regeneration Perk For You, Your Level Has Been Set To %i.", moneys2);
- dini_IntSet(FileDirectory(accounts, pname), "regenlevel", moneys2);
- format(str1, sizeof(str1), "You Have Unlocked Regeneration Perk For %s and Has Set its level to %i.", pname, moneys2);
- SendClientMessage(playerid, COLOR_GREEN, str1);
- SendClientMessage(giveplayerid, COLOR_GREEN, str2);
- perks[playerid][2][0] = moneys2;
- }
- else if(moneys2 == 0)
- {
- new str1[90];
- new str2[90];
- format(str1, sizeof(str1), "You Have locked Regeneration Perk For %s.", pname);
- format(str2, sizeof(str2), "An Admin Has Disabled Your Regeneration Perk.");
- dini_IntSet(FileDirectory(accounts, pname), "regenlevel", moneys2);
- SendClientMessage(playerid, COLOR_YELLOW, str1);
- SendClientMessage(giveplayerid, COLOR_YELLOW, str2);
- perks[playerid][2][0] = moneys2;
- }
- else
- {
- new str1[90];
- new str2[90];
- format(str1, sizeof(str1), "You Have Set Regeneration Perk Level For %s to level %i.", pname, moneys2);
- format(str2, sizeof(str2), "Your Regeneration Perk Level has been set %i by an admin.", moneys2);
- SendClientMessage(playerid, COLOR_YELLOW, str1);
- SendClientMessage(giveplayerid, COLOR_YELLOW, str2);
- dini_IntSet(FileDirectory(accounts, pname), "regenlevel", moneys2);
- perks[playerid][2][0] = moneys2;
- }
- }
- new inv1[64], inv2[64], inv3[64], inv4[64];
- format(inv1, sizeof(inv1), "Invurnability Perk Is Already Locked For %s", pname);
- format(inv2, sizeof(inv2), "Invurability Perk Is Already Unlocked For %s", pname);
- if (moneys1 == 0 && moneys2 == 0 && dini_Int(FileDirectory(accounts, pname), "invur") == 0) return SendClientMessage(playerid, COLOR_WHITE, inv1);
- if (moneys1 == 0 && moneys2 == 1 && dini_Int(FileDirectory(accounts, pname), "invur") == 1) return SendClientMessage(playerid, COLOR_WHITE, inv2);
- if (moneys1 == 0 && moneys2 == 0 && dini_Int(FileDirectory(accounts, pname), "invur") == 1)
- {
- dini_IntSet(FileDirectory(accounts, pname), "invur", moneys2);
- format(inv3, sizeof(inv3), "You Have Locked %s's Invurability Perk.", pname);
- SendClientMessage(playerid, COLOR_YELLOW, inv3);
- SendClientMessage(giveplayerid, COLOR_YELLOW, "An Admin Has Locked Your Invurability Perk.");
- perks[giveplayerid][0][0] = 0;
- }
- if (moneys1 ==0 && moneys2 == 1 && dini_Int(FileDirectory(accounts, pname), "invur") == 0)
- {
- format(inv4, sizeof(inv4), "You Have Given %s Invurability Perk.", pname);
- dini_IntSet(FileDirectory(accounts, pname), "invur", moneys2);
- SendClientMessage(playerid, COLOR_GREEN, inv4);
- SendClientMessage(giveplayerid, COLOR_GREEN, "An Admin Has Given You Invurability Perk.");
- perks[giveplayerid][0][0] = 1;
- }
- new jugg1[64], jugg2[64], jugg3[64], jugg4[64];
- format(jugg1, sizeof(jugg1), "Juggernaut Perk Is Already Locked For %s", pname);
- format(jugg2, sizeof(jugg2), "Juggernaut Perk Is Already Unlocked For %s", pname);
- if (moneys1 == 1 && moneys2 == 0 && dini_Int(FileDirectory(accounts, pname), "jugg") == 0) return SendClientMessage(playerid, COLOR_WHITE, jugg1);
- if (moneys1 == 1 && moneys2 == 1 && dini_Int(FileDirectory(accounts, pname), "jugg") == 1) return SendClientMessage(playerid, COLOR_WHITE, jugg2);
- if (moneys1 == 1 && moneys2 == 0 && dini_Int(FileDirectory(accounts, pname), "jugg") == 1)
- {
- format(jugg3, sizeof(jugg3), "You Have Locked %s's Juggernaut Perk.", pname);
- dini_IntSet(FileDirectory(accounts, pname), "jugg", moneys2);
- SendClientMessage(playerid, COLOR_YELLOW, jugg3);
- SendClientMessage(giveplayerid, COLOR_YELLOW, "An Admin Has Locked Your Juggernaut Perk.");
- perks[giveplayerid][1][0] = 0;
- }
- if (moneys1 == 1 && moneys2 == 1 && dini_Int(FileDirectory(accounts, pname), "jugg") == 0)
- {
- format(jugg4, sizeof(jugg4), "You Have Given %s Juggernaut Perk.", pname);
- dini_IntSet(FileDirectory(accounts, pname), "jugg", moneys2);
- SendClientMessage(playerid, COLOR_GREEN, jugg4);
- SendClientMessage(giveplayerid, COLOR_GREEN, "An Admin Has Given You Juggernaut Perk.");
- perks[giveplayerid][1][0] = 1;
- }
- if (moneys1 == 3)
- {
- new stun1[90], stun2[90], stun3[90], stun4[90];
- format(stun1, 90, "Stun Perk Is Already Unlocked For %s.", pname);
- format(stun2, 90, "Stun Perk Is Already Locked For %s.", pname);
- if(moneys2 == 1 && dini_Int(FileDirectory(accounts, pname), "stunlevel") == 1) return SendClientMessage(playerid, COLOR_WHITE, stun1);
- if(moneys2 == 0 && dini_Int(FileDirectory(accounts, pname), "stunlevel") == 0) return SendClientMessage(playerid, COLOR_WHITE, stun2);
- if(moneys2 == 1 && dini_Int(FileDirectory(accounts, pname), "stunlevel") == 0)
- {
- format(stun3, 90, "You Have Unlocked Stun Perk For %s.", pname);
- dini_IntSet(FileDirectory(accounts, pname), "stunlevel", moneys2);
- SendClientMessage(playerid, COLOR_GREEN, stun3);
- SendClientMessage(giveplayerid, COLOR_GREEN, "An Admin Has Given You Stun Perk.");
- perks[giveplayerid][3][0] = 1;
- }
- if(moneys2 == 0 && dini_Int(FileDirectory(accounts, pname), "stunlevel") == 1)
- {
- format(stun3, 90, "You Have Locked Stun Perk For %s.", pname);
- dini_IntSet(FileDirectory(accounts, pname), "stunlevel", moneys2);
- SendClientMessage(playerid, COLOR_GREEN, stun4);
- SendClientMessage(giveplayerid, COLOR_GREEN, "An Admin Has Locked Your Stun Perk.");
- perks[giveplayerid][3][0] = 2;
- }
- }
- return 1;
- }
- /* Timers */
- forward EndRegenTimer(playerid);
- public EndRegenTimer(playerid)
- {
- KillTimer(perkregentimer[playerid]);
- SendClientMessage(playerid, COLOR_WHITE, "Health Regeneration Over!");
- }
- forward RegeneratePlayerHealth(playerid);
- public RegeneratePlayerHealth(playerid)
- {
- new Float:health;
- GetPlayerHealth(playerid, health);
- switch(perks[playerid][2][0])
- {
- case 1: health = health + 1 > pmaxhealth[playerid] ? pmaxhealth[playerid] : health + 1;
- case 2: health = health + 2 > pmaxhealth[playerid] ? pmaxhealth[playerid] : health + 2;
- case 3: health = health + 4 > pmaxhealth[playerid] ? pmaxhealth[playerid] : health + 4;
- case 4: health = health + 8 > pmaxhealth[playerid] ? pmaxhealth[playerid] : health + 8;
- }
- SetPlayerHealth(playerid, health);
- }
- forward EndInvur(playerid);
- public EndInvur(playerid)
- {
- SetPlayerHealth(playerid, pmaxhealth[playerid]);
- SendClientMessage(playerid, COLOR_ORANGE, "Your superb damage resistance has ended!");
- }
- forward PerkCoolDown(playerid, perkid);
- public PerkCoolDown(playerid, perkid)
- {
- new cdend[90], cd1[32];
- switch(perkid)
- {
- case 0: cd1 = "Invurability";
- case 1: cd1 = "Juggernaut";
- case 2: cd1 = "Regeneration";
- case 3: cd1 = "Stun";
- }
- if(perks[playerid][perkid][2] > 0) return perks[playerid][perkid][2] = perks[playerid][perkid][2] - 1;
- else
- {
- KillTimer(perkcd[playerid][perkid]);
- perks[playerid][perkid][2] = 0;
- perks[playerid][perkid][1] = 0;
- format(cdend, sizeof(cdend), "Your %s Perk Cool Down Ended, And Is Ready To Be Used Again.", cd1);
- SendClientMessage(playerid, COLOR_YELLOW, cdend);
- }
- return 1;
- }
- forward StunEnd(playerid, giveplayerid);
- public StunEnd(playerid, giveplayerid)
- {
- TogglePlayerControllable(giveplayerid, 1);
- perks[giveplayerid][3][3] = 0;
- }
Add Comment
Please, Sign In to add comment