if(strcmp("/colher", cmdtext, true, 10) == 0)
{
if(PlayerLeo[playerid][Profissao] != FAZENDEIRO) {
SendClientMessage(playerid, COR_ERRO, "| ERRO | Vocк nгo й um fazendeiro.");
return 1;
}
if(Colher[playerid] == 1) {
SendClientMessage(playerid, COR_ERRO, "| ERRO | A sua maconha ainda nгo esta pronta para colher");
return 1;
}
if(Colhido[playerid] == 1) {
SendClientMessage(playerid, COR_ERRO, "| ERRO | Vocк jб colheu, plante novamente.");
return 1;
}
new string[128];
new gramas = random(300);
new grana = random(3000 - 1000) + 2000;
GivePlayerMoney(playerid, grana);
Colhido[playerid] = 1;
Plantando[playerid] = 0;
DestroyObject(Maconha[1]);
Delete3DTextLabel(Text3D:MaconhaL[1]);
format(string, sizeof(string), "| INFO | Vocк colheu {FF0000}%d gramas{FFFFFF} de maconha, e recebeu {228B22}R$%d{FFFFFF}.", gramas, grana);
SendClientMessage(playerid, -1, string);
return 1;
}
if(strcmp("/plantarmaconha", cmdtext, true, 10) == 0)
{
if(PlayerLeo[playerid][Profissao] != FAZENDEIRO) {
SendClientMessage(playerid, COR_ERRO, "| ERRO | Vocк nгo й um fazendeiro");
return 1;
}
if(PlayerLeo[playerid][Sementes] <= 2) {
SendClientMessage(playerid, COR_ERRO, "| ERRO | Vocк nгo tem sementes o suficiente para plantar maconha (2 Sementes necessбrias)");
return 1;
}
if(Plantando[playerid] == 1) {
SendClientMessage(playerid, COR_ERRO, "| ERRO | Jб comeзou a plantar espere atй crescer para plantar novamente.");
return 1;
}
new string[128];
SendClientMessage(playerid, -1, "| INFO | Vocк comeзou a plantar maconha, espere atй crescer e colha.");
ApplyAnimation(playerid,"BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 32000, 1);
ApplyAnimation(playerid,"BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 32000, 1);
PlayerLeo[playerid][Sementes] -= 2;
Plantando[playerid] = 1;
Colher[playerid] = 1;
Colhido[playerid] = 0;
MaconhaL[1] = format(string, sizeof(string), "Plantaзгo ID: 1 de {32CD32}%s", GetPlayerNome(playerid));
Create3DTextLabel(string, 0xFFFFFFFF, -1052.03845, -1611.96765, 76.0000, 10.0, 0);
SetTimerEx("Plantar1", 30000, false, "i", playerid);
return 1;
}
public Plantar1(playerid)
{
Colher[playerid] = 0;
SendClientMessage(playerid, -1, "| INFO | {FF0000}Maconha{FFFFFF} pronta para ser colhida.");
Maconha[1] = CreateObject(3409, -1052.03845, -1611.96765, 74.7571, 0.00000, 0.00000, 0.00000);
return 1;
}
#define MAX_PLANTACOES 2
static const Float:Plantacoes[3][MAX_PLANTACOES] = {
{0.0, 0.0, 0.0}, // X, Y, Z
{0.0, 0.0, 0.0}
}
public OnGameModeInit() {
new string[20];
for(new i = 0; i < MAX_PLANTACOES; ++i) {
format(string, 20, "Plantaзгo ID: %d", i);
Create3DTextLabel(string, 0xFFFFFFFF, Plantacoes[i][0], Plantacoes[i][1], Plantacoes[i][2], 20.0, 0);
}
return 1;
}
IsPlayerInPlantation(playerid) {
for(new i = 0; i < MAX_PLANTACOES; ++i) {
if(IsPlayerInRangeOfPoint(playerid, 5.0, Plantacoes[i][0], Plantacoes[i][1], Plantacoes[i][2]))
return i;
}
return -1;
}
PHP код:
MAX_PLANTACOES vocк informa o nъmero de plantaзхes que terб. static const Float:Plantacoes[3] vocк vai colocando a posiзгo X, Y e Z de cada plantaзгo. Sу ir no seu servidor, ir dando /save e colocar as posiзхes corretamente nessa variбvel. Os 3DText sгo carregados no OnGameModeInit, se vocк quiser mudar a cor do texto, colocar viadagens e etc. |
if(strcmp("/plantarmaconha", cmdtext, true, 10) == 0)
{
if(PlayerLeo[playerid][Profissao] != FAZENDEIRO) {
SendClientMessage(playerid, COR_ERRO, "| ERRO | Vocк nгo й um fazendeiro");
return 1;
}
if(PlayerLeo[playerid][Sementes] <= 2) {
SendClientMessage(playerid, COR_ERRO, "| ERRO | Vocк nгo tem sementes o suficiente para plantar maconha (2 Sementes necessбrias)");
return 1;
}
if(Plantando[playerid] == 1) {
SendClientMessage(playerid, COR_ERRO, "| ERRO | Jб comeзou a plantar espere atй crescer para plantar novamente.");
return 1;
}
for(new i = 0; i < sizeof(PosicaoPlantacao); i ++)
{
if(IsPlayerInRangeOfPoint(playerid, 1, PosicaoPlantacao[i][posX], PosicaoPlantacao[i][posY], PosicaoPlantacao[i][posZ]))
{
new string[128];
SendClientMessage(playerid, -1, "| INFO | Vocк comeзou a plantar maconha, espere atй crescer e colha.");
ApplyAnimation(playerid,"BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 32000, 1);
ApplyAnimation(playerid,"BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 32000, 1);
PlayerLeo[playerid][Sementes] -= 2;
Plantando[playerid] = 1;
Colher[playerid] = 1;
Colhido[playerid] = 0;
SetTimerEx("Plantar1", 30000, false, "i", playerid);
return 1;
}
}
}
if(strcmp("/plantarmaconha", cmdtext, true, 10) == 0)
{
if(PlayerLeo[playerid][Profissao] != FAZENDEIRO) {
SendClientMessage(playerid, COR_ERRO, "| ERRO | Vocк nгo й um fazendeiro");
return 1;
}
if(PlayerLeo[playerid][Sementes] <= 2) {
SendClientMessage(playerid, COR_ERRO, "| ERRO | Vocк nгo tem sementes o suficiente para plantar maconha (2 Sementes necessбrias)");
return 1;
}
if(Plantando[playerid] == 1) {
SendClientMessage(playerid, COR_ERRO, "| ERRO | Jб comeзou a plantar espere atй crescer para plantar novamente.");
return 1;
}
for(new i = 0; i < sizeof(PosicaoPlantacao); i ++)
{
if(IsPlayerInRangeOfPoint(playerid, 1, PosicaoPlantacao[i][posX], PosicaoPlantacao[i][posY], PosicaoPlantacao[i][posZ]))
{
new string[128];
SendClientMessage(playerid, -1, "| INFO | Vocк comeзou a plantar maconha, espere atй crescer e colha.");
ApplyAnimation(playerid,"BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 32000, 1);
ApplyAnimation(playerid,"BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 32000, 1);
PlayerLeo[playerid][Sementes] -= 2;
Plantando[playerid] = 1;
Colher[playerid] = 1;
Colhido[playerid] = 0;
SetTimerEx("Plantar1", 30000, false, "i", playerid);
return 1;
}
}
return 1;
}