|
if(strcmp(cmd, "/abastecer", true) == 0) { new tmp[256]; new aname[MAX_PLAYER_NAME]; GetPlayerName(playerid, aname, MAX_PLAYER_NAME); format(file, sizeof(file), PASTA_CONTAS, aname); new quantidade; new pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,sizeof(pName)); tmp = strtok(cmdtext, idx); if(!strlen(tmp)){ SendClientMessage(playerid, Vermelho, "** Uso: /abastecer [litros]"); return 1; } quantidade = strval(tmp); if(quantidade <= 0 || GetPlayerGrana(playerid) < quantidade){ SendClientMessage(playerid, Vermelho, "** Vocк nгo tem dinheiro suficiente para pagar o frentista."); return 1; } if(AreaPosto[playerid] == 1){ if(quantidade + dini_Int(file, "Combustivel") < 100){ dini_IntSet(file, "Combustivel", dini_Int(file, "Combustivel") + quantidade); format(string, sizeof(string), "* Vocк completou seu tanque com %d litros de combustнvel.", quantidade); SendClientMessage(playerid, COLOR_GREEN, string); GivePlayerGrana(playerid, - quantidade); return 1; } if(quantidade + dini_Int(file, "Combustivel")){ new quantia; quantia = 100 - dini_Int(file, "Combustivel"); dini_IntSet(file, "Combustivel", 100); format(string, sizeof(string), "* Pronto, tanque cheio foram colocados %d litros.", quantia); SendClientMessage(playerid, COLOR_GREEN, string); GivePlayerGrana(playerid, - quantia); return 1; } }else{ SendClientMessage(playerid, Vermelho, "** Vocк nгo estб no posto."); return 1; } } |
if(strcmp(cmd, "/abastecer", true) == 0) {
new tmp[256];
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
new quantidade;
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName));
if(IsPlayerInAnyVehicle(playerid) == 0){ // Este й o cуdigo que estava faltando
SendClientMessage(playerid, Vermelho, " | ERRO | Vocк nгo esta em um veiculo.! ");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, Vermelho, "** Uso: /abastecer [litros]");
return 1;
}
quantidade = strval(tmp);
if(quantidade <= 0 || GetPlayerGrana(playerid) < quantidade){
SendClientMessage(playerid, Vermelho, "** Vocк nгo tem dinheiro suficiente para pagar o frentista.");
return 1;
}
if(AreaPosto[playerid] == 1){
if(quantidade + dini_Int(file, "Combustivel") < 100){
dini_IntSet(file, "Combustivel", dini_Int(file, "Combustivel") + quantidade);
format(string, sizeof(string), "* Vocк completou seu tanque com %d litros de combustнvel.", quantidade);
SendClientMessage(playerid, COLOR_GREEN, string);
GivePlayerGrana(playerid, - quantidade);
return 1;
}
if(quantidade + dini_Int(file, "Combustivel")){
new quantia;
quantia = 100 - dini_Int(file, "Combustivel");
dini_IntSet(file, "Combustivel", 100);
format(string, sizeof(string), "* Pronto, tanque cheio foram colocados %d litros.", quantia);
SendClientMessage(playerid, COLOR_GREEN, string);
GivePlayerGrana(playerid, - quantia);
return 1;
}
}else{
SendClientMessage(playerid, Vermelho, "** Vocк nгo estб no posto.");
return 1;
}
}
if(strcmp(cmd, "/abastecer", true) == 0)
{
new tmp[256];
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
new quantidade;
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName));
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, Vermelho, "** Uso: /abastecer [litros]");
return 1;
}
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) //Verifca se estб a dirigir um veнculo
{
quantidade = strval(tmp);
if(quantidade <= 0 || GetPlayerGrana(playerid) < quantidade)
{
SendClientMessage(playerid, Vermelho, "** Vocк nгo tem dinheiro suficiente para pagar o frentista.");
return 1;
}
if(AreaPosto[playerid] == 1)
{
if(quantidade + dini_Int(file, "Combustivel") < 100)
{
dini_IntSet(file, "Combustivel", dini_Int(file, "Combustivel") + quantidade);
format(string, sizeof(string), "* Vocк completou seu tanque com %d litros de combustнvel.", quantidade);
SendClientMessage(playerid, COLOR_GREEN, string);
GivePlayerGrana(playerid, - quantidade);
return 1;
}
if(quantidade + dini_Int(file, "Combustivel"))
{
new quantia;
quantia = 100 - dini_Int(file, "Combustivel");
dini_IntSet(file, "Combustivel", 100);
format(string, sizeof(string), "* Pronto, tanque cheio foram colocados %d litros.", quantia);
SendClientMessage(playerid, COLOR_GREEN, string);
GivePlayerGrana(playerid, - quantia);
return 1;
}
}
else SendClientMessage(playerid, Vermelho, "** Vocк nгo estб no posto.");
return 1;
}
else SendClientMessage(playerid, Vermelho, "Vocк nгo estб dirigindo um veнculo!");
return 1;
}
|
Dei uma organizada no seu cуdigo e coloquei uma verificaзгo para se o player estiver dirigindo o comando funcionar ( Se ele tiver de carona nгo funciona )
pawn Код:
|
|
Rey, sua intensгo foi boa em endentar o cуdigo, mais creio que a GM dele nгo й endentada e nгo deve dar Warnings ! E de repente colocar um cуdigo tabulado pode dar Warnings, * Eu acho *
|