textdraw with shop failure -
Ananisiki - 11.10.2016
hi i made shop with easy textdraw, i use the command the textdraw show but i wont get the thing i try to buy,
example if i do /shopmenu
the textdraw comes up
#1 health
#2 armor
etc
when i type 1 it sends it to the chat i dont get health..
this what i got
in the command /shopmenu
pawn Код:
public OnPlayerText(playerid, text[])
{
if(Shop[playerid] == 1)
{
if(text[0] == '1')
{
if(armor[playerid] == 1)
{
SendClientMessage(playerid, COLOR_RED, "You can Only heal One Time Each spawn.");
Shop[playerid] = 0;
}
Re: textdraw with shop failure -
Kaliber - 11.10.2016
You have to show us the full code
Just Debug it...and look if it gets called..and then what if conditions there could be..so that the code get stuck
Re: textdraw with shop failure -
Ananisiki - 12.10.2016
pawn Код:
CMD:shopmenu(playerid, params[])
{
#pragma unused params
if(Dead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You cant Use This Cmd when Dead.");
if(IsPlayerConnected(playerid))
{
RemoveAllTextDraws(playerid);
TextDrawShowForPlayer(playerid, ShopTD0);
TextDrawShowForPlayer(playerid, ShopTD1);
TextDrawShowForPlayer(playerid, ShopTD2);
TextDrawShowForPlayer(playerid, ShopTD3);
TextDrawShowForPlayer(playerid, ShopTD4);
TextDrawShowForPlayer(playerid, ShopTD5);
TextDrawShowForPlayer(playerid, ShopTD6);
TextDrawShowForPlayer(playerid, ShopTD7);
}
Shop[playerid] = 1;
return 1;
}
public OnPlayerText(playerid, text[])
{
if(Shop[playerid] == 1)
{
if(text[0] == '1')
{
if(ExtraPill[playerid] == 1)
{
SendClientMessage(playerid, COLOR_RED, "you may only buy one pill each spawn");
RemoveAllTextDraws(playerid);
Shop[playerid] = 0;
}
else
if(ExtraPill[playerid] == 0)
{
if(GetPVarInt(playerid, "Pill") == 1) return SendClientMessage(playerid, COLOR_RED, "You have already one pill");
if(GetPlayerMoney(playerid) <= 25800) return SendClientMessage(playerid, COLOR_RED, "You dont have enough money you need 25800");
SetPlayerMoney(playerid, GetPlayerMoney(playerid) -25800);
SetPVarInt(playerid, "Pill", 1);
ExtraPill[playerid] = 1;
RemoveAllTextDraws(playerid);
Shop[playerid] = 0;
}
}
return 0;
return 1;
}
Re: textdraw with shop failure -
azzerking - 12.10.2016
Solution
Other then the missing bracket, I don't see why this would not work? I have made the missing bracket bold.
I changed the check to strcmp that should work for you, however you could also use strval.
Код:
CMD:shopmenu(playerid, params[])
{
#pragma unused params
if(Dead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You cant Use This Cmd when Dead.");
if(IsPlayerConnected(playerid))
{
RemoveAllTextDraws(playerid);
TextDrawShowForPlayer(playerid, ShopTD0);
TextDrawShowForPlayer(playerid, ShopTD1);
TextDrawShowForPlayer(playerid, ShopTD2);
TextDrawShowForPlayer(playerid, ShopTD3);
TextDrawShowForPlayer(playerid, ShopTD4);
TextDrawShowForPlayer(playerid, ShopTD5);
TextDrawShowForPlayer(playerid, ShopTD6);
TextDrawShowForPlayer(playerid, ShopTD7);
}
Shop[playerid] = 1;
return 1;
}
public OnPlayerText(playerid, text[])
{
if(Shop[playerid] == 1)
{
if( !strcmp( text[0], '1' ) )
{
if( ExtraPill[playerid] == 1 )
{
SendClientMessage(playerid, COLOR_RED, "you may only buy one pill each spawn");
}
else
{
if(GetPVarInt(playerid, "Pill") == 1) return SendClientMessage(playerid, COLOR_RED, "You have already one pill");
if(GetPlayerMoney(playerid) <= 25800) return SendClientMessage(playerid, COLOR_RED, "You dont have enough money you need 25800");
SetPlayerMoney(playerid, GetPlayerMoney(playerid) -25800);
SetPVarInt(playerid, "Pill", 1);
ExtraPill[playerid] = 1;
}
Shop[playerid] = 0;
RemoveAllTextDraws(playerid);
} // you missed a bracket here
}
return 1;
}
Re: textdraw with shop failure -
Ananisiki - 12.10.2016
not working man..
Re: textdraw with shop failure -
azzerking - 12.10.2016
Sorry, I have made a mistake.
It should be double quotes, not single.
Код:
if( !strcmp( text[0], "1" ) )