С помощью этого скрипта, игроки могут купить оружие стоя в любом месте карты, используя команду /store.
Код: Выделить всё
/* Filter Script made by Fred
Do not remove this
For any help pm me on forum.sa-mp.com, my name is Fred1993
*/
#include <a_samp>
public OnFilterScriptInit() // This is where filter script starts
{
print("\n--------------------------------------");
print(" Store Filterscript by Fred");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
enum StoreInfo { // enums used for the stores
Sid,
Sname[256],
Smoney,
};
new Stores[][StoreInfo] = { // variables using enums(Sid, Sname, Smoney)
{30 ,"AK-47" ,3000},
{31 ,"M4" , 4000},
{24 ,"Deagle" , 2000}
};
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/store", cmdtext, true, 10) == 0)
{
new tmsg[2500];
new msg[256];
for(new i=0;i<sizeof(Stores);i++) // for loop
{
format(msg,sizeof(msg),"%s - $%d\n",Stores[i][Sname],Stores[i][Smoney]); // Storing String of gun name and gun money in "msg"
strcat(tmsg,msg,sizeof(tmsg)); // conatinating tmsg and msg
}
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Store Menu",tmsg,"Buy", "Cancel");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) // this is where dialog box response
{
if(dialogid == 1) // 1 is the dialogbox id
{
if(response)
{
if(listitem >= 0 && listitem <sizeof(Stores))
{
GivePlayerWeapon(playerid, Stores[listitem][Sid], 400);
GivePlayerMoney(playerid, -(Stores[listitem][Smoney]));
SendClientMessage(playerid, -1, "Successfully Bought"); // -1 is white color..
}
}
return 1;
}
return 0;
}
P.S Не переведён на русский язык