15.12.2013, 20:16
Por favor, altere a sua assinatura para "Editando o meu gamemode baixado da net".
pawn Код:
if(strcmp(cmd, "/darcomb", true) == 0)
{
new tmp[256];
new msg[256];
new petroleo;
new plid, comb;
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
tmp = strtok(cmdtext, idx);
if(dini_Int(file, "Profissao") == Frentista || IsPlayerAdmin(playerid) || pAdmin[playerid] > 3)
{
plid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, Vermelho, "[ERRO] Use: /darcomb [id] [litros]");
comb = strval(tmp);
if(comb > 100 || comb <= 0) return SendClientMessage(playerid, Vermelho, "[ERRO] Quantidade invбlida. Os valores devem ser de 1 а 100.");
if(IsPlayerConnected(plid))
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(file2, sizeof(file2), PASTA_CONTAS, pname);
if((dini_Int(file2, "Combustivel") + comb) < 100)
{
format(msg,sizeof(msg),"(INFO) Um frentista abasteceu %d litros de combustнvel em seu tanque, totalizando %d litros",comb,petroleo);
SendClientMessage(plid,COLOR_GREEN,msg);
petroleo = dini_Int(file2, "Combustivel") + comb;
dini_IntSet(file2, "Combustivel", petroleo);
SendClientMessage(plid,COLOR_GREEN,"(INFO) Agora nгo gaste atoa!")FO) Agora nгo gaste atoa!");
SendClientMessage(playerid,COLOR_GREEN,"(INFO) Combustнvel fornecido.");
}
else if((dini_Int(file2, "Combustivel") + comb) >= 100)
{
dini_IntSet(file2, "Combustivel", 100);
format(msg,sizeof(msg),"(INFO) Um Frentista completou seu tanque, colocando %d litros",petroleo);
petroleo = 100 - dini_Int(file2, "Combustivel");
SendClientMessage(plid,COLOR_GREEN,msg);
SendClientMessage(plid,COLOR_GREEN,"(INFO) Economize se nгo vai ficar a pй");
SendClientMessage(playerid,COLOR_GREEN,"(INFO) Combustivel fornecido.");
}
}
else
{
SendClientMessage(playerid, Vermelho, "[ERRO] Jogador nгo conectado/logado.");
}
}
else
{
SendClientMessage(playerid, Vermelho, "[ERRO] Vocк nгo tem permissгo!");
}
}
// USAR ICMD OU ZCMD EM VEZ DE STRCMP
// USAR DOF2 EM VEZ DE DINI
// USAR SSCANF EM VEZ DE STRTOK
// OPTIMIZAR O CУDIGO