15.05.2017, 10:00
@Bolex, don't bother helping unless you know the obvious. According to wiki.sa-mp.com, you can find that strcmp = 0 when the string matches at the given length, and will be 1 (or -1) when not. Look at the picture further down, which is a screenshot from the wiki page.
So how can you solve it?
First of all you have to ensure that
has been set correctly, when the owner is being set. If this doesn't match with the players name, it will eventually fail.
Can you show code where you set the biz owner, and does similar code work somewhere else?
Also, note that, if one of the strings are empy, they will return 0 on strcmp as well, so just in case - check that as well in order to avoid bugs.
PHP код:
if(!strcmp(BizInfo[biz][Owner], GetPlayerNameEx(playerid), true)) //here is the problem
{
new money;
if(sscanf(params,"d", money)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bizwithdraw [amount]");
if(money > BizInfo[biz][Till]) return SendClientMessage(playerid, COLOR_GRAD2, "You don't have that much money in your Till!");
new string[150];
format(string,sizeof(string),"You've taken $%d out of your Business Till.", money);
SendClientMessage(playerid, COLOR_GREY, string);
GivePlayerCash(playerid, money);
BizInfo[biz][Till] -= money;
}
else //because this code executes
{
SendClientMessage(playerid, COLOR_GRAD2, "You're not in your bussiness.");
}
First of all you have to ensure that
PHP код:
BizInfo[biz][Owner]
Can you show code where you set the biz owner, and does similar code work somewhere else?
Also, note that, if one of the strings are empy, they will return 0 on strcmp as well, so just in case - check that as well in order to avoid bugs.
![](http://image.prntscr.com/image/73df67b80d9e4e50830c08cb77a770fe.png)