Big GameMode Problem -
AlexR - 25.09.2015
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:
Код:
#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;
}
Please help me! Have a nice day!
Re: Big GameMode Problem -
AlexR - 25.09.2015
I found my problem...the command is zcmd and i need strcmp. Can anyone help me to convert it please?
Re: Big GameMode Problem -
Aly - 25.09.2015
Put this under OnPlayerCommandText and remove #include <zcmd>
Код:
if(!strcmp(cmdtext,"/buylicense",true))
{
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");
}
}
}
}
Re: Big GameMode Problem -
AlexR - 25.09.2015
I got these errors:
"(38411) : error 029: invalid expression, assumed zero
(38411) : error 029: invalid expression, assumed zero"
at the line:
"public OnPlayerCommandText(playerid, cmdtext[])"
Re: Big GameMode Problem -
Aly - 25.09.2015
It should look something like this:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext,"/buylicense",true))
{
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;
}
return 0;
}
Re: Big GameMode Problem -
AlexR - 25.09.2015
same errors....
Re: Big GameMode Problem -
Aly - 25.09.2015
On this line?
Код:
public OnPlayerCommandText(playerid, cmdtext[])
Where is this line situated?
Re: Big GameMode Problem -
AlexR - 25.09.2015
Well, the command will not work, but i have a few better commands for this:
Код:
//==============================================================================
// Comanda /buyflying
//==============================================================================
if(strcmp(cmd, "/buyflying", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerToPoint(3.0,playerid,1412.0840,-1701.5978,13.5395) || PlayerToPoint(3.0,playerid, -2026.543090,-101.443748,35.164062) || PlayerToPoint(3.0,playerid, 1867.345214,1443.582519,10.820312))
{
if(PlayerInfo[playerid][pFlyLic] == 0)
{
if(GetPlayerCash(playerid) < 10000)
{
SendClientMessage(playerid, COLOR_GREY, "Nu ai bani destui for a flying license");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You bought a flying license for $10,000");
GivePlayerCash(playerid, - 10000);
PlayerInfo[playerid][pFlyLic] = 1;
OnPlayerUpdateEx(playerid);
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, " You already own a flying license");
return 1;
}
}
}
return 1;
}
//==============================================================================
// Comanda /buysailing
//==============================================================================
if(strcmp(cmd, "/buysailing", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerToPoint(3.0,playerid,1412.0840,-1701.5978,13.5395) || PlayerToPoint(3.0,playerid, -2026.543090,-101.443748,35.164062) || PlayerToPoint(3.0,playerid, 1867.345214,1443.582519,10.820312))
{
if(PlayerInfo[playerid][pBoatLic] == 0)
{
if(GetPlayerCash(playerid) < 10000)
{
SendClientMessage(playerid, COLOR_GREY, "Nu ai bani destui for a sailing license");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You bought a boat license for $10,000");
GivePlayerCash(playerid, - 10000);
PlayerInfo[playerid][pBoatLic] = 1;
OnPlayerUpdateEx(playerid);
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, " You already own a boat license");
return 1;
}
}
}
return 1;
}
//==============================================================================
// Comanda /buygunlic
//==============================================================================
if(strcmp(cmd, "/buygunlic", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerToPoint(3.0,playerid,1412.0840,-1701.5978,13.5395) || PlayerToPoint(3.0,playerid, -2026.543090,-101.443748,35.164062) || PlayerToPoint(3.0,playerid, 1867.345214,1443.582519,10.820312))
{
if(PlayerInfo[playerid][pGunLic] == 0)
{
if(GetPlayerCash(playerid) < 10000)
{
SendClientMessage(playerid, COLOR_GREY, "Nu ai bani destui for a gun license");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You bought a gun license for $10,000");
GivePlayerCash(playerid, - 10000);
PlayerInfo[playerid][pGunLic] = 1;
OnPlayerUpdateEx(playerid);
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, " You already own a gun license");
return 1;
}
}
}
return 1;
}
//==============================================================================
// Comanda /buyfishing
//==============================================================================
if(strcmp(cmd, "/buyfishing", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerToPoint(3.0,playerid,1412.0840,-1701.5978,13.5395) || PlayerToPoint(3.0,playerid, -2026.543090,-101.443748,35.164062) || PlayerToPoint(3.0,playerid, 1867.345214,1443.582519,10.820312))
{
if(PlayerInfo[playerid][pFishLic] == 0)
{
if(GetPlayerCash(playerid) < 10000)
{
SendClientMessage(playerid, COLOR_GREY, "Nu ai bani destui for a fishing license");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You bought a fishing license for $10,000");
GivePlayerCash(playerid, - 10000);
PlayerInfo[playerid][pFishLic] = 1;
OnPlayerUpdateEx(playerid);
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, " You already own a fishing license");
return 1;
}
}
}
return 1;
}
Are these better?
Re: Big GameMode Problem -
Aly - 25.09.2015
Deci esti roman, sa inteleg ca nu mai primesti erorile respective nu?
Re: Big GameMode Problem -
AlexR - 25.09.2015
Ba da, la comanda "/buylicense" le primesc exact la fel la linia asta:
Код:
public OnPlayerCommandText(playerid, cmdtext[])