CMD:fillcars(playerid,params[])
{
if( PlayerInfo[playerid][pAdmin] == 1 || PlayerInfo[playerid][pMod] == 1 || PlayerInfo[playerid][pDono] == 1)
{
new quantity;
if(sscanf(params, "i", quantity)) return SendClientMessage(playerid, red, "Use: /fillcars [quantity]");
if(quantity< 0 || quantity> 100) return SendClientMessage(playerid, red, "| ERROR | The maximum amount of gas is 100!");
for ( new c = 0 ; c < MAX_VEHICLES ; c ++)
{
new stringgas[256];
carfuel[c] += quantity;
format(stringgas, sizeof(stringgas), "AdmCmd: You supplied % d liter on all cars of San Andreas", quantity);
SendClientMessage(playerid, blue, stringgas);
return 1;
}
}
else
{
SendClientMessage(playerid,red,"| ERROR | You don't have permission!");
}
return 1;
}
You return 1 in the loop and it breaks. Remove it and also declare the string before the loop and format/send the message after the loop.
|
CMD:fillcars(playerid,params[])
{
if( PlayerInfo[playerid][pAdmin] == 1 || PlayerInfo[playerid][pMod] == 1 || PlayerInfo[playerid][pDono] == 1)
return SendClientMessage(playerid,red,"| ERROR | You don't have permission!");
new quantity;
if(sscanf(params, "i", quantity)) return SendClientMessage(playerid, red, "Use: /fillcars [quantity]");
if(quantity< 0 || quantity> 100) return SendClientMessage(playerid, red, "| ERROR | The maximum amount of gas is 100!");
for ( new c = 0 ; c < MAX_VEHICLES ; c ++)
{
new stringgas[256];
carfuel[c] += quantity;
format(stringgas, sizeof(stringgas), "AdmCmd: You supplied % d liter on all cars of San Andreas", quantity);
SendClientMessage(playerid, blue, stringgas);
}
return 1;
}
new stringgas[60];
for ( new c = 0 ; c < MAX_VEHICLES ; c ++)
{
carfuel[c] += quantity;
}
format(stringgas, sizeof(stringgas), "AdmCmd: You supplied %d liter on all cars of San Andreas", quantity);
SendClientMessage(playerid, blue, stringgas);
CMD:fillcars(playerid,params[]) { if( PlayerInfo[playerid][pAdmin] < 2 || PlayerInfo[playerid][pMod] < 2 || PlayerInfo[playerid][pDono] < 2) return SendClientMessage(playerid,red,"| ERROR | You don't have permission!"); new quantity, stringgas[130]; if(sscanf(params, "i", quantity)) return SendClientMessage(playerid, red, "Use: /fillcars [quantity]"); if(quantity< 0 || quantity> 100) return SendClientMessage(playerid, red, "| ERROR | The maximum amount of gas is 100!"); format(stringgas, sizeof(stringgas), "AdmCmd: You supplied % d liter on all cars of San Andreas", quantity); SendClientMessage(playerid, blue, stringgas); for ( new c = 1 ; c < MAX_VEHICLES ; c ++) { carfuel[c] += quantity; } return 1; }
CMD:fillcars(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] < 2 && PlayerInfo[playerid][pMod] < 2 && PlayerInfo[playerid][pDono] < 2)
return SendClientMessage(playerid,red,"| ERROR | You don't have permission!");
new quantity;
if(sscanf(params, "i", quantity)) return SendClientMessage(playerid, red, "Use: /fillcars [quantity]");
if(!(0 < quantity <= 100)) return SendClientMessage(playerid, red, "| ERROR | The maximum amount of gas is 100!");
new stringgas[68];
format(stringgas, sizeof(stringgas), "AdmCmd: You supplied %d litres of fuel on all cars in San Andreas", quantity);
SendClientMessage(playerid, blue, stringgas);
for(new c = 1; c < MAX_VEHICLES; c++) carfuel[c] += quantity;
return 1;
}