if(strcmp(cmd, "/venderprod", true) == 0 || strcmp(cmd, "/venderproduto", true) == 0 || strcmp(cmd, "/venderprods", true) == 0)
{
new venda;
new tmpcar;
new CProds = VProd[6];
if(IsPlayerConnected(playerid))
{
tmpcar = GetPlayerVehicleID(playerid);
if(!IsAProdCar(tmpcar))
{
GameTextForPlayer(playerid, "~r~Voce nao esta em um caminhao de entregas", 5000, 1);
return 1;
}
if(PlayerHaul[tmpcar][pLoad] == 0)
{
GameTextForPlayer(playerid, "~r~Caminhao vazio, retorne a empresa e pegue mais.", 5000, 1);
format(string, sizeof(string), "Produtos: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[CProds][pCapasity]);
SendClientMessage(playerid, COR_Grooves, string);
return 1;
}
for(new i = 0; i < sizeof(BizzInfo); i++)
{
if (PlayerToPoint(10, playerid,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
{
for(new l = PlayerHaul[tmpcar][pLoad]; l > 0; l--)
{
if(BizzInfo[i][bProducts] == BizzInfo[i][bMaxProducts])
{
GameTextForPlayer(playerid, "~r~Nossos estoques estao cheios", 5000, 1);
format(string, sizeof(string), "Dinheiro ganho $%d.", venda);
SendClientMessage(playerid, COR_Grooves, string);
format(string, sizeof(string), "Produtos: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[CProds][pCapasity]);
SendClientMessage(playerid, COR_Grooves, string);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
return 1;
}
if(BizzInfo[i][bPriceProd] > BizzInfo[i][bTill])
{
GameTextForPlayer(playerid, "~r~Sem fundos", 5000, 1);
format(string, sizeof(string), "Dinheiro ganho $%d.", venda);
SendClientMessage(playerid, COR_Grooves, string);
format(string, sizeof(string), "Produtos: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[CProds][pCapasity]);
SendClientMessage(playerid, COR_Grooves, string);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
return 1;
}
PlayerHaul[tmpcar][pLoad]--;
BizzInfo[i][bProducts]++;
venda = venda+BizzInfo[i][bPriceProd];
ConsumingMoney[playerid] = 1;
GivePlayerMoneyEx(playerid,BizzInfo[i][bPriceProd]);
BizzInfo[i][bTill] -= BizzInfo[i][bPriceProd];
if(PlayerHaul[tmpcar][pLoad] == 0)
{
GameTextForPlayer(playerid, "~r~Caminhao vazio, retorne a empresa e pegue mais.", 5000, 1);
format(string, sizeof(string), "Dinheiro ganho $%d.", venda);
SendClientMessage(playerid, COR_Grooves, string);
format(string, sizeof(string), "Produtos: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[CProds][pCapasity]);
SendClientMessage(playerid, COR_Grooves, string);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
return 1;
}
}
OnPropUpdate();
return 1;
}
}
}
for(new i = 0; i < sizeof(SBizzInfo); i++)
{
if (PlayerToPoint(10, playerid,SBizzInfo[i][sbEntranceX], SBizzInfo[i][sbEntranceY], SBizzInfo[i][sbEntranceZ]))
{
//printf("Found House :%d",i);
for(new l = PlayerHaul[tmpcar][pLoad]; l > 0; l--)
{
if(SBizzInfo[i][sbProducts] == SBizzInfo[i][sbMaxProducts])
{
GameTextForPlayer(playerid, "~r~Nossos estoques estao cheios", 5000, 1);
format(string, sizeof(string), "Dinheiro ganho $%d.", venda);
SendClientMessage(playerid, COR_Grooves, string);
format(string, sizeof(string), "Produtos: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[CProds][pCapasity]);
SendClientMessage(playerid, COR_Grooves, string);
return 1;
}
if(SBizzInfo[i][sbPriceProd] > SBizzInfo[i][sbTill])
{
GameTextForPlayer(playerid, "~r~Sem fundos", 5000, 1);
format(string, sizeof(string), "Dinheiro ganho $%d.", venda);
SendClientMessage(playerid, COR_Grooves, string);
format(string, sizeof(string), "Produtos: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[CProds][pCapasity]);
SendClientMessage(playerid, COR_Grooves, string);
return 1;
}
PlayerHaul[tmpcar][pLoad]--;
SBizzInfo[i][sbProducts]++;
venda = venda+SBizzInfo[i][sbPriceProd];
ConsumingMoney[playerid] = 1;
GivePlayerMoneyEx(playerid,SBizzInfo[i][sbPriceProd]);
SBizzInfo[i][sbTill] -= SBizzInfo[i][sbPriceProd];
if(PlayerHaul[tmpcar][pLoad] == 0)
{
GameTextForPlayer(playerid, "~r~Caminhao vazio, retorne a empresa e pegue mais.", 5000, 1);
format(string, sizeof(string), "Dinheiro ganho $%d.", venda);
SendClientMessage(playerid, COR_Grooves, string);
format(string, sizeof(string), "Produtos: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[CProds][pCapasity]);
SendClientMessage(playerid, COR_Grooves, string);
return 1;
}
}
OnPropUpdate();
return 1;
}
}
GameTextForPlayer(playerid, "~r~Voce esta longe da empresa", 5000, 1);
return 1;
}
IsPlayerInAnyVehicle
//para checar se estб em um veнculo ou
IsPlayerInHaulVehicle
//mas ai seria necessбrio vocк fazer uma public com o id de todos os veiculos que possam ser usados
|
Usa
pawn Код:
|
|
olha cara IsPlayerInAnyVehicle pelo o que eu entendi й para verificar se o jogador estб em um veiculo.
IsPlayerInHaulVehicle nгo achei no wiki samp nгo seria IsPlayerInVehicle? ela tambйm tem que definir o id do veiculo! |
|
IsPlayerInHaulVehicle vocк terб que criar, mas apenas com os ID's disto, й uma funзгo criada por vocк, isto que ele quis dizer. |
public IsAProdCar(carid)
{
for(new i = 0; i < sizeof(VProd); i++)
{
if(carid == VProd[i]) return 1;
}
return 0;
}