SendClientMessage(playerid, COLOR_GRAD2, "You're not in your bussiness.");
CMD:bizwithdraw(playerid, params[])
{
for(new biz = 0; biz < MAX_BIZ; biz++)
{
if(IsPlayerInRangeOfPoint(playerid, 100, BizInfo[biz][IXCoord], BizInfo[biz][IYCoord], BizInfo[biz][IZCoord]))
{
if(GetPlayerVirtualWorld(playerid) == BizInfo[biz][VW])
{
if(!strcmp(BizInfo[biz][Owner], GetPlayerNameEx(playerid), true))
{
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
{
SendClientMessage(playerid, COLOR_GRAD2, "You're not in your bussiness.");
}
}
}
}
return 1;
}
CMD:bizwithdraw(playerid, params[]) { for(new biz = 0; biz < MAX_BIZ; biz++) { if(IsPlayerInRangeOfPoint(playerid, 100, BizInfo[biz][IXCoord], BizInfo[biz][IYCoord], BizInfo[biz][IZCoord])) { if(GetPlayerVirtualWorld(playerid) == BizInfo[biz][VW]) { if(strcmp(BizInfo[biz][Owner], GetPlayerNameEx(playerid), true)) == 0) { 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 { SendClientMessage(playerid, COLOR_GRAD2, "You're not in your bussiness."); } } } } return 1; }
Код:
CMD:bizwithdraw(playerid, params[]) { for(new biz = 0; biz < MAX_BIZ; biz++) { if(IsPlayerInRangeOfPoint(playerid, 100, BizInfo[biz][IXCoord], BizInfo[biz][IYCoord], BizInfo[biz][IZCoord])) { if(GetPlayerVirtualWorld(playerid) == BizInfo[biz][VW]) { if(strcmp(BizInfo[biz][Owner], GetPlayerNameEx(playerid), true)) == 0) { 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 { SendClientMessage(playerid, COLOR_GRAD2, "You're not in your bussiness."); } } } } return 1; } |
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.");
}
BizInfo[biz][Owner]
Код:
CMD:bizwithdraw(playerid, params[]) { for(new biz = 0; biz < MAX_BIZ; biz++) { if(IsPlayerInRangeOfPoint(playerid, 100, BizInfo[biz][IXCoord], BizInfo[biz][IYCoord], BizInfo[biz][IZCoord])) { if(GetPlayerVirtualWorld(playerid) == BizInfo[biz][VW]) { if(strcmp(BizInfo[biz][Owner], GetPlayerNameEx(playerid), true)) == 0) { 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 { SendClientMessage(playerid, COLOR_GRAD2, "You're not in your bussiness."); } } } } return 1; } |
CMD:bizwithdraw(playerid, params[])
{
for(new biz = 0; biz < MAX_BIZ; biz++)
{
if(IsPlayerInRangeOfPoint(playerid, 100, BizInfo[biz][IXCoord], BizInfo[biz][IYCoord], BizInfo[biz][IZCoord]))
{
if(GetPlayerVirtualWorld(playerid) == BizInfo[biz][VW])
{
if(!strcmp(BizInfo[biz][Owner], GetPlayerNameEx(playerid), true))
{
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
{
SendClientMessage(playerid, COLOR_GRAD2, "You're not in your bussiness.");
}
}
}
}
return 1;
}