27.06.2011, 22:24
Tipo o player compra a empresa e quando ele vende, ai vende por 0 R$ e quando compra casas vende e da o mesmo preзo que comprou a casa, e queria fazer o mesmo com as empresas biz e sbiz :] se poder me ajudar ae .
if(strcmp(cmd, "/vendercasa", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][pPhousekey] == 255)
{
SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo comprou nenhuma casa.");
return 1;
}
if(PlayerInfo[playerid][pMarried] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " Vocк estб casado, nгo poderб vender esta casa !");
return 1;
}
if(PlayerInfo[playerid][pPhousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
{
new house = PlayerInfo[playerid][pPhousekey];
HouseInfo[house][hHel] = 0;
HouseInfo[house][hArm] = 0;
HouseInfo[house][hHealthx] = 0;
HouseInfo[house][hHealthy] = 0;
HouseInfo[house][hHealthz] = 0;
HouseInfo[house][hArmourx] = 0;
HouseInfo[house][hArmoury] = 0;
HouseInfo[house][hArmourz] = 0;
HouseInfo[house][hLock] = 1;
HouseInfo[house][hOwned] = 0;
HouseInfo[house][hVec] = 547;
HouseInfo[house][hVcol1] = -1;
HouseInfo[house][hVcol2] = -1;
HouseInfo[house][hTakings] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(HouseInfo[house][hOwner], "governo", 0, strlen("governo"), 255);
ConsumingMoney[playerid] = 1;
GivePlayerGP(playerid,HouseInfo[house][hValue]);
GivePlayerGP(playerid,HouseInfo[house][hTakings]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Parabens~n~ voce vendeu a casa por ~n~~g~R$ %d", HouseInfo[house][hValue]);
GameTextForPlayer(playerid, string, 10000, 3);
PlayerInfo[playerid][pPhousekey] = 255;
if(PlayerInfo[playerid][pLocal] == house)
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,HouseInfo[house][hEntrancex],HouseInfo[house][hEntrancey],HouseInfo[house][hEntrancez]);
PlayerInfo[playerid][pInt] = 0;
}
OnPropUpdate();
OnPlayerSave(playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo й o dono dessa casa.");
}
}
return 1;
}
if(strcmp(cmd, "/venderempresa", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][pPbiskey] == 255)
{
SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo comprou uma empresa ainda.");
return 1;
}
if(PlayerInfo[playerid][pMarried] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " Vocк estб casado, nгo pode vender uma empresa !");
return 1;
}
if(PlayerInfo[playerid][pPbiskey] >= 100 && strcmp(playername, SBizzInfo[PlayerInfo[playerid][pPbiskey]-100][sbOwner], true) == 0)
{
new bouse = PlayerInfo[playerid][pPbiskey]-100;
GivePlayerGP(playerid,SBizzInfo[bouse][sbTill]);
SBizzInfo[bouse][sbLocked] = 1;
SBizzInfo[bouse][sbOwned] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(SBizzInfo[bouse][sbOwner], "governo", 0, strlen("governo"), 255);
strmid(SBizzInfo[bouse][sbExtortion], "---", 0, strlen("---"), 255);
ConsumingMoney[playerid] = 1;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Parabens~n~ Empresa vendida por ~n~~g~R$ %d", SBizzInfo[bouse][sbTill]);
GameTextForPlayer(playerid, string, 10000, 3);
SBizzInfo[bouse][sbTill] = 0;
PlayerInfo[playerid][pPbiskey] = 255;
OnPropUpdate();
OnPlayerSave(playerid);
return 1;
}
if(strcmp(playername, BizzInfo[PlayerInfo[playerid][pPbiskey]][bOwner], true) == 0)
{
new bouse = PlayerInfo[playerid][pPbiskey];
BizzInfo[bouse][bLocked] = 1;
BizzInfo[bouse][bOwned] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(BizzInfo[bouse][bOwner], "governo", 0, strlen("governo"), 255);
strmid(BizzInfo[bouse][bExtortion], "---", 0, strlen("---"), 255);
ConsumingMoney[playerid] = 1;
GivePlayerGP(playerid,BizzInfo[bouse][bTill]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Parabens~n~ empresa vendida por ~n~~g~R$ %d", BizzInfo[bouse][bTill]);
GameTextForPlayer(playerid, string, 10000, 3);
BizzInfo[bouse][bTill] = 0;
PlayerInfo[playerid][pPbiskey] = 255;
OnPropUpdate();
OnPlayerSave(playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo comprou um Empresa.");
}
}
return 1;
}
GivePlayerGP(playerid,SBizzInfo[bouse][sbTill]); // E \/
GivePlayerGP(playerid,BizzInfo[bouse][bTill]);
GivePlayerGP(playerid,SBizzInfo[bouse][sbBuyPrice]); // E \/
GivePlayerGP(playerid,BizzInfo[bouse][bBuyPrice]);
if(strcmp(cmd, "/venderempresa", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][pPbiskey] == 255)
{
SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo comprou uma empresa ainda.");
return 1;
}
if(PlayerInfo[playerid][pMarried] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " Vocк estб casado, nгo pode vender uma empresa !");
return 1;
}
if(PlayerInfo[playerid][pPbiskey] >= 100 && strcmp(playername, SBizzInfo[PlayerInfo[playerid][pPbiskey]-100][sbOwner], true) == 0)
{
new bouse = PlayerInfo[playerid][pPbiskey]-100;
GivePlayerGP(playerid,SBizzInfo[bouse][sbBuyPrice]);
SBizzInfo[bouse][sbLocked] = 1;
SBizzInfo[bouse][sbOwned] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(SBizzInfo[bouse][sbOwner], "governo", 0, strlen("governo"), 255);
strmid(SBizzInfo[bouse][sbExtortion], "---", 0, strlen("---"), 255);
ConsumingMoney[playerid] = 1;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Parabens~n~ Empresa vendida por ~n~~g~R$ %d", SBizzInfo[bouse][sbTill]);
GameTextForPlayer(playerid, string, 10000, 3);
SBizzInfo[bouse][sbTill] = 0;
PlayerInfo[playerid][pPbiskey] = 255;
OnPropUpdate();
OnPlayerSave(playerid);
return 1;
}
if(strcmp(playername, BizzInfo[PlayerInfo[playerid][pPbiskey]][bOwner], true) == 0)
{
new bouse = PlayerInfo[playerid][pPbiskey];
BizzInfo[bouse][bLocked] = 1;
BizzInfo[bouse][bOwned] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(BizzInfo[bouse][bOwner], "governo", 0, strlen("governo"), 255);
strmid(BizzInfo[bouse][bExtortion], "---", 0, strlen("---"), 255);
ConsumingMoney[playerid] = 1;
GivePlayerGP(playerid,BizzInfo[bouse][bBuyPrice]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Parabens~n~ empresa vendida por ~n~~g~R$ %d", BizzInfo[bouse][bTill]);
GameTextForPlayer(playerid, string, 10000, 3);
BizzInfo[bouse][bTill] = 0;
PlayerInfo[playerid][pPbiskey] = 255;
OnPropUpdate();
OnPlayerSave(playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo comprou um Empresa.");
}
}
return 1;
}
if(strcmp(cmd, "/venderempresa", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][pPbiskey] == 255)
{
SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo comprou uma empresa ainda.");
return 1;
}
if(PlayerInfo[playerid][pMarried] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " Vocк estб casado, nгo pode vender uma empresa !");
return 1;
}
if(PlayerInfo[playerid][pPbiskey] >= 100 && strcmp(playername, SBizzInfo[PlayerInfo[playerid][pPbiskey]-100][sbOwner], true) == 0)
{
new bouse = PlayerInfo[playerid][pPbiskey]-100;
GivePlayerGP(playerid,SBizzInfo[bouse][sbBuyPrice]);
SBizzInfo[bouse][sbLocked] = 1;
SBizzInfo[bouse][sbOwned] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(SBizzInfo[bouse][sbOwner], "governo", 0, strlen("governo"), 255);
strmid(SBizzInfo[bouse][sbExtortion], "---", 0, strlen("---"), 255);
ConsumingMoney[playerid] = 1;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Parabens~n~ Empresa vendida por ~n~~g~R$ %d", SBizzInfo[bouse][sbTill]);
GameTextForPlayer(playerid, string, 10000, 3);
SBizzInfo[bouse][sbTill] = 0;
PlayerInfo[playerid][pPbiskey] = 255;
OnPropUpdate();
OnPlayerSave(playerid);
return 1;
}
if(strcmp(playername, BizzInfo[PlayerInfo[playerid][pPbiskey]][bOwner], true) == 0)
{
new bouse = PlayerInfo[playerid][pPbiskey];
BizzInfo[bouse][bLocked] = 1;
BizzInfo[bouse][bOwned] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(BizzInfo[bouse][bOwner], "governo", 0, strlen("governo"), 255);
strmid(BizzInfo[bouse][bExtortion], "---", 0, strlen("---"), 255);
ConsumingMoney[playerid] = 1;
GivePlayerGP(playerid,BizzInfo[bouse][bBuyPrice]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Parabens~n~ empresa vendida por ~n~~g~R$ %d", BizzInfo[bouse][bTill]);
GameTextForPlayer(playerid, string, 10000, 3);
BizzInfo[bouse][bTill] = 0;
PlayerInfo[playerid][pPbiskey] = 255;
OnPropUpdate();
OnPlayerSave(playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo comprou um Empresa.");
}
}
return 1;
}