25.09.2015, 16:12
Hi guys! Recently I've installed a new command in my GM. When I start the SV everything it's ok, the login/register dialog appear, the factions are working, etc, but when i type any command, except the one that I've added a, noone is working.
Here is the command:
Please help me! Have a nice day!
Here is the command:
Код:
#include <a_samp>
#include <zcmd>
#include <a_mysql>
#define DIALOG_AGL 5233
#define COLOR_WHITE 0xFFFFFF
#define COLOR_LIGHTBLUE 0x07B1FAFF
#define COLOR_GREY 0xAFAFAFAA
#define pFlyLicx 1
#define pBoatLicx 2
#define pFishLicx 3
#define pGunLicx 4
#define pMatsLicx 5
#define pLevelx 6
#define pCashx 7
forward Update(playerid,type);
enum pInfo
{
pGunLic,
pFishLic,
pMatsLic,
pBoatLic,
pFlyLic,
pLevel,
pCash,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
public OnFilterScriptInit()
{
AddStaticPickup(1239, 1, 359.1557,183.0690,1008.3828); //buylicense
Create3DTextLabel("Type /buylicense\n To buy an license from the {AFAFAA}LICENSE SHOP",COLOR_LIGHTBLUE,359.1557,183.0690,1008.3828,10.0,0);//
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid ){
case DIALOG_AGL: {
if( !response ) return 1;
switch( listitem ){
case 0:
{
if(PlayerInfo[playerid][pCash] >= 22500)
{
SendClientMessage(playerid, COLOR_WHITE, "* You've bought the Weapon License.");
PlayerInfo[playerid][pGunLic] = 1;
Update(playerid, pGunLicx);
PlayerInfo[playerid][pCash] -= 22500;
GivePlayerMoney(playerid, -22500);
Update(playerid, pCashx);
}
}
case 1:
{
if(PlayerInfo[playerid][pCash] >= 10000)
{
SendClientMessage(playerid, COLOR_WHITE, "* You've bought the Flying License.");
PlayerInfo[playerid][pFlyLic] = 1;
Update(playerid, pFlyLicx);
PlayerInfo[playerid][pCash] -= 10000;
GivePlayerMoney(playerid, -10000);
Update(playerid, pCashx);
}
}
case 2:
{
if(PlayerInfo[playerid][pCash] >= 10000)
{
SendClientMessage(playerid, COLOR_WHITE, "* You've bought the Boat License.");
PlayerInfo[playerid][pBoatLic] = 1;
Update(playerid, pBoatLicx);
PlayerInfo[playerid][pCash] -= 22500;
GivePlayerMoney(playerid, -22500);
Update(playerid, pCashx);
}
}
case 3:
{
if(PlayerInfo[playerid][pCash] >= 10000)
{
SendClientMessage(playerid, COLOR_WHITE, "* You've bought the Fishing License.");
PlayerInfo[playerid][pFishLic] = 1;
Update(playerid, pFishLicx);
PlayerInfo[playerid][pCash] -= 10000;
GivePlayerMoney(playerid, -1000);
Update(playerid, pCashx);
}
}
case 4:
{
if(PlayerInfo[playerid][pCash] >= 15000)
{
SendClientMessage(playerid, COLOR_WHITE, "* You've bought the Materials License.");
PlayerInfo[playerid][pMatsLic] = 1;
Update(playerid, pMatsLicx);
PlayerInfo[playerid][pCash] -= 15000;
GivePlayerMoney(playerid, -15000);
Update(playerid, pCashx);
}
}
}
return 1;
}
}
return 1;
}
CMD:buylicense(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pLevel] >= 3) return SendClientMessage(playerid, COLOR_WHITE, "Trebuie sa ai level 3+.");
{
if(IsPlayerInRangeOfPoint(playerid, 4.0,359.1557,183.0690,1008.3828))
{
ShowPlayerDialog(playerid, DIALOG_AGL, DIALOG_STYLE_LIST, "What do you want?", "Weapon\nFlying\nBoat\nFishing\nMats\nSailing", "OK", "Close");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Nu esti la locul potrivit pentru a folosi aceasta comanda. Tasteaza /gps si alege locul licentelor");
}
}
}
return 1;
}
public Update(playerid,type)
{
new var[256];
switch(type)
{
case pCashx:
{
format(var,256,"UPDATE `players` SET `Money`='%d' WHERE `Name`='%s'",PlayerInfo[playerid][pCash],GetName(playerid));
mysql_query(var);
}
case pFlyLicx:
{
format(var,256,"UPDATE `players` SET `FlyLic`='%d' WHERE `Name`='%s'",PlayerInfo[playerid][pFlyLic],GetName(playerid));
mysql_query(var);
}
case pBoatLicx:
{
format(var,256,"UPDATE `players` SET `BoatLic`='%d' WHERE `Name`='%s'",PlayerInfo[playerid][pBoatLic],GetName(playerid));
mysql_query(var);
}
case pFishLicx:
{
format(var,256,"UPDATE `players` SET `FishLic`='%d' WHERE `Name`='%s'",PlayerInfo[playerid][pFishLic],GetName(playerid));
mysql_query(var);
}
case pGunLicx:
{
format(var,256,"UPDATE `players` SET `GunLic`='%d' WHERE `Name`='%s'",PlayerInfo[playerid][pGunLic],GetName(playerid));
mysql_query(var);
}
case pMatsLicx:
{
format(var,256,"UPDATE `players` SET `MatsLic`='%d' WHERE `Name`='%s'",PlayerInfo[playerid][pMatsLic],GetName(playerid));
mysql_query(var);
}
}
return 1;
}
stock GetName(playerid)
{
new name[MAX_PLAYER_NAME];
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, name, sizeof(name));
}
else
{
name = "Unknown";
}
return name;
}

