23.04.2015, 07:51
Hey
Idea of what the problem is:
Business created by (might be irrelevant) account: Hi_Lo
Business bought by account: Hi_Lo
Business evicted by Hi_Low when Hi_Lo was OFFLINE
[20:55:57] {F81414}WARNING:{FFFFFF} Hi_Lo (offline player) has been evicted from their business(ID:1).
The green symbolises it works as intended.
-------------------
Business purchased by account: Hi_Low
Business evicted by Hi_Lo when Hi_Low was OFFLINE
[20:58:31] {F81414}WARNING:{FFFFFF} Hi_Lo has been evicted from their business(ID:1).
The red symbolises it doesn't work as intended. It is meant to be Hi_Low being OFFLINE evicted. As opposed to Hi_Lo being ONLINE evicted (Hi_Lo did not even own it at this time - he is simply the one who executed the command).
Relevant Code:
I think the problem may be this line:
I don't think it's a problem with /buybusiness:
No errors or warnings.
I would appreciate any help. Sorry for the indentation, it's not like that in reality.
Idea of what the problem is:
Business created by (might be irrelevant) account: Hi_Lo
Business bought by account: Hi_Lo
Business evicted by Hi_Low when Hi_Lo was OFFLINE
[20:55:57] {F81414}WARNING:{FFFFFF} Hi_Lo (offline player) has been evicted from their business(ID:1).
The green symbolises it works as intended.
-------------------
Business purchased by account: Hi_Low
Business evicted by Hi_Lo when Hi_Low was OFFLINE
[20:58:31] {F81414}WARNING:{FFFFFF} Hi_Lo has been evicted from their business(ID:1).
The red symbolises it doesn't work as intended. It is meant to be Hi_Low being OFFLINE evicted. As opposed to Hi_Lo being ONLINE evicted (Hi_Lo did not even own it at this time - he is simply the one who executed the command).
Relevant Code:
Код:
CMD:evictbusiness(playerid, params[])
{
new id, playername[24], string[128];
if(sscanf(params, "d", id)) return SendClientMessage(playerid, COLOR_WHITE, "/evictbusiness [id]");
if(BusinessInfo[id][bExists] == 0) return SendClientMessage(playerid, COLOR_WHITE, "invalid id");
if(BusinessInfo[id][bOwned] == 0) return SendClientMessage(playerid, COLOR_WHITE, "no owner");
foreach(new i : Player)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i, playername, sizeof(playername));
if(strcmp(BusinessInfo[id][bOwner], playername, true, strlen(playername)) == 0)
{
PlayerInfo[i][pBusinessID] = 0;
format(string, sizeof(string), "{F81414}WARNING:{FFFFFF} %s has been evicted from their business(ID:%i).", playername, id);
SendClientMessage(playerid, COLOR_WHITE, string);
BusinessInfo[id][bOwner] = 0;
BusinessInfo[id][bOwned] = 0;
UpdateLabel(id);
return 1;
}
}
}
format(string, sizeof(string), "/Users/%s.ini", BusinessInfo[id][bOwner]);
new INI:File = INI_Open(string);
INI_SetTag(File,"data");
INI_WriteInt(File,"BusinessID", 0);
INI_Close(File);
format(string, sizeof(string), "{F81414}WARNING:{FFFFFF} %s (offline player) has been evicted from their business(ID:%i).", BusinessInfo[id][bOwner], id);
SendClientMessage(playerid, COLOR_WHITE, string);
BusinessInfo[id][bOwned] = 0;
BusinessInfo[id][bOwner] = 0;
UpdateLabel(id);
return 1;
}
Код:
if(strcmp(BusinessInfo[id][bOwner], playername, true, strlen(playername)) == 0)
Код:
CMD:buybusiness(playerid, params[])
{
if(PlayerInfo[playerid][pBusinessID] > 0) return SendClientMessage(playerid, COLOR_WHITE, "already own one");
new id = IsPlayerNearBizEnt(playerid);
if(id == -1) return SendClientMessage(playerid, COLOR_WHITE, "not near one");
if(BusinessInfo[id][bOwned] == 1) return SendClientMessage(playerid, COLOR_WHITE, "it's owned");
if(BusinessInfo[id][bPrice] > PlayerInfo[playerid][pDollar]) return SendClientMessage(playerid, COLOR_WHITE, "need more cash");
PlayerInfo[playerid][pBusinessID] = id;
PlayerInfo[playerid][pDollar] -= BusinessInfo[id][bPrice];
BusinessInfo[id][bOwned] = 1;
BusinessInfo[id][bOwner] = GetRegularName(playerid);
SendClientMessage(playerid, COLOR_WHITE, "success");
UpdateLabel(id);
return 1;
}
Код:
stock GetRegularName(playerid)
{
new name[24];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
I would appreciate any help. Sorry for the indentation, it's not like that in reality.


