Код:
/*
/$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
| $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
| $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
| $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
| $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
| $$\ $$$| $$ \ $$ | $$ \ $$| $$
| $$ \ $$| $$$$$$/ | $$ | $$| $$
|__/ \__/ \______/ |__/ |__/|__/
Backpack System
Next Generation Gaming, LLC
(created by Next Generation Gaming Development Team)
* Copyright © 2016, Next Generation Gaming, LLC
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are not permitted in any case.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <YSI\y_hooks>
stock IsBackpackAvailable(playerid)
{
#if defined zombiemode
if(zombieevent == 1 && GetPVarType(playerid, "pIsZombie"))
return 0;
#endif
if(GetPVarType(playerid, "PlayerCuffed") || GetPVarType(playerid, "Injured") || GetPVarType(playerid, "IsFrozen") || GetPVarInt(playerid, "EMSAttempt") != 0 || HungerPlayerInfo[playerid][hgInEvent] != 0 || PlayerInfo[playerid][pHospital] > 0 || PlayerInfo[playerid][pAccountRestricted] != 0)
return 0;
if(GetPVarType(playerid, "IsInArena") || GetPVarInt( playerid, "EventToken") != 0 || IsPlayerInAnyVehicle(playerid) || GetPVarType(playerid, "AttemptingLockPick") || GetPVarInt(playerid, "WatchingTV") || PlayerInfo[playerid][pJailTime] > 0 || !PlayerInfo[playerid][pBEquipped])
return 0;
return 1;
}
stock GetBackpackFreeSlotGun(playerid) {
new slot;
for(new g = 6; g < 11; g++)
{
if(PlayerInfo[playerid][pBItems][g] == 0)
{
slot = g;
break;
}
}
return slot;
}
ShowBackpackMenu(playerid, dialogid, extramsg[]) {
new dgTitle[128],
string[15];
szMiscArray[0] = 0;
if(!IsBackpackAvailable(playerid)) {
DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
return 1;
}
if(!GetPVarType(playerid, "BackpackOpen") || !GetPVarType(playerid, "BackpackProt")) {
DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
return 1;
}
format(dgTitle, sizeof(dgTitle), "%s Items %s", GetBackpackName(PlayerInfo[playerid][pBackpack]), extramsg);
switch(dialogid) {
case DIALOG_OBACKPACK: {
format(szMiscArray, sizeof(szMiscArray), "Food ({FFF94D}%d Meals{FFFFFF})\nNarcotics ({FFF94D}%d Grams{FFFFFF})\nGuns\nEnergy Bars ({FFF94D}%d Bars{FFFFFF})", PlayerInfo[playerid][pBItems][0], GetBackpackNarcoticsGrams(playerid), PlayerInfo[playerid][pBItems][11]);
if(PlayerInfo[playerid][pBItems][5] != 0 && (IsACop(playerid) || IsAMedic(playerid) || IsAGovernment(playerid) || IsATowman(playerid))) format(szMiscArray, sizeof(szMiscArray), "%s\nMedic & Kevlar Vest Kits ({FFF94D}%d{FFFFFF})",szMiscArray, PlayerInfo[playerid][pBItems][5]);
ShowPlayerDialogEx(playerid, DIALOG_OBACKPACK, DIALOG_STYLE_LIST, dgTitle, szMiscArray, "Select", "Cancel");
}
case DIALOG_BFOOD: {
ShowPlayerDialogEx(playerid, DIALOG_BFOOD, DIALOG_STYLE_MSGBOX, dgTitle, "Are you sure you want to use this meal now?", "Confirm", "Cancel");
}
case DIALOG_BMEDKIT: {
ShowPlayerDialogEx(playerid, DIALOG_BMEDKIT, DIALOG_STYLE_MSGBOX, dgTitle, "Are you sure you want to use this Medical & Kevlar Vest kit now?", "Confirm", "Cancel");
}
case DIALOG_BNARCOTICS: {
for(new i; i < sizeof(Drugs); ++i) {
format(szMiscArray, sizeof(szMiscArray), "%s%s({FFF94D}%d{A9C4E4} Grams)\n", szMiscArray, Drugs[i], PlayerInfo[playerid][pBDrugs][i]);
}
ShowPlayerDialogEx(playerid, DIALOG_BNARCOTICS, DIALOG_STYLE_LIST, dgTitle, szMiscArray, "Select", "Cancel");
}
case DIALOG_BNARCOTICS2: {
new pbi = GetPVarInt(playerid, "pbitemindex");
format(dgTitle, sizeof(dgTitle), "{FFF94D}%d{A9C4E4} Grams of %s ({B20400}%d{A9C4E4} Total Grams)", PlayerInfo[playerid][pBDrugs][pbi], Drugs[pbi], GetBackpackNarcoticsGrams(playerid));
ShowPlayerDialogEx(playerid, DIALOG_BNARCOTICS2, DIALOG_STYLE_LIST, dgTitle, "Withdraw\nDeposit", "Select", "Cancel");
}
case DIALOG_BNARCOTICS3: {
new pbi = GetPVarInt(playerid, "pbitemindex");
format(dgTitle, sizeof(dgTitle), "{FFF94D}%d{A9C4E4} Grams of %s({B20400}%d{A9C4E4} Total Grams)\n", PlayerInfo[playerid][pBDrugs][pbi], Drugs[pbi], GetBackpackNarcoticsGrams(playerid));
format(szMiscArray, sizeof(szMiscArray), "%s\nEnter the amount to %s ", extramsg, (GetPVarInt(playerid, "bnwd")) ? ("deposit") : ("withdraw"));
ShowPlayerDialogEx(playerid, DIALOG_BNARCOTICS3, DIALOG_STYLE_INPUT, dgTitle, szMiscArray, "Select", "Cancel");
}
case DIALOG_BGUNS: {
new weapname[20], itemcount;
for(new i = 6; i < 11; i++)
{
if(PlayerInfo[playerid][pBItems][i] > 0)
{
GetWeaponName(PlayerInfo[playerid][pBItems][i], weapname, sizeof(weapname));
format(szMiscArray, sizeof(szMiscArray), "%s%s (%i)\n", szMiscArray, weapname, i);
format(string, sizeof(string), "ListItem%dSId", itemcount);
SetPVarInt(playerid, string, i);
itemcount++;
}
}
SetPVarInt(playerid, "DepositGunId", itemcount);
strcat(szMiscArray, "Deposit a weapon");
ShowPlayerDialogEx(playerid, DIALOG_BGUNS, DIALOG_STYLE_LIST, dgTitle, szMiscArray, "Select", "Cancel");
}
case DIALOG_ENERGYBARS: {
DeletePVar(playerid, "bnwd");
ShowPlayerDialogEx(playerid, DIALOG_ENERGYBARS, DIALOG_STYLE_LIST, dgTitle, "Withdraw\nDeposit", "Select", "Cancel");
}
case DIALOG_ENERGYBARS*2: {
format(dgTitle, sizeof(dgTitle), "{FFF94D}%d {02B0F5}Energy Bars%s", (GetPVarInt(playerid, "bnwd")) ? PlayerInfo[playerid][mInventory][4]:PlayerInfo[playerid][pBItems][11], (GetPVarInt(playerid, "bnwd")) ? (" on hand"):(""));
format(szMiscArray, sizeof(szMiscArray), "%s\nEnter the amount to %s:", extramsg, (GetPVarInt(playerid, "bnwd")) ? ("deposit") : ("withdraw"));
ShowPlayerDialogEx(playerid, DIALOG_ENERGYBARS, DIALOG_STYLE_INPUT, dgTitle, szMiscArray, "Select", "Cancel");
}
}
return 1;
}
stock GetBackpackName(backpackid) {
new bpName[16];
switch(backpackid) {
case 1: bpName = "Small Backpack";
case 2: bpName = "Medium Backpack";
case 3: bpName = "Large Backpack";
}
return bpName;
}
stock GetBackpackNarcoticsGrams(playerid) {
new grams;
for(new i; i < sizeof(Drugs); ++i) grams += PlayerInfo[playerid][pBDrugs][i];
return grams;
}
stock GetBackpackIngredientsGrams(playerid) {
new grams;
for(new i; i < sizeof(szIngredients); ++i) grams += PlayerInfo[playerid][pBIngredients][i];
return grams;
}
stock CountBackpackGuns(playerid) {
new count;
for(new i = 6; i < 11); i++)
if(PlayerInfo[playerid][pBItems][i] > 0)
count++;
return count;
}
CMD:shopbpack(playerid, params[]) {
if(PlayerInfo[playerid][pShopTech] >= 1 || PlayerInfo[playerid][pAdmin] > 3)
{
new playertogive, type, orderid;
if(sscanf(params, "uii", playertogive, type, orderid)) {
SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /shopbpack [player] [type] [orderid]");
SendClientMessageEx(playerid, COLOR_WHITE, "Types: 1(Small Backpack), 2(Medium Backpack), 3(Large Backpack)");
}
else if(!(0 <= type <= 4)) {
SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /shopbpack [player] [type] [orderid]");
SendClientMessageEx(playerid, COLOR_WHITE, "Types: 1(Small Backpack), 2(Medium Backpack), 3(Large Backpack)");
}
else {
new
TypeName[7],
szMessage[87];
switch(type)
{
case 1:
{
TypeName = "Small";
SetPlayerAttachedObject(playertogive, 9, 371, 1, -0.002, -0.140999, -0.01, 8.69999, 88.8, -8.79993, 1.11, 0.963);
}
case 2:
{
TypeName = "Medium";
SetPlayerAttachedObject(playertogive, 9, 371, 1, -0.002, -0.140999, -0.01, 8.69999, 88.8, -8.79993, 1.11, 0.963);
}
case 3:
{
TypeName = "Large";
SetPlayerAttachedObject(playertogive, 9, 3026, 1, -0.254999, -0.109, -0.022999, 10.6, -1.20002, 3.4, 1.265, 1.242, 1.062);
}
}
PlayerInfo[playertogive][pBackpack] = type;
PlayerInfo[playertogive][pBEquipped] = 1;
PlayerInfo[playertogive][pBStoredV] = INVALID_PLAYER_VEHICLE_ID;
PlayerInfo[playertogive][pBStoredH] = INVALID_HOUSE_ID;
format(szMessage, sizeof(szMessage), "You have successfully created a %s Backpack for %s (OrderID: %d).", TypeName, GetPlayerNameEx(playertogive), orderid);
SendClientMessageEx(playerid, COLOR_WHITE, szMessage);
format(szMessage, sizeof(szMessage), "You now have a %s Backpack from %s (OrderID: %d).", TypeName, GetPlayerNameEx(playerid), orderid);
SendClientMessageEx(playertogive, COLOR_WHITE, szMessage);
SendClientMessageEx(playertogive, COLOR_GREY, "Use /backpackhelp to see the list of commands.");
format(szMessage, sizeof(szMessage), "%s created a %s Backpack (%i) for %s(%d) (OrderID: %d).", GetPlayerNameEx(playerid), TypeName, type, GetPlayerNameEx(playertogive), GetPlayerSQLId(playertogive), orderid);
Log("logs/shoplog.log", szMessage);
}
}
else SendClientMessageEx(playerid, COLOR_GREY, " You are not allowed to use this command.");
return 1;
}
hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
if(arrAntiCheat[playerid][ac_iFlags][AC_DIALOGSPOOFING] > 0) return 1;
switch(dialogid)
{
case DIALOG_OBACKPACK: {
if(response) {
if(!IsBackpackAvailable(playerid)) {
DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
return 1;
}
switch(listitem) {
case 0: { // Food
if(PlayerInfo[playerid][pBItems][0] > 0) {
ShowBackpackMenu(playerid, DIALOG_BFOOD, "- {02B0F5}Confirm meal use");
}
else {
ShowBackpackMenu(playerid, DIALOG_OBACKPACK, "- {A80000}You don't have any meals");
}
}
case 1: { // Narcotics
ShowBackpackMenu(playerid, DIALOG_BNARCOTICS, "- {02B0F5}Select a narcotic");
}
case 2: { // Guns
if(PlayerInfo[playerid][pWRestricted] || PlayerInfo[playerid][pAccountRestricted]) return SendClientMessageEx(playerid, COLOR_GRAD2, "You cannot use this option while being restricted.");
ShowBackpackMenu(playerid, DIALOG_BGUNS, "- {02B0F5}Select a weapon");
}
case 3: { // Energy Bars
ShowBackpackMenu(playerid, DIALOG_ENERGYBARS, "- {02B0F5}Energy Bars");
}
case 4: { // Med Kits
if(PlayerInfo[playerid][pBItems][5] > 0) {
ShowBackpackMenu(playerid, DIALOG_BMEDKIT, "- {02B0F5}Confirm med kit use");
}
else {
ShowBackpackMenu(playerid, DIALOG_OBACKPACK, "- {A80000}You don't have any med kits");
}
}
}
}
else {
DeletePVar(playerid, "BackpackProt");
DeletePVar(playerid, "BackpackOpen");
}
}
case DIALOG_BFOOD: {
if(response) {
if(!IsBackpackAvailable(playerid)) {
DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
return 1;
}
if(GetPVarInt(playerid, "BackpackMeal") == 1) {
ShowBackpackMenu(playerid, DIALOG_OBACKPACK, "- {A80000}You're already using a meal.");
}
else
{
defer FinishMeal(playerid);
SetPVarInt(playerid, "BackpackMeal", 1);
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0, 1);
format(szMiscArray, sizeof(szMiscArray), "{FF8000}** {C2A2DA}%s opens a backpack and takes out a Full Meal.", GetPlayerNameEx(playerid));
SendClientMessageEx(playerid, COLOR_WHITE, "You are taking the Meal from your backpack, please wait.");
ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
else {
ShowBackpackMenu(playerid, DIALOG_OBACKPACK, "");
}
}
case DIALOG_BMEDKIT: {
if(response && (IsACop(playerid) || IsAMedic(playerid) || IsAGovernment(playerid))) {
if(!IsBackpackAvailable(playerid)) {
DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
return 1;
}
if(GetPVarInt(playerid, "BackpackMedKit") == 1) {
ShowBackpackMenu(playerid, DIALOG_OBACKPACK, "- {A80000}You're already using a med kit.");
}
else
{
defer FinishMedKit(playerid);
SetPVarInt(playerid, "BackpackMedKit", 1);
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0, 1);
format(szMiscArray, sizeof(szMiscArray), "{FF8000}** {C2A2DA}%s opens a backpack and takes out a Kevlar Vest & First Aid Kit inside.", GetPlayerNameEx(playerid));
SendClientMessageEx(playerid, COLOR_WHITE, "You are taking the Med Kit from your backpack, please wait.");
ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
else {
ShowBackpackMenu(playerid, DIALOG_OBACKPACK, "");
}
}
case DIALOG_BNARCOTICS: {
if(response) {
if(!IsBackpackAvailable(playerid)) {
DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
return 1;
}
SetPVarInt(playerid, "pbitemindex", listitem);
ShowBackpackMenu(playerid, DIALOG_BNARCOTICS2, "");
}
else {
ShowBackpackMenu(playerid, DIALOG_OBACKPACK, "");
}
}
case DIALOG_BNARCOTICS2: {
if(response) {
if(!IsBackpackAvailable(playerid)) {
DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
return 1;
}
SetPVarInt(playerid, "bnwd", listitem);
ShowBackpackMenu(playerid, DIALOG_BNARCOTICS3, "");
}
else {
ShowBackpackMenu(playerid, DIALOG_BNARCOTICS, "- {02B0F5}Select a narcotic");
}
}
case DIALOG_BNARCOTICS3: {
if(response) {
if(!IsBackpackAvailable(playerid)) {
DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
return 1;
}
new pbi = GetPVarInt(playerid, "pbitemindex");
if(GetPVarInt(playerid, "bnwd")) {
new namount, maxgrams, dInfo[135];
if(sscanf(inputtext, "d", namount)) return ShowBackpackMenu(playerid, DIALOG_BNARCOTICS3, "{B20400}Wrong input{A9C4E4}");
if(namount < 1) return ShowBackpackMenu(playerid, DIALOG_BNARCOTICS3, "{B20400}Wrong input{A9C4E4}\nYou cannot put the amount less than 1");
switch(PlayerInfo[playerid][pBackpack]) {
case 1: maxgrams = 40;
case 2: maxgrams = 100;
case 3: maxgrams = 250;
}
if(namount > (maxgrams-GetBackpackNarcoticsGrams(playerid)))
{
format(dInfo, sizeof(dInfo), "{B20400}Wrong input, you can only store %d grams{A9C4E4}\nGrams available to store left {FFF600}%d{A9C4E4}\nEnter the amount to deposit", maxgrams, maxgrams-GetBackpackNarcoticsGrams(playerid));
ShowBackpackMenu(playerid, DIALOG_BNARCOTICS3, dInfo);
return 1;
}
if(PlayerInfo[playerid][pDrugs][pbi] >= namount) PlayerInfo[playerid][pDrugs][pbi] -= namount;
else return ShowBackpackMenu(playerid, DIALOG_BNARCOTICS3, "{B20400}Wrong input{A9C4E4}\nYou don't have that that amount of grams.");
PlayerInfo[playerid][pBDrugs][pbi] += namount;
format(szMiscArray, sizeof(szMiscArray), "You have deposited %d grams of %s in your backpack.", namount, Drugs[pbi]);
SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
new ip[MAX_PLAYER_NAME];
GetPlayerIp(playerid, ip, sizeof(ip));
format(szMiscArray, sizeof(szMiscArray), "[DRUGS] %s(%d) (IP:%s) deposited %d grams of %s (%d grams Total) [BACKPACK %d]", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), ip, namount, Drugs[pbi], PlayerInfo[playerid][pDrugs][pbi], PlayerInfo[playerid][pBackpack]);
Log("logs/backpack.log", szMiscArray);
ShowBackpackMenu(playerid, DIALOG_BNARCOTICS, "- {02B0F5}Select a narcotic");
}
else {
new namount, dInfo[135];
if(sscanf(inputtext, "d", namount)) return ShowBackpackMenu(playerid, DIALOG_BNARCOTICS3, "{B20400}Wrong input{A9C4E4}");
if(namount < 1) return ShowBackpackMenu(playerid, DIALOG_BNARCOTICS3, "{B20400}Wrong input{A9C4E4}\nYou cannot put the amount less than 1");
if(namount > PlayerInfo[playerid][pBDrugs][pbi])
{
format(dInfo, sizeof(dInfo), "{B20400}Wrong input, you only have %d grams of %s{A9C4E4}\nGrams trying to withdraw {FFF600}%d{A9C4E4}\nEnter the amount to deposit", PlayerInfo[playerid][pBDrugs][pbi], Drugs[pbi], namount);
ShowBackpackMenu(playerid, DIALOG_BNARCOTICS3, dInfo);
return 1;
}
PlayerInfo[playerid][pBDrugs][pbi] -= namount;
PlayerInfo[playerid][pDrugs][pbi] += namount;
format(szMiscArray, sizeof(szMiscArray), "You have withdrawn %d grams of %s in your backpack.", namount, Drugs[pbi]);
SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
new ip[MAX_PLAYER_NAME];
GetPlayerIp(playerid, ip, sizeof(ip));
format(szMiscArray, sizeof(szMiscArray), "[DRUGS] %s(%d) (IP:%s) withdrawn %d grams of %s (%d grams Total) [BACKPACK %d]", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), ip, namount, Drugs[pbi], PlayerInfo[playerid][pBDrugs][pbi], PlayerInfo[playerid][pBackpack]);
Log("logs/backpack.log", szMiscArray);
ShowBackpackMenu(playerid, DIALOG_BNARCOTICS, "- {02B0F5}Select a narcotic");
}
}
else {
ShowBackpackMenu(playerid, DIALOG_BNARCOTICS2, "");
}
}
case DIALOG_BGUNS: {
if(response) {
if(!IsBackpackAvailable(playerid)) {
DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
return 1;
}
new szDialog[130], weapname[20];
if(listitem == GetPVarInt(playerid, "DepositGunId")) {
switch(PlayerInfo[playerid][pBackpack]) {
case 1: {
new myweapons[2], itemcount;
GetPlayerWeaponData(playerid, 1, myweapons[0], myweapons[1]);
if(myweapons[0] > 0 && myweapons[0] != 9 && myweapons[0] != 4 && PlayerInfo[playerid][pGuns][1] == myweapons[0] && PlayerInfo[playerid][pAGuns][1] == 0)
{
GetWeaponName(myweapons[0], weapname, sizeof(weapname));
format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
SetPVarInt(playerid, szMiscArray, myweapons[0]);
itemcount++;
}
GetPlayerWeaponData(playerid, 10, myweapons[0], myweapons[1]);
if(myweapons[0] > 0 && PlayerInfo[playerid][pGuns][10] == myweapons[0] && PlayerInfo[playerid][pAGuns][10] == 0)
{
GetWeaponName(myweapons[0], weapname, sizeof(weapname));
format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
SetPVarInt(playerid, szMiscArray, myweapons[0]);
itemcount++;
}
GetPlayerWeaponData(playerid, 2, myweapons[0], myweapons[1]);
if(myweapons[0] > 0 && pTazer{playerid} == 0 && PlayerInfo[playerid][pGuns][2] == myweapons[0] && PlayerInfo[playerid][pAGuns][2] == 0)
{
GetWeaponName(myweapons[0], weapname, sizeof(weapname));
format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
SetPVarInt(playerid, szMiscArray, myweapons[0]);
itemcount++;
}
if(strlen(szDialog) > 0) ShowPlayerDialogEx(playerid, DIALOG_BGUNS2, DIALOG_STYLE_LIST, "Select a weapon to deposit", szDialog, "Select", "Cancel");
else {
ShowBackpackMenu(playerid, DIALOG_BGUNS, "- {02B0F5}Select a weapon - No guns to store");
}
}
case 2, 3: {
new myweapons[2], itemcount;
GetPlayerWeaponData(playerid, 1, myweapons[0], myweapons[1]);
if(myweapons[0] > 0 && myweapons[0] != 9 && myweapons[0] != 4 && PlayerInfo[playerid][pGuns][1] == myweapons[0] && PlayerInfo[playerid][pAGuns][1] == 0)
{
GetWeaponName(myweapons[0], weapname, sizeof(weapname));
format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
SetPVarInt(playerid, szMiscArray, myweapons[0]);
itemcount++;
}
GetPlayerWeaponData(playerid, 10, myweapons[0], myweapons[1]);
if(myweapons[0] > 0 && PlayerInfo[playerid][pGuns][10] == myweapons[0] && PlayerInfo[playerid][pAGuns][10] == 0)
{
GetWeaponName(myweapons[0], weapname, sizeof(weapname));
format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
SetPVarInt(playerid, szMiscArray, myweapons[0]);
itemcount++;
}
GetPlayerWeaponData(playerid, 2, myweapons[0], myweapons[1]);
if(myweapons[0] > 0 && pTazer{playerid} == 0 && PlayerInfo[playerid][pGuns][2] == myweapons[0] && PlayerInfo[playerid][pAGuns][2] == 0)
{
GetWeaponName(myweapons[0], weapname, sizeof(weapname));
format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
SetPVarInt(playerid, szMiscArray, myweapons[0]);
itemcount++;
}
GetPlayerWeaponData(playerid, 3, myweapons[0], myweapons[1]);
if(myweapons[0] > 0 && PlayerInfo[playerid][pGuns][3] == myweapons[0] && PlayerInfo[playerid][pAGuns][3] == 0)
{
GetWeaponName(myweapons[0], weapname, sizeof(weapname));
format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
SetPVarInt(playerid, szMiscArray, myweapons[0]);
itemcount++;
}
GetPlayerWeaponData(playerid, 4, myweapons[0], myweapons[1]);
if(myweapons[0] > 0 && PlayerInfo[playerid][pGuns][4] == myweapons[0] && PlayerInfo[playerid][pAGuns][4] == 0)
{
GetWeaponName(myweapons[0], weapname, sizeof(weapname));
format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
SetPVarInt(playerid, szMiscArray, myweapons[0]);
itemcount++;
}
GetPlayerWeaponData(playerid, 5, myweapons[0], myweapons[1]);
if(myweapons[0] > 0 && PlayerInfo[playerid][pGuns][5] == myweapons[0] && PlayerInfo[playerid][pAGuns][5] == 0)
{
GetWeaponName(myweapons[0], weapname, sizeof(weapname));
format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
SetPVarInt(playerid, szMiscArray, myweapons[0]);
itemcount++;
}
GetPlayerWeaponData(playerid, 6, myweapons[0], myweapons[1]);
if(myweapons[0] > 0 && PlayerInfo[playerid][pGuns][6] == myweapons[0] && PlayerInfo[playerid][pAGuns][6] == 0)
{
GetWeaponName(myweapons[0], weapname, sizeof(weapname));
format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
SetPVarInt(playerid, szMiscArray, myweapons[0]);
itemcount++;
}
if(strlen(szDialog) > 0) ShowPlayerDialogEx(playerid, DIALOG_BGUNS2, DIALOG_STYLE_LIST, "Select a weapon to deposit", szDialog, "Select", "Cancel");
else {
ShowBackpackMenu(playerid, DIALOG_BGUNS, "- {02B0F5}Select a weapon - No guns to store");
}
}
}
}
else {
format(szMiscArray, sizeof(szMiscArray), "ListItem%dSId", listitem);
new slot = GetPVarInt(playerid, szMiscArray);
if(PlayerInfo[playerid][pBItems][slot] > 0) {
new aWeapons[13][2];
for(new i; i < 13; ++i) {
GetPlayerWeaponData(playerid, i, aWeapons[i][0], aWeapons[i][1]);
if(aWeapons[i][0] == PlayerInfo[playerid][pBItems][slot]) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are already carrying this weapon.");
}
GetWeaponName(PlayerInfo[playerid][pBItems][slot], weapname, sizeof(weapname));
GivePlayerValidWeapon(playerid, PlayerInfo[playerid][pBItems][slot]);
DeletePVar(playerid, szMiscArray);
format(szMiscArray, sizeof(szMiscArray), "You have withdrawn a %s from your backpack.", weapname);
SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
format(szMiscArray, sizeof(szMiscArray), "* %s has withdrawn a %s from their backpack.", GetPlayerNameEx(playerid), weapname);
ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
new ip[MAX_PLAYER_NAME];
GetPlayerIp(playerid, ip, sizeof(ip));
format(szMiscArray, sizeof(szMiscArray), "[WEAPONS] %s(%d) (IP:%s) withdrawn a %s(%d) [BACKPACK %d]", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), ip, weapname, PlayerInfo[playerid][pBItems][slot], PlayerInfo[playerid][pBackpack]);
Log("logs/backpack.log", szMiscArray);
PlayerInfo[playerid][pBItems][slot] = 0;
ShowBackpackMenu(playerid, DIALOG_BGUNS, "- {02B0F5}Select a weapon");
return 1;
}
}
}
else {
ShowBackpackMenu(playerid, DIALOG_OBACKPACK, "");
}
}
case DIALOG_BGUNS2: {
if(response) {
if(!IsBackpackAvailable(playerid)) {
DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
return 1;
}
new handguns, primguns, wbid, slot = GetBackpackFreeSlotGun(playerid), weapname[32];
for(new i = 6; i < 11; i++) {
if(PlayerInfo[playerid][pBItems][i] > 0) {
if(IsWeaponHandgun(PlayerInfo[playerid][pBItems][i])) handguns++;
else if(IsWeaponPrimary(PlayerInfo[playerid][pBItems][i])) primguns++;
}
}
switch(PlayerInfo[playerid][pBackpack]) {
case 1: {
format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", listitem);
wbid = GetPVarInt(playerid, szMiscArray);
if(handguns > 1 || primguns > 0 || IsWeaponPrimary(wbid)) {
ShowBackpackMenu(playerid, DIALOG_BGUNS, "- {02B0F5}You can only carry 2 handguns");
return 1;
}
if(slot != 0 && PlayerInfo[playerid][pGuns][GetWeaponSlot(wbid)] == wbid && PlayerInfo[playerid][pAGuns][GetWeaponSlot(wbid)] == 0) {
RemovePlayerWeapon(playerid, wbid);
PlayerInfo[playerid][pBItems][slot] = wbid;
GetWeaponName(wbid, weapname, sizeof(weapname));
format(szMiscArray, sizeof(szMiscArray), "You have deposited a %s inside your backpack.", weapname);
SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
format(szMiscArray, sizeof(szMiscArray), "* %s has deposited a %s inside their backpack.", GetPlayerNameEx(playerid), weapname);
ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
new ip[MAX_PLAYER_NAME];
GetPlayerIp(playerid, ip, sizeof(ip));
format(szMiscArray, sizeof(szMiscArray), "[WEAPONS] %s(%d) (IP:%s) deposited a %s(%d) in slot %d [BACKPACK %d]", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), ip, weapname, wbid, slot, PlayerInfo[playerid][pBackpack]);
Log("logs/backpack.log", szMiscArray);
ShowBackpackMenu(playerid, DIALOG_BGUNS, "- {02B0F5}Select a weapon");
return 1;
}
else {
ShowBackpackMenu(playerid, DIALOG_BGUNS, "- {02B0F5}Select a weapon ERROR");
}
}
case 2: {
format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", listitem);
wbid = GetPVarInt(playerid, szMiscArray);
if((handguns >= 2 && IsWeaponHandgun(wbid)) || (IsWeaponPrimary(wbid) && primguns >= 1) || (handguns >= 2 && primguns >= 1)) {
ShowBackpackMenu(playerid, DIALOG_BGUNS, "- {02B0F5}You can only carry 2 handguns and 1 primary");
return 1;
}
if(slot != 0 && PlayerInfo[playerid][pGuns][GetWeaponSlot(wbid)] == wbid && PlayerInfo[playerid][pAGuns][GetWeaponSlot(wbid)] == 0) {
RemovePlayerWeapon(playerid, wbid);
PlayerInfo[playerid][pBItems][slot] = wbid;
GetWeaponName(wbid, weapname, sizeof(weapname));
format(szMiscArray, sizeof(szMiscArray), "You have deposited a %s inside your backpack.", weapname);
SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
format(szMiscArray, sizeof(szMiscArray), "* %s has deposited a %s inside their backpack.", GetPlayerNameEx(playerid), weapname);
ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
new ip[MAX_PLAYER_NAME];
GetPlayerIp(playerid, ip, sizeof(ip));
format(szMiscArray, sizeof(szMiscArray), "[WEAPONS] %s(%d) (IP:%s) deposited a %s(%d) in slot %d [BACKPACK %d]", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), ip, weapname, wbid, slot, PlayerInfo[playerid][pBackpack]);
Log("logs/backpack.log", szMiscArray);
ShowBackpackMenu(playerid, DIALOG_BGUNS, "- {02B0F5}Select a weapon");
return 1;
}
else {
ShowBackpackMenu(playerid, DIALOG_BGUNS, "- Select a weapon ERROR");
}
}
case 3: {
format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", listitem);
wbid = GetPVarInt(playerid, szMiscArray);
if((handguns >= 2 && primguns >= 3) || (primguns >= 3 && IsWeaponPrimary(wbid)) || (handguns >= 2 && IsWeaponHandgun(wbid))) {
ShowBackpackMenu(playerid, DIALOG_BGUNS, "- You can only carry 2 handguns and 3 primary");
return 1;
}
if(slot != 0 && PlayerInfo[playerid][pGuns][GetWeaponSlot(wbid)] == wbid && PlayerInfo[playerid][pAGuns][GetWeaponSlot(wbid)] == 0) {
RemovePlayerWeapon(playerid, wbid);
PlayerInfo[playerid][pBItems][slot] = wbid;
GetWeaponName(wbid, weapname, sizeof(weapname));
format(szMiscArray, sizeof(szMiscArray), "You have deposited a %s inside your backpack.", weapname);
SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
format(szMiscArray, sizeof(szMiscArray), "* %s has deposited a %s inside their backpack.", GetPlayerNameEx(playerid), weapname);
ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
new ip[MAX_PLAYER_NAME];
GetPlayerIp(playerid, ip, sizeof(ip));
format(szMiscArray, sizeof(szMiscArray), "[WEAPONS] %s(%d) (IP:%s) deposited a %s(%d) in slot %d [BACKPACK %d]", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), ip, weapname, wbid, slot, PlayerInfo[playerid][pBackpack]);
Log("logs/backpack.log", szMiscArray);
ShowBackpackMenu(playerid, DIALOG_BGUNS, "- Select a weapon");
return 1;
}
else {
ShowBackpackMenu(playerid, DIALOG_BGUNS, "- Select a weapon ERROR");
}
}
}
}
else {
ShowBackpackMenu(playerid, DIALOG_BGUNS, "- Select a weapon");
}
}
case DIALOG_BMEALSTORE: {
if(response) {
PlayerInfo[playerid][pBItems][0]++;
format(szMiscArray,sizeof(szMiscArray),"* You have stored a Full Meal in your backpack(%d meals).",PlayerInfo[playerid][pBItems][0]);
SendClientMessage(playerid, COLOR_GRAD2, szMiscArray);
}
else {
if (PlayerInfo[playerid][pFitness] >= 5)
PlayerInfo[playerid][pFitness] -= 5;
else
PlayerInfo[playerid][pFitness] = 0;
SetHealth(playerid, 100.0);
}
}
case DIALOG_BDROP:
{
if(!response) return SendClientMessageEx(playerid, COLOR_WHITE, "You have successfully cancelled dropping your backpack.");
if(PlayerInfo[playerid][pBackpack] > 0)
{
new choice[7];
switch(PlayerInfo[playerid][pBackpack])
{
case 1: choice = "Small";
case 2: choice = "Medium";
case 3: choice = "Large";
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(szMiscArray, sizeof(szMiscArray), "You have dropped your %s Backpack.", choice);
SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
RemovePlayerAttachedObject(playerid, 9);
PlayerInfo[playerid][pBackpack] = 0;
PlayerInfo[playerid][pBEquipped] = 0;
PlayerInfo[playerid][pBStoredH] = INVALID_HOUSE_ID;
PlayerInfo[playerid][pBStoredV] = INVALID_PLAYER_VEHICLE_ID;
for(new i = 0; i < 10; i++)
{
PlayerInfo[playerid][pBItems][i] = 0;
}
format(szMiscArray, sizeof(szMiscArray), "* %s has thrown away their backpack.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
new ip[MAX_PLAYER_NAME];
GetPlayerIp(playerid, ip, sizeof(ip));
format(szMiscArray, sizeof(szMiscArray), "[DROP] %s(%d) (IP:%s) has thrown away his %s Backpack", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerIpEx(playerid), choice);
Log("logs/backpack.log", szMiscArray);
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "You do not have a backpack!");
}
}
}
return 0;
}
CMD:sellbackpack(playerid, params[])
{
if(PlayerInfo[playerid][pBackpack] > 0)
{
if(!PlayerInfo[playerid][pBEquipped]) return SendClientMessageEx(playerid, COLOR_GREY, "You are are not wearing your backpack, you can wear it with /bwear.");
if(!IsBackpackAvailable(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
if(GetPVarType(playerid, "IsInArena")) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now, you are in an arena!");
if(GetPVarInt( playerid, "EventToken") != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can't use this while you're in an event.");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this while being inside the vehicle!");
if(GetPVarInt(playerid, "EMSAttempt") != 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You can't use this command!");
if(GetPVarInt(playerid, "sellingbackpack")) return SendClientMessageEx(playerid, COLOR_GRAD2, "You are already selling a backpack!");
new string[128], giveplayerid, price, bptype[8];
if(sscanf(params, "ui", giveplayerid, price)) {
SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /sellbackpack [player] [price]");
SendClientMessageEx(playerid, COLOR_YELLOW, "WARNING: /sellbackpack will automatically remove all your items currently in your backpack.");
return 1;
}
if(price < 0) {
SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /sellbackpack [player] [price]");
SendClientMessageEx(playerid, COLOR_YELLOW, "WARNING: /sellbackpack will automatically remove all your items currently in your backpack.");
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(playerid == giveplayerid) return 1;
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
switch(PlayerInfo[playerid][pBackpack])
{
case 1: bptype = "Small";
case 2: bptype = "Medium";
case 3: bptype = "Large";
}
if(PlayerInfo[giveplayerid][pBackpack] > 0) return SendClientMessageEx(playerid, COLOR_GREY, "That player already has a backpack!");
SetPVarInt(giveplayerid, "sellbackpack", playerid);
SetPVarInt(giveplayerid, "sellbackpackprice", price);
SetPVarInt(playerid, "sellingbackpack", 1);
format(string, sizeof(string), "* %s has offered you a %s Backpack for $%s. /accept backpack to get the backpack.", GetPlayerNameEx(playerid), bptype, number_format(price));
SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* You have offered %s your %s Backpack for $%s.",GetPlayerNameEx(giveplayerid), bptype, number_format(price));
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
}
else
{
return SendClientMessageEx(playerid, COLOR_GREY, " That person is not near you!");
}
}
else
{
return SendClientMessageEx(playerid, COLOR_GREY, " That person is not connected!");
}
}
else return SendClientMessageEx(playerid, COLOR_GREY, "You do not own a backpack(Use /miscshop to get one with credits)");
return 1;
}
CMD:listbitems(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] > 1 || PlayerInfo[playerid][pWatchdog] >= 2)
{
new string[128], giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /listbitems [player]");
if(IsPlayerConnected(giveplayerid))
{
if(PlayerInfo[giveplayerid][pBackpack] < 1) return SendClientMessageEx(playerid, COLOR_GREY, "That player does not have a backpack!");
new btype[8], weaponname[50];
switch(PlayerInfo[giveplayerid][pBackpack])
{
case 1: btype = "Small";
case 2: btype = "Medium";
case 3: btype = "Large";
}
SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________");
format(string, sizeof(string), "*** %s' %s Backpack items... ***", GetPlayerNameEx(giveplayerid), btype);
SendClientMessageEx(playerid, COLOR_WHITE, string);
if(PlayerInfo[giveplayerid][pBItems][0] > 0)
{
format(string, sizeof(string), "(Backpack) %d meals.", PlayerInfo[giveplayerid][pBItems][0]);
SendClientMessageEx(playerid, COLOR_GREY, string);
}
for(new i; i < sizeof(Drugs); ++i) {
if(PlayerInfo[giveplayerid][pBDrugs][i] > 0) {
format(string, sizeof(string), "(Backpack) %d grams of %s.", PlayerInfo[giveplayerid][pBDrugs][i], Drugs[i]);
SendClientMessageEx(playerid, COLOR_GREY, string);
}
}
if(PlayerInfo[giveplayerid][pBItems][5] > 0)
{
format(string, sizeof(string), "(Backpack) %d Medical Kits.", PlayerInfo[giveplayerid][pBItems][5]);
SendClientMessageEx(playerid, COLOR_GREY, string);
}
if(PlayerInfo[giveplayerid][pBItems][11] > 0)
{
format(string, sizeof(string), "(Backpack) %d Energy Bars.", PlayerInfo[giveplayerid][pBItems][11]);
SendClientMessageEx(playerid, COLOR_GREY, string);
}
new sent;
for (new i = 6; i < 11; i++)
{
if(PlayerInfo[giveplayerid][pBItems][i] > 0)
{
if(!sent)
{
format(string, sizeof(string), "*** %s' %s Backpack weapons... ***", GetPlayerNameEx(giveplayerid), btype);
SendClientMessageEx(playerid, COLOR_WHITE, string);
sent = 1;
}
GetWeaponName(PlayerInfo[giveplayerid][pBItems][i], weaponname, sizeof(weaponname));
format(string, sizeof(string), "Weapon: %s.", weaponname);
SendClientMessageEx(playerid, COLOR_GRAD1, string);
}
}
SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________");
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
}
return 1;
}
CMD:bsearch(playerid, params[])
{
if(IsACop(playerid) || PlayerInfo[playerid][pJob] == 8 || PlayerInfo[playerid][pJob2] == 8 || PlayerInfo[playerid][pJob3] == 8)
{
new string[128], giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bsearch [player]");
if(IsPlayerConnected(giveplayerid) && ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot search yourself!");
if(PlayerInfo[giveplayerid][pBEquipped] < 1) return SendClientMessageEx(playerid, COLOR_GREY, "That player is not wearing a backpack!");
new btype[8], weaponname[50];
switch(PlayerInfo[giveplayerid][pBackpack])
{
case 1: btype = "Small";
case 2: btype = "Medium";
case 3: btype = "Large";
}
SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________");
format(string, sizeof(string), "*** %s' %s Backpack items... ***", GetPlayerNameEx(giveplayerid), btype);
SendClientMessageEx(playerid, COLOR_WHITE, string);
if(PlayerInfo[giveplayerid][pBItems][0] > 0)
{
format(string, sizeof(string), "(Backpack) %d meals.", PlayerInfo[giveplayerid][pBItems][0]);
SendClientMessageEx(playerid, COLOR_GREY, string);
}
for(new i; i < sizeof(Drugs); ++i) {
if(PlayerInfo[giveplayerid][pBDrugs][i] > 0) {
format(string, sizeof(string), "(Backpack) %d grams of %s.", PlayerInfo[giveplayerid][pBDrugs][i], Drugs[i]);
SendClientMessageEx(playerid, COLOR_GREY, string);
}
}
if(PlayerInfo[giveplayerid][pBItems][5] > 0)
{
format(string, sizeof(string), "(Backpack) %d Medical Kits.", PlayerInfo[giveplayerid][pBItems][5]);
SendClientMessageEx(playerid, COLOR_GREY, string);
}
if(PlayerInfo[giveplayerid][pBItems][11] > 0)
{
format(string, sizeof(string), "(Backpack) %d Energy Bars.", PlayerInfo[giveplayerid][pBItems][11]);
SendClientMessageEx(playerid, COLOR_GREY, string);
}
new sent;
for (new i = 6; i < 11; i++)
{
if(PlayerInfo[giveplayerid][pBItems][i] > 0)
{
if(!sent)
{
format(string, sizeof(string), "*** %s' %s Backpack weapons... ***", GetPlayerNameEx(giveplayerid), btype);
SendClientMessageEx(playerid, COLOR_WHITE, string);
sent = 1;
}
GetWeaponName(PlayerInfo[giveplayerid][pBItems][i], weaponname, sizeof(weaponname));
format(string, sizeof(string), "Weapon: %s.", weaponname);
SendClientMessageEx(playerid, COLOR_GRAD1, string);
}
}
SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________");
format(string, sizeof(string), "* %s has searched %s's backpack for any illegal items.", GetPlayerNameEx(playerid),GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
}
return 1;
}
CMD:bremove(playerid, params[])
{
if (!IsACop(playerid))
{
SendClientMessageEx(playerid,COLOR_GREY,"You're not a law enforcement officer.");
return 1;
}
new string[128], giveplayerid, item[6], bptype[8];
if(sscanf(params, "us[6]", giveplayerid, item)) {
SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bremove [player] [item]");
SendClientMessageEx(playerid, COLOR_YELLOW, "ITEMS: [All drugs - see /mydrugs], Guns, Meals");
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(playerid == giveplayerid) return 1;
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
if(PlayerInfo[giveplayerid][pBEquipped] < 1 && PlayerInfo[giveplayerid][pBackpack] < 1) return SendClientMessageEx(playerid, COLOR_GREY, "That player is not wearing a backpack!");
switch(PlayerInfo[playerid][pBackpack])
{
case 1: bptype = "Small";
case 2: bptype = "Medium";
case 3: bptype = "Large";
}
new iDrugID = GetDrugID(item);
if(iDrugID != -1) {
format(string, sizeof(string), "* You have taken away %s's %s from their backpack.", GetPlayerNameEx(giveplayerid), Drugs[iDrugID]);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Officer %s has taken away your %s from your backpack.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), Drugs[iDrugID]);
SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Officer %s has taken away %s's %s from their backpack.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), Drugs[iDrugID]);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
PlayerInfo[giveplayerid][pBDrugs][iDrugID] = 0;
}
else if(strcmp(item,"meals",true) == 0)
{
format(string, sizeof(string), "* You have taken away %s's meals from their backpack.", GetPlayerNameEx(giveplayerid));
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Officer %s has taken away your meals from your backpack.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Officer %s has taken away %s's meals from their backpack.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
PlayerInfo[giveplayerid][pBItems][0] = 0;
}
else if(strcmp(item,"guns",true) == 0)
{
format(string, sizeof(string), "* You have taken away %s's weapons from their backpack.", GetPlayerNameEx(giveplayerid));
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Officer %s has taken away your weapons from your backpack.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Officer %s has taken away %s's weapons from their backpack.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
for(new i = 6; i < 11; i++)
{
PlayerInfo[giveplayerid][pBItems][i] = 0;
}
}
}
else
{
return SendClientMessageEx(playerid, COLOR_GREY, " That person is not near you!");
}
}
else
{
return SendClientMessageEx(playerid, COLOR_GREY, " That person is not connected!");
}
return 1;
}
CMD:bwear(playerid, params[])
{
if(PlayerInfo[playerid][pBackpack] > 0)
{
if(!IsBackpackAvailable(playerid) && PlayerInfo[playerid][pBEquipped]) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
if(GetPVarType(playerid, "IsInArena")) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now, you are in an arena!");
if(GetPVarInt( playerid, "EventToken") != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can't use this while you're in an event.");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this while being inside the vehicle!");
if(GetPVarInt(playerid, "EMSAttempt") != 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You can't use this command!");
if(PlayerInfo[playerid][pBEquipped]) return SendClientMessageEx(playerid, COLOR_GREY, "You are already wearing your backpack, you can store it to your car/house with /bstore.");
new string[128], btype[8], i = 0, Float: x, Float: y, Float: z, pvid = -1;
if(PlayerInfo[playerid][pBStoredV] != INVALID_PLAYER_VEHICLE_ID)
{
for(i = 0 ; i < MAX_PLAYERVEHICLES; i++)
{
if(PlayerVehicleInfo[playerid][i][pvId] != INVALID_PLAYER_VEHICLE_ID && PlayerVehicleInfo[playerid][i][pvSlotId] == PlayerInfo[playerid][pBStoredV]) GetVehiclePos(PlayerVehicleInfo[playerid][i][pvId], x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
{
pvid = i;
break;
}
}
if(pvid == -1) return SendClientMessageEx(playerid,COLOR_GREY,"You are not near the vehicle where the backpack is stored.");
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(PlayerVehicleInfo[playerid][pvid][pvId],engine,lights,alarm,doors,bonnet,boot,objective);
if(boot == VEHICLE_PARAMS_OFF || boot == VEHICLE_PARAMS_UNSET) return SendClientMessageEx(playerid, COLOR_GRAD3, "You can't take/put stuff inside the trunk if it's closed!(/car trunk to open it)");
if(PlayerHoldingObject[playerid][9] != 0 || IsPlayerAttachedObjectSlotUsed(playerid, 9))
RemovePlayerAttachedObject(playerid, 9), PlayerHoldingObject[playerid][9] = 0;
switch(PlayerInfo[playerid][pBackpack])
{
case 1:
{
btype = "Small";
SetPlayerAttachedObject(playerid, 9, 371, 1, -0.002, -0.140999, -0.01, 8.69999, 88.8, -8.79993, 1.11, 0.963);
}
case 2:
{
btype = "Medium";
SetPlayerAttachedObject(playerid, 9, 371, 1, -0.002, -0.140999, -0.01, 8.69999, 88.8, -8.79993, 1.11, 0.963);
}
case 3:
{
btype = "Large";
SetPlayerAttachedObject(playerid, 9, 3026, 1, -0.254999, -0.109, -0.022999, 10.6, -1.20002, 3.4, 1.265, 1.242, 1.062);
}
}
format(string, sizeof(string), "You took your %s Backpack from your %s, use /bstore to store it.", btype, GetVehicleName(PlayerVehicleInfo[playerid][pvid][pvId]));
SendClientMessageEx(playerid, COLOR_GREY, string);
PlayerInfo[playerid][pBStoredV] = INVALID_PLAYER_VEHICLE_ID;
PlayerInfo[playerid][pBEquipped] = 1;
format(string, sizeof(string), "* %s has taken a backpack from their car trunk.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else if(PlayerInfo[playerid][pBStoredH] != INVALID_HOUSE_ID)
{
for(i = 0; i < MAX_HOUSES; i++)
{
if(HouseInfo[i][hSQLId] == PlayerInfo[playerid][pBStoredH])
{
pvid = i;
break;
}
}
if(IsPlayerInRangeOfPoint(playerid, 50, HouseInfo[pvid][hInteriorX], HouseInfo[pvid][hInteriorY], HouseInfo[pvid][hInteriorZ]) && GetPlayerVirtualWorld(playerid) == HouseInfo[pvid][hIntVW] && GetPlayerInterior(playerid) == HouseInfo[pvid][hIntIW])
{
if(PlayerHoldingObject[playerid][9] != 0 || IsPlayerAttachedObjectSlotUsed(playerid, 9))
RemovePlayerAttachedObject(playerid, 9), PlayerHoldingObject[playerid][9] = 0;
switch(PlayerInfo[playerid][pBackpack])
{
case 1:
{
btype = "Small";
SetPlayerAttachedObject(playerid, 9, 371, 1, -0.002, -0.140999, -0.01, 8.69999, 88.8, -8.79993, 1.11, 0.963);
}
case 2:
{
btype = "Medium";
SetPlayerAttachedObject(playerid, 9, 371, 1, -0.002, -0.140999, -0.01, 8.69999, 88.8, -8.79993, 1.11, 0.963);
}
case 3:
{
btype = "Large";
SetPlayerAttachedObject(playerid, 9, 3026, 1, -0.254999, -0.109, -0.022999, 10.6, -1.20002, 3.4, 1.265, 1.242, 1.062);
}
}
format(string, sizeof(string), "You took your %s Backpack from your house, use /bstore to store it.", btype);
SendClientMessageEx(playerid, COLOR_GREY, string);
PlayerInfo[playerid][pBStoredH] = INVALID_HOUSE_ID;
PlayerInfo[playerid][pBEquipped] = 1;
format(string, sizeof(string), "* %s has taken a backpack from their house.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
else return SendClientMessageEx(playerid, COLOR_GREY, "You need to be inside the house you have stored your backpack!");
}
}
else return SendClientMessageEx(playerid, COLOR_GREY, "You do not own a backpack(Use /miscshop to get one with credits)");
return 1;
}
CMD:bstore(playerid, params[])
{
if(PlayerInfo[playerid][pBackpack] > 0)
{
if(!PlayerInfo[playerid][pBEquipped]) return SendClientMessageEx(playerid, COLOR_GREY, "You are are not wearing your backpack, you can wear it with /bwear.");
if(!IsBackpackAvailable(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
if(GetPVarType(playerid, "IsInArena")) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now, you are in an arena!");
if(GetPVarInt(playerid, "EventToken") != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can't use this while you're in an event.");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this while being inside the vehicle!");
if(GetPVarInt(playerid, "EMSAttempt") != 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You can't use this command!");
new Float: Health;
GetHealth(playerid, Health);
if(Health < 50.0) return SendClientMessageEx(playerid,COLOR_GREY,"You cannot store a backpack in a house/car when your health lower than 80.");
new string[128], housecar[6];
if(sscanf(params, "s[6]", housecar)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bstore [house/car]");
if(strcmp(housecar, "car", true, strlen(housecar)) == 0)
{
new pvid = -1, Float: x, Float: y, Float: z;
for(new d = 0 ; d < MAX_PLAYERVEHICLES; d++)
{
if(PlayerVehicleInfo[playerid][d][pvId] != INVALID_PLAYER_VEHICLE_ID) GetVehiclePos(PlayerVehicleInfo[playerid][d][pvId], x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
{
pvid = d;
break;
}
}
if(pvid == -1) return SendClientMessageEx(playerid,COLOR_GREY,"You are not near any vehicle that you own.");
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(PlayerVehicleInfo[playerid][pvid][pvId],engine,lights,alarm,doors,bonnet,boot,objective);
if(boot == VEHICLE_PARAMS_OFF || boot == VEHICLE_PARAMS_UNSET) return SendClientMessageEx(playerid, COLOR_GRAD3, "You can't take/put stuff inside the trunk if it's closed!(/car trunk to open it)");
if(GetVehicleModel(PlayerVehicleInfo[playerid][pvid][pvId]) == 481 || GetVehicleModel(PlayerVehicleInfo[playerid][pvid][pvId]) == 510) return SendClientMessageEx(playerid,COLOR_GREY,"That vehicle doesn't have a trunk.");
new btype[7];
switch(PlayerInfo[playerid][pBackpack])
{
case 1: btype = "Small";
case 2: btype = "Medium";
case 3: btype = "Large";
}
format(string, sizeof(string), "You stored your %s Backpack in your %s, use /bwear to wear it.", btype, GetVehicleName(PlayerVehicleInfo[playerid][pvid][pvId]));
SendClientMessageEx(playerid, COLOR_GREY, string);
RemovePlayerAttachedObject(playerid, 9);
PlayerInfo[playerid][pBEquipped] = 0;
PlayerInfo[playerid][pBStoredV] = PlayerVehicleInfo[playerid][pvid][pvSlotId];
format(string, sizeof(string), "* %s has stored a backpack in the trunk of their car.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
format(string, sizeof(string), "[TRUNK] %s(%d) (%s) stored their %s backpack in [SQLID:%d][SlotID:%d][ModelID:%d]", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerIpEx(playerid), btype, PlayerVehicleInfo[playerid][pvid][pvSlotId], pvid, PlayerVehicleInfo[playerid][pvid][pvModelId]);
Log("logs/backpack.log", string);
}
else if(strcmp(housecar, "house", true, strlen(housecar)) == 0)
{
if(Homes[playerid] > 0)
{
new hid = -1;
for(new i; i < MAX_HOUSES; i++)
{
if(GetPlayerSQLId(playerid) == HouseInfo[i][hOwnerID] && IsPlayerInRangeOfPoint(playerid, 50, HouseInfo[i][hInteriorX], HouseInfo[i][hInteriorY], HouseInfo[i][hInteriorZ]) && GetPlayerVirtualWorld(playerid) == HouseInfo[i][hIntVW] && GetPlayerInterior(playerid) == HouseInfo[i][hIntIW])
{
hid = i;
break;
}
}
if(hid == -1) return SendClientMessageEx(playerid, COLOR_GREY, "You're not in a house that you own.");
new btype[7];
switch(PlayerInfo[playerid][pBackpack])
{
case 1: btype = "Small";
case 2: btype = "Medium";
case 3: btype = "Large";
}
format(string, sizeof(string), "You stored your %s Backpack in your house, use /bwear to wear it.", btype);
SendClientMessageEx(playerid, COLOR_GREY, string);
RemovePlayerAttachedObject(playerid, 9);
PlayerInfo[playerid][pBEquipped] = 0;
PlayerInfo[playerid][pBStoredH] = HouseInfo[hid][hSQLId];
format(string, sizeof(string), "* %s has stored a backpack in their house.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
format(string, sizeof(string), "[HOUSE] %s(%d) (%s) stored his %s backpack in [HouseID:%d]", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerIpEx(playerid), btype, hid);
Log("logs/backpack.log", string);
}
else return SendClientMessageEx(playerid, COLOR_GREY, "You don't own a house.");
}
else return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bstore [house/car]");
}
else return SendClientMessageEx(playerid, COLOR_GREY, "You do not own a backpack(Use /miscshop to get one with credits)");
return 1;
}
CMD:bopen(playerid, params[])
{
if(PlayerInfo[playerid][pBackpack] > 0)
{
if(dr_iPlayerTimeStamp[playerid] > gettime() - 60) return SendClientMessageEx(playerid, COLOR_GRAD1, "You have been injured in the last minute");
if(!IsBackpackAvailable(playerid)) {
SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
return 1;
}
new string[122];
if(GetPVarInt(playerid, "BackpackDisabled") > 0)
{
format(string, sizeof(string), "You have recently taken damage during the backpack menu, your backpack is disabled for %d second(s)", GetPVarInt(playerid, "BackpackDisabled"));
SendClientMessageEx(playerid, COLOR_GREY, string);
return 1;
}
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0, 1);
format(string, sizeof(string), "{FF8000}** {C2A2DA}%s lays down and opens a backpack.", GetPlayerNameEx(playerid));
SetPlayerChatBubble(playerid, string, COLOR_PURPLE, 15.0, 5000);
// ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPVarInt(playerid, "BackpackProt", 1);
SetPVarInt(playerid, "BackpackOpen", 1);
ShowBackpackMenu(playerid, DIALOG_OBACKPACK, "");
}
return 1;
}
CMD:backpackhelp(playerid, params[])
{
SetPVarInt(playerid, "HelpResultCat0", 2);
Help_ListCat(playerid, DIALOG_HELPCATOTHER1);
return 1;
}
CMD:obackpackhelp(playerid, params[]) {
szMiscArray[0] = 0;
format(szMiscArray, sizeof(szMiscArray), "Item: Small Backpack\nFood Storage: 1 Meals\nNarcotics Storage: 40 Grams\nFirearms Storage: 2 Weapons(Handguns only)\nCost: {FFD700}%s{A9C4E4}\n\n", number_format(ShopItems[36][sItemPrice]));
format(szMiscArray, sizeof(szMiscArray), "%sItem: Medium Backpack\nFood Storage: 4 Meals\nNarcotics Storage: 100 Grams\nFirearms Storage: 3 Weapons(2 Handguns & 1 Primary)\nCost: {FFD700}%s{A9C4E4}\n\n", szMiscArray, number_format(ShopItems[37][sItemPrice]));
format(szMiscArray, sizeof(szMiscArray), "%sItem: Large Backpack\nFood Storage: 5 Meals\nNarcotics Storage: 250 Grams\nFirearms Storage: 5 Weapons(2 Handguns & 3 Primary)\nCost: {FFD700}%s{A9C4E4}\n\n\n", szMiscArray, number_format(ShopItems[38][sItemPrice]));
format(szMiscArray, sizeof(szMiscArray), "%sCommands available: /bstore /bwear /bopen /sellbackpack /drop backpack (/miscshop to buy one with credits)", szMiscArray);
ShowPlayerDialogEx(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Backpack Information", szMiscArray, "Exit", "");
return 1;
}
Код:
/*
/$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
| $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
| $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
| $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
| $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
| $$\ $$$| $$ \ $$ | $$ \ $$| $$
| $$ \ $$| $$$$$$/ | $$ | $$| $$
|__/ \__/ \______/ |__/ |__/|__/
Point System (Re-done)
by Shane Roberts
Next Generation Gaming, LLC
(created by Next Generation Gaming Development Team)
* Copyright © 2016, Next Generation Gaming, LLC
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are not permitted in any case.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <YSI\y_hooks>
CMD:getmats(playerid, params[])
{
if(PlayerInfo[playerid][pJob] != 9 && PlayerInfo[playerid][pJob2] != 9 && PlayerInfo[playerid][pJob3] != 9 && PlayerInfo[playerid][pJob] != 18 && PlayerInfo[playerid][pJob2] != 18 && PlayerInfo[playerid][pJob3] != 18) return SendClientMessageEx(playerid,COLOR_GREY," You are not an Arms Dealer or Craftsman!");
if(CheckPointCheck(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "Please ensure that your current checkpoint is destroyed first (you either have material packages, or another existing checkpoint).");
new point, drank[64], vip = ((0 <= PlayerInfo[playerid][pDonateRank] < 5) ? PlayerInfo[playerid][pDonateRank] : 0);
switch(vip)
{
case 0: drank = "Non-VIP";
case 1: drank = "Bronze VIP";
case 2: drank = "Silver VIP";
case 3: drank = "Gold VIP";
case 4: drank = "Platinum VIP";
}
FetchPoint(playerid, point, (IsABoat(GetPlayerVehicleID(playerid)) ? 15.0 : 3.0));
if(point == -1) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not at a material point!");
if(DynPoints[point][poType] != 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "This point doesn't offer material runs!");
if(DynPoints[point][poAmount][vip] < 1) return SendClientMessageEx(playerid, COLOR_GRAD1, "There is no material amount set up for %s for this point!", drank);
if(DynPoints[point][poPos2][0] == 0.0 || DynPoints[point][poPos2][1] == 0.0) return SendClientMessageEx(playerid, COLOR_GRAD1, "The end delivery point hasn't been setup yet!");
if(DynPoints[point][poBoat] && !IsABoat(GetPlayerVehicleID(playerid))) return SendClientMessageEx(playerid, COLOR_GRAD1, "You need to be in a boat!");
if(vip == 0) {
if(GetPlayerCash(playerid) < 500) return SendClientMessageEx(playerid, COLOR_RED, "You cannot afford the $500 for the materials packages!");
GivePlayerCash(playerid, -500);
SendClientMessageEx(playerid, COLOR_WHITE, "You have purchased %s materials packages for $500", number_format(DynPoints[point][poAmount][vip]));
} else {
if(GetPlayerCash(playerid) < (500 * vip)) return SendClientMessageEx(playerid, COLOR_RED, "You cannot afford the $%s for the materials packages!", number_format((500 * vip)));
GivePlayerCash(playerid, -(500 * vip));
SendClientMessageEx(playerid, COLOR_WHITE, "You have purchased %s materials packages for $%s", number_format(DynPoints[point][poAmount][vip]), number_format((500 * vip)));
}
MatsAmount[playerid] = DynPoints[point][poAmount][vip];
if(vip > 0) SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "VIP: You have recieved more materials packages because of your %s.", drank);
MatDeliver[playerid] = point;
SetPVarInt(playerid, "tpMatRunTimer", 10);
SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_TPMATRUNTIMER);
if((0 <= DynPoints[point][poCaptureGroup] < MAX_GROUPS)) arrGroupData[DynPoints[point][poCaptureGroup]][g_iBudget] +=500;
SetPlayerCheckpoint(playerid, DynPoints[point][poPos2][0], DynPoints[point][poPos2][1], DynPoints[point][poPos2][2], 5);
return 1;
}
CMD:getdrugs(playerid, params[]) {
if(PlayerInfo[playerid][pJob] != 14 && PlayerInfo[playerid][pJob2] != 14 && PlayerInfo[playerid][pJob3] != 14 && !IsACriminal(playerid)) return SendClientMessageEx(playerid,COLOR_GREY," You are not a drug smuggler or in a family!");
if(CheckPointCheck(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "Please ensure that your current checkpoint is destroyed first (you either have material packages, or another existing checkpoint).");
new point, drank[64], vip = ((0 <= PlayerInfo[playerid][pDonateRank] < 5) ? PlayerInfo[playerid][pDonateRank] : 0), string[128];
switch(vip)
{
case 0: drank = "Non-VIP";
case 1: drank = "Bronze VIP";
case 2: drank = "Silver VIP";
case 3: drank = "Gold VIP";
case 4: drank = "Platinum VIP";
}
FetchPoint(playerid, point, (IsABoat(GetPlayerVehicleID(playerid)) ? 15.0 : 3.0));
if(point == -1) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not at a drug point!");
if(DynPoints[point][poType] < 1 || DynPoints[point][poType] > 4) return SendClientMessageEx(playerid, COLOR_GRAD1, "This point doesn't offer any drug runs! (TYPE: %d)", DynPoints[point][poType]);
if(DynPoints[point][poAmount][vip] < 1) return SendClientMessageEx(playerid, COLOR_GRAD1, "There is no material amount set up for %s for this point!", drank);
if(DynPoints[point][poPos2][0] == 0.0 || DynPoints[point][poPos2][1] == 0.0) return SendClientMessageEx(playerid, COLOR_GRAD1, "The end delivery point hasn't been setup yet!");
if(DynPoints[point][poBoat] && !IsABoat(GetPlayerVehicleID(playerid))) return SendClientMessageEx(playerid, COLOR_GRAD1, "You need to be in a boat!");
if(DynPoints[point][poType] == 1) { // Pot
if(GetPlayerMoney(playerid) < 2000) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot afford the $2,000!");
GivePlayerCashEx(playerid, TYPE_ONHAND, -2000);
SendClientMessageEx(playerid, COLOR_WHITE, "You have purchased %sg of pot packages for $2,000", number_format(DynPoints[point][poAmount][vip]));
}
if(DynPoints[point][poType] == 2) { // Crack
if(PlayerInfo[playerid][pDrugSmuggler] < 50) return SendClientMessageEx(playerid, COLOR_GRAD1, "You need to be at least level two drug smuggler to do this run!");
if(GetPlayerMoney(playerid) < 10000) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot afford the $10,000!");
GivePlayerCashEx(playerid, TYPE_ONHAND, -10000);
SendClientMessageEx(playerid, COLOR_WHITE, "You have purchased %sg of crack packages for $10,000!", number_format(DynPoints[point][poAmount][vip]));
}
if(DynPoints[point][poType] == 3) { // Meth
if(PlayerInfo[playerid][pDrugSmuggler] < 200) return SendClientMessageEx(playerid, COLOR_GRAD1, "You need to be at least level four drug smuggler to do this run!");
if(GetPlayerMoney(playerid) < 25000) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot afford the $25,000!");
GivePlayerCashEx(playerid, TYPE_ONHAND, -25000);
SendClientMessageEx(playerid, COLOR_WHITE, "You have purchased %sg of meth packages for $25,000!", number_format(DynPoints[point][poAmount][vip]));
}
if(DynPoints[point][poType] == 4) { // Ecstasy
if(PlayerInfo[playerid][pDrugSmuggler] < 400) return SendClientMessageEx(playerid, COLOR_GRAD1, "You need to be at least level five drug smuggler to do this run!");
if(GetPlayerMoney(playerid) < 50000) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot afford the $50,000!");
GivePlayerCashEx(playerid, TYPE_ONHAND, -50000);
SendClientMessageEx(playerid, COLOR_WHITE, "You have purchased %sg of ecstasy packages for $50,000!", number_format(DynPoints[point][poAmount][vip]));
}
format(string, sizeof(string), "* %s takes a drug package.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
MatsAmount[playerid] = DynPoints[point][poAmount][vip];
MatDeliver[playerid] = point;
if(vip > 0) SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "VIP: You have recieved more packages because of your %s.", drank);
SetPlayerCheckpoint(playerid, DynPoints[point][poPos2][0], DynPoints[point][poPos2][1], DynPoints[point][poPos2][2], 5);
SetPVarInt(playerid, "tpMatRunTimer", 10);
SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_TPMATRUNTIMER);
return 1;
}
CMD:pointtime(playerid, params[])
{
new point;
if(sscanf(params, "i", point)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /pointtime [pointid]");
if((1 <= point <= MAX_POINTS)) {
if(strcmp(DynPoints[point-1][poName], "NULL", true) == 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "This point hasn't officaly been setup yet!");
if(DynPoints[point-1][poCapturable] != 1) return SendClientMessageEx(playerid, COLOR_GRAD1, "%s is not ready for takeover.", DynPoints[point-1][poName]);
if(!DynPoints[point-1][poTimeLeft]) return SendClientMessageEx(playerid, COLOR_GRAD1, "%s is currently is not being captured!", DynPoints[point-1][poName]);
SendClientMessageEx(playerid, COLOR_YELLOW, "This point is currently being captured by: %s | Time left: %d minute(s)", arrGroupData[DynPoints[point-1][poCapperGroup]][g_szGroupName], DynPoints[point-1][poTimeLeft]);
} else {
SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid point ID given - You can only select from 1 - %d!", MAX_POINTS);
}
return 1;
}
CMD:gotodpoint(playerid, params[]) {
if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1) {
new pid;
if(sscanf(params, "d", pid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /gotodpoint [number]");
if((1 <= pid <= MAX_POINTS)) {
if(DynPoints[pid-1][poPos][0] == 0.0 || DynPoints[pid-1][poPos][1] == 0.0) return SendClientMessageEx(playerid, COLOR_GRAD1, "The selected point ID hasn't been setup!");
SetPlayerPos(playerid, DynPoints[pid-1][poPos][0], DynPoints[pid-1][poPos][1], DynPoints[pid-1][poPos][2]);
PlayerInfo[playerid][pInt] = DynPoints[pid-1][poInt];
SetPlayerInterior(playerid,DynPoints[pid-1][poInt]);
PlayerInfo[playerid][pVW] = DynPoints[pid-1][poVW];
SetPlayerVirtualWorld(playerid,DynPoints[pid-1][poVW]);
GameTextForPlayer(playerid, "~w~Teleporting", 5000, 1);
} else {
SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid point ID given - You can only select from 1 - %d!", MAX_POINTS);
}
}
return 1;
}
CMD:capture(playerid, params[])
{
new point, string[128];
if(!IsACriminal(playerid)) return SendClientMessageEx(playerid, COLOR_GRAD1, "You need to be apart of a criminal organization to do this!");
FetchPoint(playerid, point, 1.0);
if(point == -1) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not at a capture point!");
if(PlayerInfo[playerid][pRank] < arrGroupData[PlayerInfo[playerid][pMember]][g_iPointCapRank]) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not high rank enough to capture points!");
if(DynPoints[point][poLocked]) return SendClientMessageEx(playerid, COLOR_GRAD1, "This point is not available for capture!");
if(DynPoints[point][poCapturable] != 1) return SendClientMessageEx(playerid, COLOR_GRAD1, "This point is not ready to be taken over!");
if(DynPoints[point][poCapperGroup] == PlayerInfo[playerid][pMember]) return SendClientMessageEx(playerid, COLOR_GRAD1, "Your family is currently processing this take over!");
if(DynPoints[point][poCapping] != INVALID_PLAYER_ID) return SendClientMessageEx(playerid, COLOR_GRAD1, "Someone is currently starting the takeover for this point!");
if(GetPlayerPing(playerid) > 500) return SendClientMessageEx(playerid, COLOR_WHITE, "You can not capture with 500+ ping!");
format(string, sizeof(string), "%s is attempting to capture the point (VW: %d).", GetPlayerNameEx(playerid), DynPoints[point][poVW]);
ProxDetector(70.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
GetPlayerPos(playerid, DynPoints[point][CapturePos][0], DynPoints[point][CapturePos][1], DynPoints[point][CapturePos][2]);
DynPoints[point][poCapping] = playerid;
DynPoints[point][poTimeCapLeft] = 10;
SetTimerEx("ProgressTimer", 1000, 0, "d", point);
return 1;
}
forward ProgressTimer(id);
public ProgressTimer(id)
{
szMiscArray[0] = 0;
new Float: x, Float: y, Float: z;
if(DynPoints[id][poCapping] != INVALID_PLAYER_ID && IsPlayerConnected(DynPoints[id][poCapping])) {
if(--DynPoints[id][poTimeCapLeft] > 0) {
format(szMiscArray, sizeof(szMiscArray), "~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~%d seconds left", DynPoints[id][poTimeCapLeft]);
GameTextForPlayer(DynPoints[id][poCapping], szMiscArray, 1100, 3);
format(szMiscArray, sizeof(szMiscArray), "%s is attempting to capture the point, time left: %d", GetPlayerNameEx(DynPoints[id][poCapping]), DynPoints[id][poTimeCapLeft]);
UpdateDynamic3DTextLabelText(DynPoints[id][poTextID], COLOR_RED, szMiscArray);
SetTimerEx("ProgressTimer", 1000, 0, "d", id);
} else {
GetPlayerPos(DynPoints[id][poCapping], x, y, z);
if (DynPoints[id][CapturePos][0] != x || DynPoints[id][CapturePos][1] != y || DynPoints[id][CapturePos][2] != z || GetPVarInt(DynPoints[id][poCapping],"Injured") == 1) {
SendClientMessageEx(DynPoints[id][poCapping], COLOR_LIGHTBLUE, "You failed to capture. You either moved or died while attempting to capture.");
DynPoints[id][poCapping] = INVALID_PLAYER_ID;
DynPoints[id][poTimeCapLeft] = 0;
UpdatePoint(id);
return 1;
}
if(DynPoints[id][poCapturable] < 1)
{
SendClientMessageEx(DynPoints[id][poCapping], COLOR_LIGHTBLUE, "You failed to capture. The point was already captured.");
DynPoints[id][poCapping] = INVALID_PLAYER_ID;
DynPoints[id][poTimeCapLeft] = 0;
UpdatePoint(id);
return 1;
}
if(playerTabbed[DynPoints[id][poCapping]] != 0)
{
SendClientMessageEx(DynPoints[id][poCapping], COLOR_LIGHTBLUE, "You failed to capture. You were alt-tabbed.");
format(szMiscArray, sizeof(szMiscArray), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) may have possibly alt tabbed to capture a point.", GetPlayerNameEx(DynPoints[id][poCapping]), DynPoints[id][poCapping]);
ABroadCast( COLOR_YELLOW, szMiscArray, 2 );
DynPoints[id][poCapping] = INVALID_PLAYER_ID;
DynPoints[id][poTimeCapLeft] = 0;
UpdatePoint(id);
return 1;
}
if(GetPlayerVirtualWorld(DynPoints[id][poCapping]) != DynPoints[id][poVW] || GetPlayerInterior(DynPoints[id][poCapping]) != DynPoints[id][poInt])
{
SendClientMessageEx(DynPoints[id][poCapping], COLOR_LIGHTBLUE, "You failed to capture. You were not in the point virtual/interior world.");
format(szMiscArray, sizeof(szMiscArray), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) may have possibly desynced himself to capture a point.", GetPlayerNameEx(DynPoints[id][poCapping]), DynPoints[id][poCapping]);
ABroadCast( COLOR_YELLOW, szMiscArray, 2 );
DynPoints[id][poCapping] = INVALID_PLAYER_ID;
DynPoints[id][poTimeCapLeft] = 0;
UpdatePoint(id);
return 1;
}
if(!IsACriminal(DynPoints[id][poCapping])) {
SendClientMessageEx(DynPoints[id][poCapping], COLOR_LIGHTBLUE, "You failed to capture. You either left the group or were kicked!");
DynPoints[id][poCapping] = INVALID_PLAYER_ID;
DynPoints[id][poTimeCapLeft] = 0;
UpdatePoint(id);
return 1;
}
new fam = PlayerInfo[DynPoints[id][poCapping]][pMember];
DynPoints[id][poPName] = GetPlayerNameEx(DynPoints[id][poCapping]);
if(IsValidDynamicPickup(DynPoints[id][poPickupID])) DestroyDynamicPickup(DynPoints[id][poPickupID]);
DynPoints[id][poPickupID] = CreateDynamicPickup(1313, 23, DynPoints[id][poPos][0], DynPoints[id][poPos][1], DynPoints[id][poPos][2], .worldid = DynPoints[id][poVW], .interiorid = DynPoints[id][poInt]);
format(szMiscArray, sizeof(szMiscArray), "%s has attempted to take control of the %s for %s, it will be theirs in 10 minutes.", DynPoints[id][poPName], DynPoints[id][poName], arrGroupData[fam][g_szGroupName]);
SendClientMessageToAllEx(COLOR_YELLOW, szMiscArray);
UpdateDynamic3DTextLabelText(DynPoints[id][poTextID], COLOR_YELLOW, szMiscArray);
DynPoints[id][poCapping] = INVALID_PLAYER_ID;
DynPoints[id][poTimeCapLeft] = 0;
DynPoints[id][poCapperGroup] = fam;
DynPoints[id][poTimeLeft] = 10;
if(DynPoints[id][CapTimer] != 0) KillTimer(DynPoints[id][CapTimer]);
DynPoints[id][CapTimer] = SetTimerEx("CaptureTimer", 60000, 1, "d", id);
}
} else {
DynPoints[id][poCapping] = INVALID_PLAYER_ID;
DynPoints[id][poTimeCapLeft] = 0;
UpdatePoint(id);
}
return 1;
}
forward CaptureTimer(id);
public CaptureTimer(id)
{
szMiscArray[0] = 0;
if(--DynPoints[id][poTimeLeft] > 0) {
format(szMiscArray, sizeof(szMiscArray), "%s has successfully attempted to take over of %s for %s, it will be theirs in %d minutes!", DynPoints[id][poPName], DynPoints[id][poName], arrGroupData[DynPoints[id][poCapperGroup]][g_szGroupName], DynPoints[id][poTimeLeft]);
UpdateDynamic3DTextLabelText(DynPoints[id][poTextID], COLOR_YELLOW, szMiscArray);
} else {
format(szMiscArray, sizeof(szMiscArray), "%s has successfully taken control of the %s for %s.", DynPoints[id][poPName], DynPoints[id][poName], arrGroupData[DynPoints[id][poCapperGroup]][g_szGroupName]);
SendClientMessageToAllEx(COLOR_YELLOW, szMiscArray);
DynPoints[id][poCaptureGroup] = DynPoints[id][poCapperGroup];
DynPoints[id][poCapperGroup] = INVALID_GROUP_ID;
strmid(DynPoints[id][poCaptureName], DynPoints[id][poPName], 0, 32, 32);
DynPoints[id][poTimeLeft] = 0;
DynPoints[id][poCapturable] = 0;
DynPoints[id][poTimer] = 25;
KillTimer(DynPoints[id][CapTimer]);
DynPoints[id][CapTimer] = 0;
UpdatePoint(id);
SavePoint(id);
}
return 1;
}
stock FetchPoint(playerid, &point, Float:range)
{
point = -1;
for(new p = 0; p < MAX_POINTS; p++)
{
if(IsPlayerInRangeOfPoint(playerid,range,DynPoints[p][poPos][0], DynPoints[p][poPos][1], DynPoints[p][poPos][2]))
{
if(GetPlayerVirtualWorld(playerid) == DynPoints[p][poVW] && GetPlayerInterior(playerid) == DynPoints[p][poInt]) {
point = p;
}
break;
}
}
}
CMD:points(playerid, params[])
{
szMiscArray[0] = 0;
for(new i; i < MAX_POINTS; i++)
{
if(strcmp(DynPoints[i][poName], "NULL", true) != 0) {
if(DynPoints[i][poID] != 0)
{
if (DynPoints[i][poType] >= 0)
{
if(DynPoints[i][poLocked] != 1)
{
if((0 <= DynPoints[i][poCaptureGroup] < MAX_GROUPS)) {
format(szMiscArray, sizeof(szMiscArray), "Point ID: %d | Name: %s | Owner: %s | Captured By: %s | Hours: %d", DynPoints[i][poID], DynPoints[i][poName],arrGroupData[DynPoints[i][poCaptureGroup]][g_szGroupName],DynPoints[i][poCaptureName],DynPoints[i][poTimer]);
}
else {
format(szMiscArray, sizeof(szMiscArray), "Point ID: %d | Name: %s | Owner: Nobody | Captured By: Nobody | Hours: %d", DynPoints[i][poID], DynPoints[i][poName], DynPoints[i][poTimer]);
}
SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
}
}
}
}
}
return 1;
}
CMD:editpoint(playerid, params[])
{
if(PlayerInfo[playerid][pFactionModerator] >= 2 || PlayerInfo[playerid][pAdmin] >= 1337)
{
ListPoints(playerid);
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to preform this command.");
return 1;
}
ListPoints(playerid) {
new szDialogStr[MAX_POINTS * 25], i;
while(i < MAX_POINTS)
{
if(strcmp(DynPoints[i][poName], "NULL", true) != 0)
format(szDialogStr, sizeof szDialogStr, "%s\n(%i) %s{FFFFFF}", szDialogStr, i + 1, DynPoints[i][poName]);
else
format(szDialogStr, sizeof szDialogStr, "%s\n(%i) (empty)", szDialogStr, i + 1);
++i;
}
return ShowPlayerDialogEx(playerid, DIALOG_LISTPOINTS, DIALOG_STYLE_LIST, "Edit Points", szDialogStr, "Select", "Cancel");
}
hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
if(arrAntiCheat[playerid][ac_iFlags][AC_DIALOGSPOOFING] > 0) return 1;
new szDialogStr[1256];
switch(dialogid)
{
case DIALOG_LISTPOINTS:
{
if(!response) return 1;
switch(listitem)
{
case 0 .. MAX_POINTS:
{
SetPVarInt(playerid, "pEditingPoint", listitem);
format(szDialogStr, sizeof szDialogStr, "Name: %s\n\
Type: %s\n\
Edit Exterior/Interior Position\n\
Amount Per Hour (%s)\n\
Edit Delivery Packages\n\
Edit Capture Time\n\
Boat Run Only (%s)\n\
Locked (%s)\n\
Reset\n\
Delete", DynPoints[listitem][poName],
PointTypeToName(DynPoints[listitem][poType]),
number_format(DynPoints[listitem][poAmountHour]),
(DynPoints[listitem][poBoat]) ? ("Yes") : ("No"),
(DynPoints[listitem][poLocked]) ? ("Yes") : ("No")
);
ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT, DIALOG_STYLE_LIST, "Edit Points", szDialogStr, "Select", "Cancel");
}
}
}
case DIALOG_EDITPOINT:
{
if(!response) return 1;
szMiscArray[0] = 0;
switch(listitem)
{
case 0:
{
ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_NAME, DIALOG_STYLE_INPUT, "Edit Points - Name", "Please enter a new name for the point.", "Select", "Cancel");
}
case 1:
{
ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_TYPE, DIALOG_STYLE_LIST, "Edit Points - Type", "Materials\nPot\nCrack\nMeth\nEcstasy", "Select", "Cancel");
}
case 2:
{
ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_POSITION, DIALOG_STYLE_LIST, "Edit Points - Position", "Pickup Point\nDelivery Point", "Select", "Cancel");
}
case 3:
{
ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_MATERIALS, DIALOG_STYLE_INPUT, "Edit Points - Amount Per Hour", "Please enter the amount this point will give per hour to the owned group.", "Select", "Cancel");
}
case 4:
{
if(!response) return ResetDialog(playerid);
format(szDialogStr, sizeof szDialogStr, "Package Non-VIP (%s)\n\
Package Bronze VIP (%s)\n\
Package Silver VIP (%s)\n\
Package Gold VIP (%s)\n\
Package Platinum VIP (%s)",
number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][0]),
number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][1]),
number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][2]),
number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][3]),
number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][4])
);
ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_MATVIPLIST, DIALOG_STYLE_LIST, "Edit Points - Edit Delivery Packages", szDialogStr, "Select", "Cancel");
}
case 5:
{
ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_CAPTIME, DIALOG_STYLE_INPUT, "Edit Points - Capturable Timer", "Specify a time (hours) to when the point is allowed to be captured.\nSetting 0 will announce point is ready for capture!", "Select", "Cancel");
}
case 6:
{
switch(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poBoat])
{
case 0: DynPoints[GetPVarInt(playerid, "pEditingPoint")][poBoat] = 1;
case 1: DynPoints[GetPVarInt(playerid, "pEditingPoint")][poBoat] = 0;
}
ResetDialog(playerid);
SavePoint(GetPVarInt(playerid, "pEditingPoint"));
}
case 7:
{
switch(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poLocked])
{
case 0: DynPoints[GetPVarInt(playerid, "pEditingPoint")][poLocked] = 1;
case 1: DynPoints[GetPVarInt(playerid, "pEditingPoint")][poLocked] = 0;
}
UpdatePoint(GetPVarInt(playerid, "pEditingPoint"));
ResetDialog(playerid);
SavePoint(GetPVarInt(playerid, "pEditingPoint"));
}
case 8:
{
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poTimer] = 0;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poCapturable] = 1;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poCaptureGroup] = INVALID_GROUP_ID;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poTimeLeft] = 0;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poTimeCapLeft] = 0;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapturePos][0] = 0.00000;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapturePos][1] = 0.00000;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapturePos][2] = 0.00000;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poCapperGroup] = INVALID_GROUP_ID;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poCapping] = INVALID_PLAYER_ID;
format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPName], MAX_PLAYER_NAME, "No One");
if(DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapTimer] != 0) KillTimer(DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapTimer]);
DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapTimer] = 0;
SendClientMessageEx(playerid, COLOR_YELLOW, "You have reset %s's capture timer / group owner.", DynPoints[GetPVarInt(playerid, "pEditingPoint")][poName]);
UpdatePoint(GetPVarInt(playerid, "pEditingPoint"));
SavePoint(GetPVarInt(playerid, "pEditingPoint"));
ResetDialog(playerid);
}
case 9:
{
for(new p; p < 3; p++)
{
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPos][p] = 0.00000;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPos2][p] = 0.00000;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapturePos][p] = 0.00000;
}
for(new m; m < 5; m++)
{
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][m] = 0;
}
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poLocked] = 1;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmountHour] = 0;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poInt] = 0;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][po2Int] = 0;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poVW] = 0;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][po2VW] = 0;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poTimer] = 0;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poCapturable] = 1;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poCaptureGroup] = INVALID_GROUP_ID;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poTimeLeft] = 0;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poTimeCapLeft] = 0;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poCapperGroup] = INVALID_GROUP_ID;
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poCapping] = INVALID_PLAYER_ID;
format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPName], MAX_PLAYER_NAME, "No One");
if(DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapTimer] != 0) KillTimer(DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapTimer]);
DynPoints[GetPVarInt(playerid, "pEditingPoint")][CapTimer] = 0;
SendClientMessageEx(playerid, COLOR_YELLOW, "You have delete point: %s.", DynPoints[GetPVarInt(playerid, "pEditingPoint")][poName]);
format(szMiscArray, sizeof(szMiscArray), "%s has deleted point ID: %d", GetPlayerNameEx(playerid), GetPVarInt(playerid, "pEditingPoint"));
Log("logs/editpoint.log", szMiscArray);
format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poName], MAX_PLAYER_NAME, "NULL");
UpdatePoint(GetPVarInt(playerid, "pEditingPoint"));
SavePoint(GetPVarInt(playerid, "pEditingPoint"));
ResetDialog(playerid);
}
}
}
case DIALOG_EDITPOINT_NAME:
{
szMiscArray[0] = 0;
if(!response) return ResetDialog(playerid);
if(strlen(inputtext) > 24) return ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_NAME, DIALOG_STYLE_INPUT, "Edit Points - Name", "Please enter a new name for the point.\n\nPlease specify a name under 25 characters.", "Select", "Cancel");
strcpy(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poName], (isnull(inputtext) ? "NULL" : inputtext), 24);
format(szMiscArray, sizeof(szMiscArray), "%s has edited point %d's name to %s", GetPlayerNameEx(playerid), GetPVarInt(playerid, "pEditingPoint"), inputtext);
Log("logs/editpoint.log", szMiscArray);
ResetDialog(playerid);
UpdatePoint(GetPVarInt(playerid, "pEditingPoint"));
SavePoint(GetPVarInt(playerid, "pEditingPoint"));
}
case DIALOG_EDITPOINT_TYPE:
{
szMiscArray[0] = 0;
if(!response) return ResetDialog(playerid);
switch(listitem)
{
case 0 .. 4:
{
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poType] = listitem;
format(szMiscArray, sizeof(szMiscArray), "%s has edited point %d's type to %s.", GetPlayerNameEx(playerid), GetPVarInt(playerid, "pEditingPoint"), PointTypeToName(listitem));
Log("logs/editpoint.log", szMiscArray);
SendClientMessageEx(playerid, COLOR_YELLOW, "You have edited point %d's type to %s", GetPVarInt(playerid, "pEditingPoint"), PointTypeToName(listitem));
ResetDialog(playerid);
UpdatePoint(GetPVarInt(playerid, "pEditingPoint"));
SavePoint(GetPVarInt(playerid, "pEditingPoint"));
}
}
}
case DIALOG_EDITPOINT_POSITION:
{
new Float: pvPos[3];
GetPlayerPos(playerid, pvPos[0], pvPos[1], pvPos[2]);
if(!response) return ResetDialog(playerid);
switch(listitem)
{
case 0:
{
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPos][0] = pvPos[0];
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPos][1] = pvPos[1];
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPos][2] = pvPos[2];
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poVW] = GetPlayerVirtualWorld(playerid);
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poInt] = GetPlayerInterior(playerid);
SendClientMessageEx(playerid, COLOR_YELLOW, "You updated the points default location.");
SavePoint(GetPVarInt(playerid, "pEditingPoint"));
}
case 1:
{
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPos2][0] = pvPos[0];
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPos2][1] = pvPos[1];
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poPos2][2] = pvPos[2];
DynPoints[GetPVarInt(playerid, "pEditingPoint")][po2VW] = GetPlayerVirtualWorld(playerid);
DynPoints[GetPVarInt(playerid, "pEditingPoint")][po2Int] = GetPlayerInterior(playerid);
SendClientMessageEx(playerid, COLOR_YELLOW, "You updated the delivery destination for %s", DynPoints[GetPVarInt(playerid, "pEditingPoint")][poName]);
SavePoint(GetPVarInt(playerid, "pEditingPoint"));
}
}
UpdatePoint(GetPVarInt(playerid, "pEditingPoint"));
format(szMiscArray, sizeof(szMiscArray), "%s has edited point %d's position %d amount to X: %f, Y: %f, Z: %f, VW: %d", GetPlayerNameEx(playerid), GetPVarInt(playerid, "pEditingPoint"), listitem, pvPos[0], pvPos[0], pvPos[0], GetPlayerVirtualWorld(playerid));
Log("logs/editpoint.log", szMiscArray);
}
case DIALOG_EDITPOINT_MATERIALS:
{
szMiscArray[0] = 0;
if(!response) return ResetDialog(playerid);
if(!IsNumeric(inputtext) || strval(inputtext) < 0) return ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_MATERIALS, DIALOG_STYLE_INPUT, "Edit Points - Amount Per Hour", "Please enter the amount this point will give per hour to the owned group.\n\nPlease enter a numerical integer and is 0 or above.", "Select", "Cancel");
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmountHour] = strval(inputtext);
format(szMiscArray, sizeof(szMiscArray), "%s has edited point %d's per hour amount to %d", GetPlayerNameEx(playerid), GetPVarInt(playerid, "pEditingPoint"), inputtext);
Log("logs/editpoint.log", szMiscArray);
ResetDialog(playerid);
SavePoint(GetPVarInt(playerid, "pEditingPoint"));
}
case DIALOG_EDITPOINT_MATVIPLIST:
{
if(response) {
SetPVarInt(playerid, "pEditingVIPPoint", listitem);
ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_MATVIPSET, DIALOG_STYLE_INPUT, "Edit Points - Package", "Please enter an amount this package is to give to per delivery.", "Select", "Cancel");
} else {
ResetDialog(playerid);
}
}
case DIALOG_EDITPOINT_CAPTIME:
{
szMiscArray[0] = 0;
if(!response) return ResetDialog(playerid);
if(!IsNumeric(inputtext) || strval(inputtext) < 0) return ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_CAPTIME, DIALOG_STYLE_INPUT, "Edit Points - Capturable Timer", "Specify a time (hours) to when the point is allowed to be captured.\nSetting 0 will announce point is ready for capture!\n\nPlease enter a numerical integer and is 0 or above.", "Select", "Cancel");
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poCapturable] = (strval(inputtext) == 0 ? 1 : 0);
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poTimer] = strval(inputtext);
format(szMiscArray, sizeof(szMiscArray), "%s has edited point %d's capturable timer to %d", GetPlayerNameEx(playerid), GetPVarInt(playerid, "pEditingPoint"), inputtext);
Log("logs/editpoint.log", szMiscArray);
ResetDialog(playerid);
UpdatePoint(GetPVarInt(playerid, "pEditingPoint"));
SavePoint(GetPVarInt(playerid, "pEditingPoint"));
}
case DIALOG_EDITPOINT_MATVIPSET:
{
if(response) {
if(!IsNumeric(inputtext) || strval(inputtext) < 1) return ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_MATVIPSET, DIALOG_STYLE_INPUT, "Edit Points - Package", "Please enter an amount this package is to give to per delivery.\n\nPlease enter a numerical integer and is 0 or above.", "Select", "Cancel");
new drank[16];
szMiscArray[0] = 0;
switch(GetPVarInt(playerid, "pEditingVIPPoint"))
{
case 0: drank = "Non-VIP";
case 1: drank = "Bronze VIP";
case 2: drank = "Silver VIP";
case 3: drank = "Gold VIP";
case 4: drank = "Platinum VIP";
}
DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][GetPVarInt(playerid, "pEditingVIPPoint")] = strval(inputtext);
DeletePVar(playerid, "pEditingVIPPoint");
SavePoint(GetPVarInt(playerid, "pEditingPoint"));
SendClientMessageEx(playerid, COLOR_YELLOW, "You set %s to get %s per package delivery!", drank, number_format(strval(inputtext)));
format(szMiscArray, sizeof(szMiscArray), "%s has edited point %d's delivery package to %s for %s.", GetPlayerNameEx(playerid), GetPVarInt(playerid, "pEditingPoint"), number_format(strval(inputtext)), drank);
Log("logs/editpoint.log", szMiscArray);
format(szDialogStr, sizeof szDialogStr, "Package Non-VIP (%s)\n\
Package Bronze VIP (%s)\n\
Package Silver VIP (%s)\n\
Package Gold VIP (%s)\n\
Package Platinum VIP (%s)",
number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][0]),
number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][1]),
number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][2]),
number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][3]),
number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][4])
);
ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_MATVIPLIST, DIALOG_STYLE_LIST, "Edit Points - Edit Delivery Packages", szDialogStr, "Select", "Cancel");
} else {
format(szDialogStr, sizeof szDialogStr, "Package Non-VIP (%s)\n\
Package Bronze VIP (%s)\n\
Package Silver VIP (%s)\n\
Package Gold VIP (%s)\n\
Package Platinum VIP (%s)",
number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][0]),
number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][1]),
number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][2]),
number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][3]),
number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmount][4])
);
ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT_MATVIPLIST, DIALOG_STYLE_LIST, "Edit Points - Edit Delivery Packages", szDialogStr, "Select", "Cancel");
}
}
}
return 0;
}
stock ResetDialog(playerid) {
new szDialogStr[1256];
format(szDialogStr, sizeof szDialogStr, "Name: %s\n\
Type: %s\n\
Edit Exterior/Interior Position\n\
Amount Hour Hour (%s)\n\
Edit Delivery Packages\n\
Edit Capture Time\n\
Boat Run Only (%s)\n\
Locked (%s)\n\
Reset\n\
Delete", DynPoints[GetPVarInt(playerid, "pEditingPoint")][poName],
PointTypeToName(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poType]),
number_format(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poAmountHour]),
(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poBoat]) ? ("Yes") : ("No"),
(DynPoints[GetPVarInt(playerid, "pEditingPoint")][poLocked]) ? ("Yes") : ("No")
);
return ShowPlayerDialogEx(playerid, DIALOG_EDITPOINT, DIALOG_STYLE_LIST, "Edit Points", szDialogStr, "Select", "Cancel");
}
PointTypeToName(id)
{
new type[24];
switch(id)
{
case 0: format(type, 24, "Materials");
case 1: format(type, 24, "Pot");
case 2: format(type, 24, "Crack");
case 3: format(type, 24, "Meth");
case 4: format(type, 24, "Ecstasy");
}
return type;
}
stock SavePoint(point) {
new szQuery[2048];
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "UPDATE `dynpoints` SET \
`pointname` = '%e', \
`type` = %d, \
`posx` = %f, \
`posy` = %f, \
`posz` = %f, \
`pos2x` = %f, \
`pos2y` = %f, \
`pos2z` = %f, \
`vw` = %d, \
`int` = %d, \
`vw2` = %d, \
`int2` = %d, \
`boatonly` = %d, \
`capturename` = '%e', \
`capturegroup` = %d, \
`ready` = %d, \
`timer` = %d, \
`amounthour` = %d, \
`amount0` = %d, \
`amount1` = %d, \
`amount2` = %d, \
`amount3` = %d, \
`amount4` = %d, \
`locked` = %d WHERE `id` = %d",
DynPoints[point][poName],
DynPoints[point][poType],
DynPoints[point][poPos][0],
DynPoints[point][poPos][1],
DynPoints[point][poPos][2],
DynPoints[point][poPos2][0],
DynPoints[point][poPos2][1],
DynPoints[point][poPos2][2],
DynPoints[point][poVW],
DynPoints[point][poInt],
DynPoints[point][po2VW],
DynPoints[point][po2Int],
DynPoints[point][poBoat],
DynPoints[point][poCaptureName],
DynPoints[point][poCaptureGroup],
DynPoints[point][poCapturable],
DynPoints[point][poTimer],
DynPoints[point][poAmountHour],
DynPoints[point][poAmount][0],
DynPoints[point][poAmount][1],
DynPoints[point][poAmount][2],
DynPoints[point][poAmount][3],
DynPoints[point][poAmount][4],
DynPoints[point][poLocked],
point + 1);
mysql_tquery(MainPipeline, szQuery, "OnQueryFinish", "i", SENDDATA_THREAD);
}
stock UpdatePoint(id)
{
new string[256];
if(IsValidDynamicPickup(DynPoints[id][poPickupID])) DestroyDynamicPickup(DynPoints[id][poPickupID]);
if(IsValidDynamic3DTextLabel(DynPoints[id][poTextID])) DestroyDynamic3DTextLabel(DynPoints[id][poTextID]);
if(DynPoints[id][poPos][0] == 0.0) return 1;
DynPoints[id][poPickupID] = CreateDynamicPickup(((DynPoints[id][poType] == 1) ? 1279 : (DynPoints[id][poType] == 2 || DynPoints[id][poType] == 3 || DynPoints[id][poType] == 4) ? 1241 : 1239), 23, DynPoints[id][poPos][0], DynPoints[id][poPos][1], DynPoints[id][poPos][2], .worldid = DynPoints[id][poVW], .interiorid = DynPoints[id][poInt]);
switch(DynPoints[id][poType])
{
case 0: format(string, sizeof(string), "Materials Pickup (ID: %d)\nType /getmats to get materials.", DynPoints[id][poID]);
case 1: format(string, sizeof(string), "Pot Pickup (ID: %d)\nType /getdrugs to get pot.", DynPoints[id][poID]);
case 2: format(string, sizeof(string), "Crack Pickup (ID: %d)\nType /getdrugs to get crack.", DynPoints[id][poID]);
case 3: format(string, sizeof(string), "Meth Pickup (ID: %d)\nType /getdrugs to get meth.", DynPoints[id][poID]);
case 4: format(string, sizeof(string), "Ecstasy Pickup (ID: %d)\nType /getdrugs to get ecstasy.", DynPoints[id][poID]);
}
if(DynPoints[id][poCapturable] && !DynPoints[id][poLocked]) {
format(string, sizeof(string), "%s\n%s has become available for capture! Stand here and /capture it.", string, DynPoints[id][poName]);
}
DynPoints[id][poTextID] = CreateDynamic3DTextLabel(string, COLOR_YELLOW, DynPoints[id][poPos][0], DynPoints[id][poPos][1], DynPoints[id][poPos][2]+0.6, 10.0, .testlos = 1, .worldid = DynPoints[id][poVW], .interiorid = DynPoints[id][poInt], .streamdistance = 10.0);
return 1;
}
stock LoadPoints()
{
printf("[Dynamic Points] Loading Dynamic Points from the database, please wait...");
mysql_tquery(MainPipeline, "SELECT * FROM `dynpoints`", "OnLoadPoints", "");
}
forward OnLoadPoints();
public OnLoadPoints()
{
new i, rows, szField[24];
cache_get_row_count(rows);
while(i < rows)
{
cache_get_value_name(i, "pointname", DynPoints[i][poName], MAX_PLAYER_NAME);
cache_get_value_name_int(i, "type", DynPoints[i][poType]);
cache_get_value_name_int(i, "id", DynPoints[i][poID]);
cache_get_value_name_float(i, "posx", DynPoints[i][poPos][0]);
cache_get_value_name_float(i, "posy", DynPoints[i][poPos][1]);
cache_get_value_name_float(i, "posz", DynPoints[i][poPos][2]);
cache_get_value_name_float(i, "pos2x", DynPoints[i][poPos2][0]);
cache_get_value_name_float(i, "pos2y", DynPoints[i][poPos2][1]);
cache_get_value_name_float(i, "pos2z", DynPoints[i][poPos2][2]);
cache_get_value_name_int(i, "vw", DynPoints[i][poVW]);
cache_get_value_name_int(i, "int", DynPoints[i][poInt]);
cache_get_value_name_int(i, "vw2", DynPoints[i][po2VW]);
cache_get_value_name_int(i, "int2", DynPoints[i][po2Int]);
cache_get_value_name_int(i, "boatonly", DynPoints[i][poBoat]);
cache_get_value_name(i, "capturename", DynPoints[i][poCaptureName], MAX_PLAYER_NAME);
cache_get_value_name_int(i, "capturegroup", DynPoints[i][poCaptureGroup]);
cache_get_value_name_int(i, "ready", DynPoints[i][poCapturable]);
cache_get_value_name_int(i, "timer", DynPoints[i][poTimer]);
cache_get_value_name_int(i, "amounthour", DynPoints[i][poAmountHour]);
for(new m; m < 5; m++)
{
format(szField, sizeof(szField), "amount%d", m);
cache_get_value_name_int(i, szField, DynPoints[i][poAmount][m]);
}
cache_get_value_name_int(i, "locked", DynPoints[i][poLocked]);
// Ensure our non-loaded data has something.
DynPoints[i][poTimeLeft] = 0; // 10 minute timer
DynPoints[i][poTimeCapLeft] = 0; // 10 second timer
DynPoints[i][CapturePos][0] = 0.00000;
DynPoints[i][CapturePos][1] = 0.00000;
DynPoints[i][CapturePos][2] = 0.00000;
DynPoints[i][poCapperGroup] = INVALID_GROUP_ID;
DynPoints[i][poCapping] = INVALID_PLAYER_ID;
format(DynPoints[i][poPName], MAX_PLAYER_NAME, "No One");
DynPoints[i][CapTimer] = 0;
UpdatePoint(i);
i++;
}
if(i > 0) printf("[Dynamic Points] %d dynamic points has been loaded.", i);
else printf("[Dynamic Points] No dynamic points has been loaded.");
return 1;
}