14.11.2010, 11:49
pawn Код:
if(strcmp(cmd, "/abastecer", true) == 0) {
new tmp[256];
new quantidade;
new string[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, COLOR_RED, "Uso: /abastecer [litros]");
return 1;
}
quantidade = strval(tmp);
if(quantidade <= 0 || GetPlayerMoney(playerid) < quantidade){
SendClientMessage(playerid, COLOR_RED, "Vocк nгo tem dinheiro para pagar. Ou vocк estб querendo tirar gasolina do carro.");
return 1;
}
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if((X >= -1666.3102 && Y <= 418.1154 && X <= 670.9482 && Y >= -589.7477) || (X >= -117.3342 && Y >= -1194.0710 && X <= -56.5731 && Y <= -1158.9866) || (X >= 1906.3308 && Y >= -1795.3513 && X <= 1953.3729 && Y <= -1759.7977) || (X <= 1011.8674 && X >= 978.0131 && Y <= -890.4835 && Y >= -945.2622) || (X >= -1699.14 && X <= -1657.21 && Y >= 371.57 && Y <= 460.83)){
if(quantidade + Petrol[playerid] < 100){
Petrol[playerid] = quantidade;
format(string, sizeof(string), "Vocк comprou %d litros de gasolina", quantidade);
SendClientMessage(playerid, COLOR_GREEN, string);
GivePlayerMoney(playerid, - quantidade);
return 1;
}
if(quantidade + Petrol[playerid] >= 100){
new quantia;
quantia = 100 - Petrol[playerid];
Petrol[playerid] = 100;
format(string, sizeof(string), "Seu tanque ficou completo. Colocamos %d litros.", quantia);
SendClientMessage(playerid, COLOR_GREEN, string);
GivePlayerMoney(playerid, - quantia);
return 1;
}
}
else{
SendClientMessage(playerid, COLOR_RED, "Vocк nгo estб no posto, consulte o mapa para saber sua localizaзгo");
return 1;
}
}