Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#include <streamer>
#include <dini>
#include <zcmd>
#include <sscanf>
#define MAX_SHOP 10000
#define red 0xFF0000FF
#define orange 0xFF9900AA
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
LoadStores();
return 1;
}
public OnFilterScriptExit()
{
UnloadStores();
return 1;
}
#endif
new file[128],ShopCP[MAX_SHOP],Float:X,Float:Y,Float:Z,str[128],shopid;
CMD:createshop(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
if(sscanf(params,"i",shopid)) return SendClientMessage(playerid,orange,"USAGE /createshop [ID]");
GetPlayerPos(playerid,X,Y,Z);
format(str,sizeof(str),"Shop ID %d Created",shopid);
SendClientMessage(playerid,orange,str);
format(file,sizeof(file),"shop/%i.ini",shopid);
if(!dini_Exists(Shops))
{
dini_Create(Shops);
}
dini_FloatSet(file,"CPMenuX",X);
dini_FloatSet(file,"CPMenuY",Y);
dini_FloatSet(file,"CPMenuZ",Z);
ShopCP[shopid] = CreateDynamicCP(Float:X,Float:Y,Float:Z,2.0,-1,-1,-1,100.0);
return 1;
}
stock LoadStores()
{
new shopcount;
format(file, sizeof(file), "shop/%i.ini",shopid);
if(dini_Exists(file))
{
ShopCP[shopid] = CreateDynamicCP(dini_Float(file,"CPMenuX"),dini_Float(file,"CPMenuY"),dini_Float(file,"CPMenuZ"),2.0,-1,-1,-1,100.0); // Bank Menu CP
shopcount++;
}
}
stock UnloadStores()
{
DestroyDynamicCP(ShopCP[shopid]);
}
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
format(file, sizeof(file), "shop/%i.ini", shopid);
if(checkpointid == ShopCP[shopid])
{
ShowPlayerDialog(playerid,1000,DIALOG_STYLE_LIST,"Skin","23","Buy","Cancel");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1000)
{
if(response)
{
if(listitem == 0)
{
if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid,red,"ERROR: You don't have enough money!");
SetPlayerSkin(playerid,23);
SendClientMessage(playerid,orange,"You have buy that skin for $1000");
GivePlayerMoney(playerid,-1000);
}
}
}
return 1;
}
UNTESTED but should work but i dont know just give it a try if i helped click my star thing and give me rep please