I'm gonna release my first filescript. It's Simple Weapon Shop.
pawn Код:
//Weapon Shop by BodyBoardVEVO
#include <a_samp>
#if defined FILTERSCRIPT
#define WEAPONS 2222
#endif
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/w", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, 2222, DIALOG_STYLE_LIST, "Weapon Shop", "Health - $1000\nArmour - $2000\n9mm - $2500\nSilence Pistol - $3000\nDesert Eagle - $3500\nShotgun - $5000\nSawn-Off Shotgun - $8000\nCombat Shotgun - $6500\nMicro SMG - $5000\nMP5 - $5500\nTec-9 - $5000\nAK-47 - $10500\nM4 - $10000\nCountry Rifle - $12000\nSniper Rifle - $12000", "Purchase", "Cancel");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 2222)
{
if(response)
{
if(listitem == 0)
{
GivePlayerMoney(playerid, -1000);
SetPlayerHealth(playerid, 100); //Health
}
if(listitem == 1)
{
GivePlayerMoney(playerid, -2000);
SetPlayerArmour(playerid, 100); //Armour
}
if(listitem == 2)
{
GivePlayerMoney(playerid, -2500);
GivePlayerWeapon(playerid, 22, 250); //9mm
}
if(listitem == 3)
{
GivePlayerMoney(playerid, -3000);
GivePlayerWeapon(playerid, 23, 250); //Silence Pistol
}
if(listitem == 4)
{
GivePlayerMoney(playerid, -3500);
GivePlayerWeapon(playerid, 24, 250); //Desert Eagle
}
if(listitem == 5)
{
GivePlayerMoney(playerid, -5000);
GivePlayerWeapon(playerid, 25, 250); //Shotgun
}
if(listitem == 6)
{
GivePlayerMoney(playerid, -8000);
GivePlayerWeapon(playerid, 26, 250); //Sawn-off
}
if(listitem == 7)
{
GivePlayerMoney(playerid, -6500);
GivePlayerWeapon(playerid, 27, 250); //Combat Shotgun
}
if(listitem == 8)
{
GivePlayerMoney(playerid, -5000);
GivePlayerWeapon(playerid, 28, 250); //Micro SMG
}
if(listitem == 9)
{
GivePlayerMoney(playerid, -5500);
GivePlayerWeapon(playerid, 29, 250); //MP5
}
if(listitem == 10)
{
GivePlayerMoney(playerid, -5000);
GivePlayerWeapon(playerid, 32, 250); //Tec-9
}
if(listitem == 11)
{
GivePlayerMoney(playerid, -10500);
GivePlayerWeapon(playerid, 30, 250); //AK-47
}
if(listitem == 12)
{
GivePlayerMoney(playerid, -10000);
GivePlayerWeapon(playerid, 31, 250); //M4
}
if(listitem == 13)
{
GivePlayerMoney(playerid, -12000);
GivePlayerWeapon(playerid, 33, 250); //Country Rifle
}
if(listitem == 14)
{
GivePlayerMoney(playerid, -12000);
GivePlayerWeapon(playerid, 34, 250); //Sniper Rifle
}
}
return 1;
}
return 1;
}
Good but in your next FS, think of strange scenarios like when the player does not have the money for it or when the player is in the class selection, it will block the command for him
You forgot to add command in your detail. I mean this "/w" i know but some peoples don't know.
Hope you understand.
It's weapon shop...