if(strcmp(cmd, "/comprarprods", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new tmpcar = GetPlayerVehicleID(playerid);
new compcost = 50;
if(PlayerToPoint(50.0, playerid, 1702.9344,-1470.9005,13.5469))
{
if(IsATruck(tmpcar))
{
if(PlayerHaul[tmpcar][pLoad] < PlayerHaul[tmpcar][pCapasity])
{
new amount;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USE: /comprarprods [Valor]");
return 1;
}
amount = strval(tmp);
if(amount < 1 || amount > 500) { SendClientMessage(playerid, COLOR_GREY, "Vocк nгo pode comprar menos de 1 e mais de 500 !"); return 1; }
new check= PlayerHaul[tmpcar][pLoad] + amount;
if(check > PlayerHaul[tmpcar][pCapasity])
{
format(string, sizeof(string), "Voce foi ao limite dos caminhoes carry %d, que atualmente exedem %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pLoad]);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
new cost = amount*compcost;
if(GetPlayerMoney (playerid) >= cost)
{
PlayerHaul[tmpcar][pLoad] += amount;
format(string, sizeof(string), "Produtos: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
format(string, sizeof(string), "Voce comprou %d Produtos por $%d.", amount,cost);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
GivePlayerMoney(playerid,-cost);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
return 1;
}
else
{
if(strcmp(cmd, "/comprarprods", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new tmpcar = GetPlayerVehicleID(playerid);
new compcost = 50;
if(PlayerToPoint(50.0, playerid, 1702.9344,-1470.9005,13.5469))
{
if(IsATruck(tmpcar))
{
if(PlayerHaul[tmpcar][pLoad] < PlayerHaul[tmpcar][pCapasity])
{
new amount;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USE: /comprarprods [Valor]");
return 1;
}
amount = strval(tmp);
if(amount < 1 || amount > 500) { SendClientMessage(playerid, COLOR_GREY, "Vocк nгo pode comprar menos de 1 e mais de 500 !"); return 1; }
new check= PlayerHaul[tmpcar][pLoad] + amount;
if(check > PlayerHaul[tmpcar][pCapasity])
{
format(string, sizeof(string), "Voce foi ao limite dos caminhoes carry %d, que atualmente exedem %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pLoad]);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
new cost = amount*compcost;
if(GetPlayerMoney (playerid) >= cost)
{
PlayerHaul[tmpcar][pLoad] += amount;
format(string, sizeof(string), "Produtos: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
new string2[100];
format(string2, sizeof(string2), "Voce comprou %d Produtos por $%d.", amount,cost);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string2);
GivePlayerMoney(playerid,-cost);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
return 1;
}
else
{
format(string, sizeof(string), "Produtos: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
format(string, sizeof(string), "Voce comprou %d Produtos por $%d.", amount,cost);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
format(string, sizeof(string), "Produtos: %d/%d.\nVoce comprou %d Produtos por $%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity], amount,cost));
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
|
Simplesmente substitua:
PHP код:
PHP код:
|
|
A quebra de linha nгo funciona quando a string й enviada via SendClientMessage. Ademais, nгo й preciso reiniciar a string se serб utilizado format, jб que a mesma terб um valor "atribuнdo" a ela, e nгo concatenado, como strcat, em que й preciso reiniciar.
|