22.01.2014, 22:52
backspace to weapon shop
What is the code how to do it
What is the code how to do it
PHP код:
#include <a_samp>
#define FILTERSCRIPT
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xFFFFFF
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Commands By DAVI$");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/shop", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, 20320, DIALOG_STYLE_LIST, "Weapon Shop", "MachineGuns\nRifles\nShotguns&Pistols", "Select", "Exit");
return 1;
}
if (strcmp("/credits", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, COLOR_RED, "1-All Copyrights related©: Davi$");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 20320 && response)
{
switch(listitem)
{
case 0:
{
ShowPlayerDialog(playerid, 20321, DIALOG_STYLE_LIST, "Weapon Shop [MachineGuns]", "Tec9 (1000$)\nMicroSMG (1500$)\nSMG (2000$) ", "Buy", "Cancel");
}
case 1:
{
ShowPlayerDialog(playerid, 20322, DIALOG_STYLE_LIST, "Weapon Shop [Rifles]", "AK47 (3500$)\nM4(3500$)\nSniperRifle(4000$)\nCountryRifle(2500$)", "Buy", "Cancel");
}
case 2:
{
ShowPlayerDialog(playerid, 20323, DIALOG_STYLE_LIST, "Weapon Shop [ShotGuns&Pistols]", "9mm(1000$)\nSilenced 9mm(1500$)\nDesert Eagle(2000$)\nSawnOff ShotGun(2000$)\nCombat Shotgun(2500$)\nShotGun(1500$)", "Buy", "Cancel");
}
}
}
if(dialogid == 20321 && response)
{
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -1000);
GivePlayerWeapon(playerid, 32 ,500);
SendClientMessage(playerid,0x33AA33AA,"WeaponShop:Congratulations You have bought Tec9");
}
case 1:
{
if(GetPlayerMoney(playerid) < 1500) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -1500);
GivePlayerWeapon(playerid, 28,500);
SendClientMessage(playerid,0x33AA33AA,"WeaponShop:Congratulations You have bought MicroSMG");
}
case 2:
{
if(GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -2000);
GivePlayerWeapon(playerid, 29,500);
SendClientMessage(playerid,0x33AA33AA,"WeaponShop:Congratulations you have bought SMG");
}
}
}
if(dialogid == 20322 && response)
{
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) < 3500) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -3500);
GivePlayerWeapon(playerid, 30,500);
SendClientMessage(playerid,0x33AA33AA,"WeaponShop:Congratulations You have bought AK47");
}
case 1:
{
if(GetPlayerMoney(playerid) < 3500) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -3500);
GivePlayerWeapon(playerid, 31,500);
SendClientMessage(playerid,0x33AA33AA,"WeaponShop:Congratulations You have bought M4");
}
case 2:
{
if(GetPlayerMoney(playerid) < 4000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -4000);
GivePlayerWeapon(playerid, 34,500);
SendClientMessage(playerid,0x33AA33AA,"WeaponShop:Congratulations you have bought Sniper-Rifle");
}
case 3:
{
if(GetPlayerMoney(playerid) < 2500) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -2500);
GivePlayerWeapon(playerid, 33,500);
SendClientMessage(playerid,0x33AA33AA,"Weaponshop:Congratulations you have bought a Country-Rifle");
}
}
}
if(dialogid == 20323 && response)
{
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -1000);
GivePlayerWeapon(playerid, 22,500);
SendClientMessage(playerid,0x33AA33AA,"Weaponshop:Congratulations! you have bought a 9mm");
}
case 1:
{
if(GetPlayerMoney(playerid) < 1500) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -1500);
GivePlayerWeapon(playerid, 23,500);
SendClientMessage(playerid,0x33AA33AA, "Weaponshop:Congratulations! You have bought a Silenced pistol");
}
case 2:
{
if(GetPlayerMoney(playerid) < 4000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -4000);
GivePlayerWeapon(playerid, 24,500);
SendClientMessage(playerid,0x33AA33AA, "Weaponshop:Congratulations! you have bought a Desert-eagle");
}
case 3:
{
if(GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -2000);
GivePlayerWeapon(playerid, 26,500);
SendClientMessage(playerid,0x33AA33AA, "Weaponshop:Congratulations! you have bought a Sawn-Off Shotgun");
}
case 4:
{
if(GetPlayerMoney(playerid) < 2500) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -2500);
GivePlayerWeapon(playerid, 27,500);
SendClientMessage(playerid,0x33AA33AA,"Weaponshop:Congratulations! you have bough a combact-shotgun");
}
case 5:
{
if(GetPlayerMoney(playerid) < 1500) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -1500);
GivePlayerWeapon(playerid, 26,500);
SendClientMessage(playerid,0x33AA33AA,"Weaponshop:Congratulations! you have bought a shotgun");
}
}
}
return 1;
}
public OnPlayerConnect(playerid)
{
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"%s has joined the Server!",pName);
SendClientMessageToAll(0xFFFFFFAA,string);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
switch(reason)
{
case 0: format(string, sizeof(string), "%s has left the server. (Timedout)", pname);
case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", pname);
case 2: format(string, sizeof(string), "%s has left the server. (Kicked-/-Banned)", pname);
}
SendClientMessageToAll(0xAAAAAAAA, string);
return 1;
}