Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <streamer>
- #include <foreach>
- new bountyiable[MAX_PLAYERS];
- new bountycash[MAX_PLAYERS];
- new inpubg[MAX_PLAYERS];
- new pubgsignedup[MAX_PLAYERS];
- new shootedtime[MAX_PLAYERS];
- new abiltopick[MAX_PLAYERS];
- CMD:bounty(playerid, params[])
- {
- new msg[136], bountyid, bountycashh;
- if(sscanf(params, "ii", bountyid, bountycashh)) return SendClientMessage(playerid, ERRORCOLOR, "Usage:/bounty [id] [amount]");
- if(!IsPlayerConnected(bountyid)) return SendClientMessage(playerid, ERRORCOLOR, "Invalid playerid");
- if(GetPlayerMoney(playerid) < bountycashh || GetPlayerMoney(playerid) < 1) return SendClientMessage(playerid, ERRORCOLOR, "invaild amount");
- SetPlayerMoney(playerid, GetPlayerMoney(playerid) - bountycashh);
- bountiable[bountyid] = 1;
- bountycash[bountyid] = bountycashh;
- format(msg, sizeof(msg), "%s has set a bounty $%d on %s's head", Name[playerid] ,bountycashh, Name[bountyid]);
- SendClientMessageToAll(ERRORCOLOR, msg);
- return 1;
- }
- CMD:pubg(playerid, params[])
- {
- new pubgid, msg[123];
- if (CommandCheck(playerid, "pubg")) return 0;
- if (sscanf(params, "i", pubgid)) return SendClientMessage(playerid, ERRORCOLOR, "Usage: /pubg [1-4]");
- if (pubgid < 1 || pubgid > 4) return SendClientMessage(playerid, ERRORCOLOR, "invaild pubg name");
- if (inpubg[playerid] == 1) return SendClientMessage(playerid, ERRORCOLOR, "You are already in pubg");
- if (pubgsignedup[playerid] == 1) return SendClientMessage(playerid, ERRORCOLOR, "You have already signed up");
- if (pubg1running == 1) return SendClientMessage(playerid, ERRORCOLOR, "pubg 1 is already running , please wait a little.");
- if (pubgid == 1 && timerrunning == 0)
- {
- SetTimer("pubgpreperation", 12000, false);
- printf("pass 1");
- pubgsignedup[playerid] = 1;
- pubgplayers += 1;
- SendClientMessageToAll(0x91FF00FF, "Pubg 1 starts in 20 seconds , use {FF0000}(/pubg 1){91FF00} to join");
- format(msg, sizeof(msg), "{D4B790}%s has signed up for pubg 1. {FF0000}(/pubg 1)", Name[playerid]);
- SendClientMessageToAll(-1, msg);
- timerrunning = 1;
- }
- else if (pubgid == 1 && timerrunning == 1)
- {
- pubgsignedup[playerid] = 1;
- pubgplayers += 1;
- format(msg, sizeof(msg), "{D4B790}%s has signed up for pubg 1. {FF0000}(/pubg 1)", Name[playerid]);
- SendClientMessageToAll(-1, msg);
- }
- else if (pubgid == 2 || pubgid == 3 || pubgid == 4) return SendClientMessage(playerid, ERRORCOLOR, "The pubg id you had chosen is currently under maintance , please try again later");
- return 1;
- }
- CMD:pickup(playerid, params[])
- {
- if (inpubg[playerid] != 1) return SendClientMessage(playerid, ERRORCOLOR, "You may only use this command while in a game");
- if (abiltopick[playerid] == 0) return SendClientMessage(playerid, ERRORCOLOR, "Please wait 20 seconds before picking up the next weapon");
- if (IsPlayerInRangeOfPoint(playerid, 3,-992.2407,-1062.1375,129.2188))
- {
- GivePlayerWeapon(playerid, 23, 120);
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
- abiltopick[playerid] = 0;
- SetTimerEx("pickupcooldown", 20000, false , "i", playerid);
- }
- else if (IsPlayerInRangeOfPoint(playerid, 3,-1049.3972,-1244.6392,128.4763))
- {
- GivePlayerWeapon(playerid, 9, 1);
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
- abiltopick[playerid] = 0;
- SetTimerEx("pickupcooldown", 20000, false , "i", playerid);
- }
- else if (IsPlayerInRangeOfPoint(playerid, 3,-1161.2699,-1278.1047,154.5398))
- {
- GivePlayerWeapon(playerid, 34, 20);
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
- abiltopick[playerid] = 0;
- SetTimerEx("pickupcooldown", 20000, false , "i", playerid);
- }
- else if (IsPlayerInRangeOfPoint(playerid, 3,-964.2363,-970.6340,131.9541))
- {
- GivePlayerWeapon(playerid, 27, 450);
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
- abiltopick[playerid] = 0;
- SetTimerEx("pickupcooldown", 20000, false , "i", playerid);
- }
- else if (IsPlayerInRangeOfPoint(playerid, 3,-1172.9540,-985.1346,131.5091))
- {
- GivePlayerWeapon(playerid, 33, 35);
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
- abiltopick[playerid] = 0;
- SetTimerEx("pickupcooldown", 20000, false , "i", playerid);
- }
- else if (IsPlayerInRangeOfPoint(playerid, 3,-1131.6649,-1084.4207,129.2188))
- {
- GivePlayerWeapon(playerid, 25, 100);
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
- abiltopick[playerid] = 0;
- SetTimerEx("pickupcooldown", 20000, false , "i", playerid);
- }
- else if (IsPlayerInRangeOfPoint(playerid, 3,-994.1649,-1112.0087,132.2200))
- {
- GivePlayerWeapon(playerid, 31, 200);
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
- abiltopick[playerid] = 0;
- SetTimerEx("pickupcooldown", 20000, false , "i", playerid);
- }
- else return SendClientMessage(playerid, ERRORCOLOR, "You are not in range of any pickable item");
- return 1;
- }
- forward pickupcooldown(playerid);
- public pickupcooldown(playerid)
- {
- abiltopick[playerid] = 1;
- }
- CMD:pubgcancel(playerid, params[])
- {
- new msg[121];
- if (pubgsignedup[playerid] != 1) return SendClientMessage(playerid, ERRORCOLOR, "You didn't signedup to any pubg game yet");
- else
- {
- pubgplayers -= 1;
- pubgsignedup[playerid] = 0;
- format(msg, sizeof(msg), "{D4B790}%s has canceled sign'ion for pubg 1.{D4B790}", Name[playerid]);
- SendClientMessageToAll(-1, msg);
- }
- return 1;
- }
- forward pubgpreperation();
- public pubgpreperation()
- {
- new ppubg1start;
- ppubg1start = SetTimer("pubgstartup", 18000, false);
- if(pubgplayers < 2)
- {
- SendClientMessageToAll(ERRORCOLOR, "Pubg 1 had been canceled due to less players , 3 players required");
- KillTimer(ppubg1start);
- timerrunning = 0;
- pubgplayers = 0;
- foreach (new i : Character)
- {
- if(pubgsignedup[i] == 1)
- {
- pubgsignedup[i] = 0;
- }
- else if(inpubg[i] == 1)
- {
- inpubg[i] = 0;
- }
- }
- }
- printf("pass 2");
- return 1;
- }
- forward pubgstartup();
- public pubgstartup()
- {
- new Random;
- foreach(new i : Character)
- {
- if(pubgsignedup[i] == 1 && !IsPlayerNPC(i))
- {
- posstate_{i} = 12;
- Random = random(sizeof(pubg));
- SetPlayerPos(i, pubg[Random][0], pubg[Random][1], pubg[Random][2]);
- SetPlayerFacingAngle(i, pubg[Random][3]);
- SetPlayerVirtualWorld(i, 12);
- pubg1running = 1;
- pubgsignedup[i] = 0;
- ResetPlayerWeapons(i);
- SetPlayerArmour(i, 0);
- SetPlayerHealth(i, 70);
- GivePlayerWeapon(i, 25, 7);
- GivePlayerWeapon(i, 6, 1);
- SendClientMessage(i, 0xFF2121FF, "Note: c-bug is disabled while in a game!.");
- inpubg[i] = 1;
- abiltopick[i] = 1;
- SendClientMessage(i, 0x00B0EBFF, "{FF0000}Pubg 1: {00B0EB} You are now in a forest !, you have to survive to be the winner!");
- SendClientMessage(i, 0x00B0EBFF, "{FF0000}Pubg 1: {00B0EB} There is some pickups around the map , pickup them to help you !");
- SendClientMessage(i, 0x00B0EBFF, "{FF0000}Pubg 1: {00B0EB} Good luck hunter !");
- TogglePlayerControllable(i, 0);
- timerrunning = 0;
- counter = 6;
- printf("pubg startup : %d" , i);
- }
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(reason != 49 || reason != 50 || reason != 51 || reason != 0)
- {
- if(bountiable[playerid] == 1 && posstate_{playerid} == 0 && bountycash[playerid] != 0)
- {
- bountiable[playerid] = 0;
- GivePlayerMoney(killerid, bountycash[playerid]);
- format(msg, sizeof(msg), "%s has killed %s and taken %d", Name[killerid], Name[playerid], bountycash[playerid]);
- SendClientMessageToAll(ERRORCOLOR, msg);
- bountycash[playerid] = 0;
- }
- }
- if (inpubg[playerid] == 1 || pubgsignedup[playerid] == 1 && pubg1running == 1)
- {
- if(inpubg[playerid] == 1 && !IsPlayerNPC(playerid))
- {
- format(str, sizeof(str),"{FF0000}%s has been eleminated", Name[playerid]);
- SendClientMessageToAll(ERRORCOLOR,str);
- posstate_{playerid} = 0;
- SpawnPlayer(playerid);
- pubgplayers -= 1;
- inpubg[playerid] = 0;
- }
- if(pubgsignedup[playerid] == 1)
- {
- format(str, sizeof(str),"%s had been kicked out of the pubg 1 due to death of player.", Name[playerid]);
- SendClientMessageToAll(0xFFBF00FF,str);
- pubgplayers -= 1;
- inpubg[playerid] = 0;
- }
- if(pubgplayers == 0 && pubg1running == 1)
- {
- SendClientMessageToAll(ERRORCOLOR, "Pubg 1 had been canceled due to unknown reason");
- pubg1running = 0;
- pubgplayers = 0;
- }
- if(pubgplayers == 1)
- {
- foreach(new i : Character)
- {
- if(inpubg[i] == 1)
- {
- format(str, sizeof(str),"{FF0000}%s {00FF51}had won pubg 1 game",Name[i]);
- SendClientMessageToAll(ERRORCOLOR,str);
- posstate_{i} = 0;
- pubg1running = 0;
- pubgplayers = 0;
- SpawnPlayer(i);
- inpubg[i] = 0;
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if (inpubg[playerid] == 1)
- {
- if(inpubg[playerid] == 1)
- {
- format(str, sizeof(str),"{FF0000}%s has been eleminated", Name[playerid]);
- SendClientMessageToAll(ERRORCOLOR,str);
- pubgplayers -= 1;
- inpubg[playerid] = 0;
- }
- if(pubgplayers == 1)
- {
- foreach(new i : Character)
- {
- if(inpubg[i] == 1)
- {
- format(str, sizeof(str),"{FF0000}%s {00FF51}had won pubg 1 game",Name[i]);
- SendClientMessageToAll(ERRORCOLOR,str);
- pubg1running = 0;
- pubgplayers = 0;
- }
- }
- }
- }
- else if(pubgsignedup[playerid] == 1)
- {
- pubgsignedup[playerid] = 0;
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(inpubg[playerid] == 1 && gettime() - shootedtime[playerid] < 1 && (newkeys & KEY_CROUCH))
- {
- new Float:health;
- SendClientMessage(playerid, ERRORCOLOR, "c-bug is not allowed while in game ! , please do not abuse, - 7 hp taken !.");
- ClearAnimations(playerid);
- TogglePlayerControllable(playerid, 0);
- SetTimerEx("unfreeze", 2000, false, "i", playerid);
- GetPlayerHealth(playerid, health);
- SetPlayerHealth(playerid, health-7);
- }
- return 1;
- }
- forward OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
- public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
- {
- shootedtime[playerid] = gettime();
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement