Код:
//Tutriol By Jimmy Made by NoFeAr
/************************************
| NoFeAr |
| Briefcase system |
| |
************************************/
#include <a_samp>
#define COLOR_WHITE 0xFFFFFFFF
#define MAX_BRIEF_CASE 20
static BriefCases[MAX_BRIEF_CASE] = { -1, ... };
stock CreateBriefCase(Float:x, Float:y, Float:z)
{
for(new i = 0; i < MAX_BRIEF_CASE; i++)
{
if(BriefCases[i] == -1)
{
BriefCases[i] = CreatePickup(1210, 1, 223.9407, 1860.5116, 13.1470, 0);
// Success return index
return i;
}
}
// Failed
return -1;
}
// Deleted a briefcase
stock DeleteBriefCase(index)
{
if(index >= 0 && index < MAX_BRIEF_CASE && BriefCases[index] != -1)
{
DestroyPickup(BriefCases[index]);
BriefCases[index] = -1;
return 1;
}
return 0;
}
// Check if a pickupid is a briefcase
stock IsBriefCase(pickupid)
{
for(new i = 0; i < MAX_BRIEF_CASE; i++)
{
if(BriefCases[i] != -1)
{
// return the index where the briefcase was found
if(BriefCases[i] == pickupid) return i;
}
}
return -1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == BriefCases[i])
{
ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 777)
{
if(response)
{
if(listitem ==0)
{
if (GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You don't have enough cash.") && ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
SetPlayerHealth(playerid, 100.0);
SendClientMessage(playerid, COLOR_WHITE, "You bought Health for $5000!");
}
if(listitem ==1)
{
if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You don't have enough cash.") && ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerMoney(playerid, -5000);
ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
SetPlayerArmour(playerid, 100.0);
SendClientMessage(playerid, COLOR_WHITE, "You bought Armour for $5000!");
}
if(listitem ==2)
{
ShowPlayerDialog(playerid, 888, DIALOG_STYLE_LIST, "Weapons", "M4 - 6000$\nAK47 - 6000$\nMP5 - 5000$\nUZI - 10000$\nCombat Shotgun - 10000$\nShotgun - 5000$\nDesert Eagle - 7000$\nSilent Pistol - 3000$\nSniper-8000$\nTec 9 - 3000$\nSawn-Off Shotgun - 8000$\nRPG - 10000$", "Buy", "Exit");
}
}
}
if(dialogid ==888)
{
if(response)
{
if(listitem==0)
{
if(GetPlayerMoney(playerid) < 6000) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You don't have enough cash.") && ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerMoney(playerid, -6000);
GivePlayerWeapon(playerid, 31, 300);
ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
SendClientMessage(playerid,COLOR_WHITE, "You bought M4 with 300 Ammo.");
}
if(listitem==1)
{
if(GetPlayerMoney(playerid) < 6000) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You don't have enough cash.") && ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerMoney(playerid, -6000);
ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerWeapon(playerid, 30, 300);
SendClientMessage(playerid, COLOR_WHITE, "You bought AK 47 with 300 Ammo.");
}
if(listitem==2)
{
if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You don't have enough cash.") && ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerMoney(playerid, -5000);
GivePlayerWeapon(playerid, 29, 300);
SendClientMessage(playerid, COLOR_WHITE, "You bought MP5 with 300 Ammo.");
}
if(listitem==3)
{
if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You don't have enough cash.") && ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerMoney(playerid, -10000);
ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerWeapon(playerid, 28, 500);
SendClientMessage(playerid, COLOR_WHITE, "You bought UZI with 300 Ammo.");
}
if(listitem==4)
{
if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You don't have enough cash.") && ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerMoney(playerid, -10000);
ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerWeapon(playerid, 27, 300);
SendClientMessage(playerid, COLOR_WHITE, "You bought SPAZ12 with 300 Ammo.");
}
if(listitem==5)
{
if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You don't have enough cash.") && ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerMoney(playerid, -5000);
ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerWeapon(playerid, 25, 300);
SendClientMessage(playerid, COLOR_WHITE, "You bought Shotgun with 300 Ammo.");
}
if(listitem==6)
{
if(GetPlayerMoney(playerid) < 7000) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You don't have enough cash.") && ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerMoney(playerid, -7000);
ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerWeapon(playerid, 24, 100);
SendClientMessage(playerid, COLOR_WHITE, "You bought Desert Eagle with 100 Ammo.");
}
if(listitem==7)
{
if(GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You don't have enough cash.") && ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerMoney(playerid, -3000);
ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerWeapon(playerid, 23, 300);
SendClientMessage(playerid, COLOR_WHITE, "You bought Silencer with 300 Ammo.");
}
if(listitem==8)
{
if(GetPlayerMoney(playerid) < 8000) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You don't have enough cash.") && ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerMoney(playerid, -8000);
ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerWeapon(playerid, 34,100);
SendClientMessage(playerid, COLOR_WHITE, "You bought Sniper with 100 Ammo.");
}
if(listitem==9)
{
if(GetPlayerMoney(playerid) < 3000) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You don't have enough cash.") && ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerMoney(playerid, -3000);
ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerWeapon(playerid, 32, 300);
SendClientMessage(playerid, COLOR_WHITE, "You bought Tec 9 with 300 Ammo.");
}
if(listitem==10)
{
if(GetPlayerMoney(playerid) < 8000) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You don't have enough cash.") && ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerMoney(playerid, -8000);
GivePlayerWeapon(playerid, 26, 100);
SendClientMessage(playerid, COLOR_WHITE, "You bought Sawn off Shotgun with 100 Ammo.");
}
if(listitem==11)
{
if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You don't have enough cash.") && ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerMoney(playerid, -10000);
ShowPlayerDialog(playerid, 777, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5000$\n\nWeapons", "Select", "Cancel");
GivePlayerWeapon(playerid, 35, 1);
SendClientMessage(playerid, COLOR_WHITE, "You bought RPG with 1 Ammo.");
}
}
}
return 1;
}