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;
}
|
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). |
|
This
EDIT: And, of course, in this instance the variables do not change as intended. |
if(!strcmp(PlayerName, BusinessInfo[id][bOwner]))