04.05.2018, 16:05
Code:
CMD:comprarempresa(playerid, params[]) { new Float:oldposx, Float:oldposy, Float:oldposz; GetPlayerName(playerid, playername, sizeof(playername)); GetPlayerPos(playerid, oldposx, oldposy, oldposz); if(PlayerInfo[playerid][pVIP] < 1) { SendClientMessage(playerid, COLOR_GREY, "Apenas players VIPs podem comprar uma empresa"); return true; } if(PlayerInfo[playerid][pPbiskey] != 255) { SendClientMessage(playerid, COLOR_GREY, " Vocк ja tem uma empresa, Digite /venderempresa para comprar outra."); return true; } new string[128]; for(new b = 0; b < sizeof(SBizzInfo); b++) { if(PlayerToPoint(2.0, playerid, SBizzInfo[b][sbEntranceX], SBizzInfo[b][sbEntranceY], SBizzInfo[b][sbEntranceZ]) && SBizzInfo[b][sbOwned] == 0) { if(PlayerInfo[playerid][pLevel] < SBizzInfo[b][sbLevelNeeded]) { format(string, sizeof(string), "Vocк precisa ser nнvel %d para comprar essa empresa",SBizzInfo[b][sbLevelNeeded]); SendClientMessage(playerid, COLOR_GRAD5, string); return true; } if(GetPlayerMoney(playerid) > SBizzInfo[b][sbBuyPrice]) { PlayerInfo[playerid][pPbiskey] = b+100; SBizzInfo[b][sbOwned] = 1; SBizzInfo[b][sbLocked] = 0; SBizzInfo[b][sbTill] = 0; GetPlayerName(playerid, sendername, sizeof(sendername)); strmid(SBizzInfo[b][sbOwner], sendername, 0, strlen(sendername), 255); GiveDinheiro(playerid,-SBizzInfo[b][sbBuyPrice]); PlayerPlayMusic(playerid); SendClientMessage(playerid, COLOR_WHITE, "Parabens, Vocк comprou uma empresa."); SendClientMessage(playerid, COLOR_WHITE, "Digite /ajudaemp para ver os comandos de sua empresa."); Atualizar3Dtexts(); SalvarSEmpresa(b); DateProp(playerid); format(string, sizeof(string), "%s comprou a mini empresa ID: %d", PlayerName(playerid), b); BPSLogs("sempresas", string); return true; } else { SendClientMessage(playerid, COLOR_GREY, "Vocк nгo tem grana suficiente"); return true; } } } for(new b = 0; b < sizeof(BizzInfo); b++) { if(PlayerToPoint(2.0, playerid, BizzInfo[b][bEntranceX], BizzInfo[b][bEntranceY], BizzInfo[b][bEntranceZ]) && BizzInfo[b][bOwned] == 0) { if(PlayerInfo[playerid][pLevel] < BizzInfo[b][bLevelNeeded]) { format(string, sizeof(string), "Vocк precisa ser nнvel %d para comprar essa empresa",BizzInfo[b][bLevelNeeded]); SendClientMessage(playerid, COLOR_GRAD5, string); return true; } if(GetPlayerMoney(playerid) > BizzInfo[b][bBuyPrice]) { PlayerInfo[playerid][pPbiskey] = b; BizzInfo[b][bOwned] = 1; BizzInfo[b][bLocked] = 0; BizzInfo[b][bTill] = 0; GetPlayerName(playerid, sendername, sizeof(sendername)); strmid(BizzInfo[b][bOwner], sendername, 0, strlen(sendername), 255); GiveDinheiro(playerid,-BizzInfo[b][bBuyPrice]); PlayerPlayMusic(playerid); SetPlayerInterior(playerid,BizzInfo[b][bInterior]); SetPlayerVirtualWorld(playerid, BizzInfo[b][bWorld]); PlayerInfo[playerid][pInt] = BizzInfo[b][bInterior]; SetPlayerPos(playerid,BizzInfo[b][bExitX],BizzInfo[b][bExitY],BizzInfo[b][bExitZ]); GameTextForPlayer(playerid, "~w~Bem Vindo~n~Voce pode sair da sua empresa digitando /sair", 5000, 3); PlayerInfo[playerid][pInt] = BizzInfo[b][bInterior]; PlayerInfo[playerid][pLocal] = b ; SendClientMessage(playerid, COLOR_WHITE, "Parabens, Vocк comprou esta empresa."); SendClientMessage(playerid, COLOR_WHITE, "Digite /ajudaemp para ver os comandos de sua empresa."); //Atualizar3Dtexts(); //SalvarEmpresa(b); //DateProp(playerid); format(string, sizeof(string), "%s comprou a empresa ID: %d", PlayerName(playerid), b); BPSLogs("empresas", string); DateProp(playerid); Atualizar3Dtexts(); SalvarEmpresa(b); return true; } else { SendClientMessage(playerid, COLOR_GREY, "Vocк nao tem grana o suficiente"); return true; } } } return true; }