I downloaded this this weapon shop FS by L3th4l and edited it a little bit but i dosent work has anyone an idea why?
Код:
#include <a_samp>
#include <zcmd>
#include <streamer>
#include <JunkBusterFS>
native sscanf(const data[], const format[], {Float,_}:...);
native unformat(const data[], const format[], {Float,_}:...) = sscanf;
#define COLOR_RED 0xFF0000FF
#define COLOR_LIGHTBLUE 0xADD8E6FF
#define MAX_WEAPMENUS 20
#define DIALOG_WEAPMENU 9250
#define WEAP_MENU_FILE "WeapMenus.cfg"
#define WEAPPICKUPID 1318 // Skull
enum WMINFO
{
wID,
Float:wX,
Float:wY,
Float:wZ
}
new
wInfo[MAX_WEAPMENUS][WMINFO],
wMCreated = 0;
public OnFilterScriptInit()
{
print("\nDynamic Weapon Shop By: [L3th4l] Loaded!\n");
CreateWShops();
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
CMD:weapmenu(playerid, params[])
{
new
Float:Pos[3],
File:wMenu,
wString[70];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
wMCreated++;
wInfo[wMCreated][wID] = CreateDynamicPickup(WEAPPICKUPID, 2, Pos[0], Pos[1], Pos[2], -1, -1, -1, 100.0);
if(wMCreated > MAX_WEAPMENUS) return SendClientMessage(playerid, COLOR_RED, "The weapon menu limit has been reached! Please update it!");
wInfo[wMCreated][wX] = Pos[0];
wInfo[wMCreated][wY] = Pos[1];
wInfo[wMCreated][wZ] = Pos[2];
format(wString, sizeof(wString), "%f\t|%f\t|%f\r\n", Pos[0], Pos[1], Pos[2]);
wMenu = fopen(WEAP_MENU_FILE, io_append);
fwrite(wMenu, wString);
fclose(wMenu);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You've created a new weapon menu!");
return 1;
}
stock CreateWShops()
{
new
File:wFile,
Float:wPos[3],
Line[50];
wFile = fopen(WEAP_MENU_FILE, io_read);
while(fread(wFile, Line))
{
sscanf(Line, "p<|>fff", wPos[0], wPos[1], wPos[2]);
wMCreated++;
wInfo[wMCreated][wX] = wPos[0];
wInfo[wMCreated][wY] = wPos[1];
wInfo[wMCreated][wZ] = wPos[2];
wInfo[wMCreated][wID] = wMCreated;
wMCreated = CreateDynamicPickup(WEAPPICKUPID, 2, wPos[0], wPos[1], wPos[2], -1, -1, -1, 100.0);
}
fclose(wFile);
printf("** %i\t<->\tWeapon Menus loaded from\t<->\t"#WEAP_MENU_FILE"\t **", wMCreated);
}
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
for(new i = 0; i < MAX_WEAPMENUS; ++i)
{
if(pickupid == wInfo[i][wID])
{
DialogWeapMenu(playerid);
}
}
return 1;
}
stock DialogWeapMenu(playerid)
{
ShowPlayerDialog(playerid, DIALOG_WEAPMENU, DIALOG_STYLE_LIST, "Weapon Menu", "Deagle:\t\t$2,000\nShotgun:\t$5,000\nCombat Shotgun:\t$10,000\nAK-47:\t$12,000\nM4:\t$15,000\nArmour:\t$7,000\nFull Health:\t$7,000", "Purchase", "Cancel");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_WEAPMENU)
{
if(response)
{
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash to purchase this weapon!");
GivePlayerWeapon(playerid, 24, 100);
GivePlayerMoney(playerid, - 2000);
SendClientMessage(playerid, COLOR_RED, "You bought a Deagle for $2000");
}
case 1:
{
if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash to purchase this weapon!");
GivePlayerWeapon(playerid, 25, 100);
GivePlayerMoney(playerid, - 5000);
SendClientMessage(playerid, COLOR_RED, "You bought a Shotgun for $5000");
}
case 2:
{
if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash to purchase this weapon!");
GivePlayerWeapon(playerid, 27, 100);
GivePlayerMoney(playerid, - 10000);
SendClientMessage(playerid, COLOR_RED, "You bought a Combat Shotgun for $10000");
}
case 3:
{
if(GetPlayerMoney(playerid) < 12000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash to purchase this weapon!");
GivePlayerWeapon(playerid, 30, 100);
GivePlayerMoney(playerid, - 12000);
SendClientMessage(playerid, COLOR_RED, "You bought a AK-47 for $12000");
}
case 4:
{
if(GetPlayerMoney(playerid) < 15000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash to purchase this weapon!");
GivePlayerWeapon(playerid, 31, 100);
GivePlayerMoney(playerid, - 15000);
SendClientMessage(playerid, COLOR_RED, "You bought a M4 for $15000");
}
case 5:
{
if(GetPlayerMoney(playerid) < 7000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash to purchase this weapon!");
SetPlayerArmour(playerid, 100.0);
GivePlayerMoney(playerid, - 7000);
SendClientMessage(playerid, COLOR_RED, "You bought an Armour for $7000");
}
case 6:
{
if(GetPlayerMoney(playerid) < 7000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash to purchase this weapon!");
SetPlayerHealth(playerid, 100.0);
GivePlayerMoney(playerid, - 7000);
SendClientMessage(playerid, COLOR_RED, "You bought full Health for $7000");
}
}
}
else SendClientMessage(playerid, COLOR_RED, "You've closed the weapon menu!");
}
return 1;
}