28.09.2014, 02:14
Hola quisiera saber si este Fs es bien porque aveces me aparece un cuadro al medio de la pantalla y aveces a un costado dejo el fs para que lo vean:
Код:
#include <a_samp> #include <progressbar> // include en la carpeta de descarga #include "../include/gl_common.inc" #define PlayerToPoint(%1,%2,%3,%4,%5) IsPlayerInRangeOfPoint(%2,%1,%3,%4,%5) new Text:Textdraw0[MAX_PLAYERS]; new Text:Textdraw1[MAX_PLAYERS]; new Text:Textdraw2[MAX_PLAYERS]; new Text:Textdraw3[MAX_PLAYERS]; new Text:Textdraw4[MAX_PLAYERS]; new Text:Textdraw5[MAX_PLAYERS]; new Text:Textdraw6[MAX_PLAYERS]; new Bar:Combustible[MAX_PLAYERS]; new Bar:Velocimetro[MAX_PLAYERS]; new timer1[MAX_PLAYERS]; new timer2[MAX_PLAYERS]; new timercharge[MAX_PLAYERS]; new bidon[MAX_VEHICLES]; enum info { Velocidad, Gasolina }; new Info[MAX_VEHICLES][info]; stock GetVehicleSpeed(vehicleid) { new Float:V[3]; GetVehicleVelocity(vehicleid, V[0], V[1], V[2]); return floatround(floatsqroot(V[0] * V[0] + V[1] * V[1] + V[2] * V[2]) * 180.00); } forward timerx(playerid); public timerx(playerid) { if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { new velo = GetVehicleSpeed(GetPlayerVehicleID(playerid)), text[12]; SetProgressBarValue(Velocimetro[playerid], velo); UpdateProgressBar(Velocimetro[playerid], playerid); format(text, sizeof(text), "%d", velo); TextDrawSetString(Textdraw5[playerid], text); TextDrawShowForPlayer(playerid, Textdraw5[playerid]); } return 1; } forward timer(playerid); public timer(playerid) { if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { new vehicleid = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objetive; GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objetive); if(Info[vehicleid][Gasolina] <= 0 && engine) { GameTextForPlayer(playerid, "Tanque vacio", 3000, 5); SetProgressBarValue(Combustible[playerid], Info[vehicleid][Gasolina]); UpdateProgressBar(Combustible[playerid], playerid); SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objetive); return 1; } if(engine) { Info[vehicleid][Gasolina] -= 1; func(playerid, vehicleid); if(Info[vehicleid][Gasolina] == 5) { GameTextForPlayer(playerid, "Tanque casi vacio", 3000, 5); } } } return 1; } func(playerid, vehicleid) { new text[24]; format(text, sizeof(text), "%d/120", Info[vehicleid][Gasolina]); TextDrawSetString(Textdraw4[playerid], text); TextDrawShowForPlayer(playerid, Textdraw4[playerid]); SetProgressBarValue(Combustible[playerid], Info[vehicleid][Gasolina]); UpdateProgressBar(Combustible[playerid], playerid); if(Escamion(vehicleid)) { SetProgressBarMaxValue(Combustible[playerid], 120); format(text, sizeof(text), "%d/120", Info[vehicleid][Gasolina]); TextDrawSetString(Textdraw4[playerid], text); TextDrawShowForPlayer(playerid, Textdraw4[playerid]); SetProgressBarValue(Combustible[playerid], Info[vehicleid][Gasolina]); UpdateProgressBar(Combustible[playerid], playerid); } else { SetProgressBarMaxValue(Combustible[playerid], 100); format(text, sizeof(text), "%d/100", Info[vehicleid][Gasolina]); TextDrawSetString(Textdraw4[playerid], text); TextDrawShowForPlayer(playerid, Textdraw4[playerid]); SetProgressBarValue(Combustible[playerid], Info[vehicleid][Gasolina]); UpdateProgressBar(Combustible[playerid], playerid); } return 1; } public OnFilterScriptInit() { textlabels(); for(new vehicleid = 1; vehicleid < MAX_VEHICLES; vehicleid++) { Info[vehicleid][Gasolina] = 100; if(Escamion(vehicleid)) { Info[vehicleid][Gasolina] = 120; } } for(new player = 0; player < GetMaxPlayers()+1; player++) { Textdraw0[player] = TextDrawCreate(576.000000, 380.000000, "-"); TextDrawAlignment(Textdraw0[player], 2); TextDrawBackgroundColor(Textdraw0[player], 255); TextDrawFont(Textdraw0[player], 1); TextDrawLetterSize(Textdraw0[player], 0.500000, 6.699998); TextDrawColor(Textdraw0[player], 255); TextDrawSetOutline(Textdraw0[player], 0); TextDrawSetProportional(Textdraw0[player], 1); TextDrawSetShadow(Textdraw0[player], 1); TextDrawUseBox(Textdraw0[player], 1); TextDrawBoxColor(Textdraw0[player], 255); TextDrawTextSize(Textdraw0[player], 0.000000, 104.000000); Textdraw1[player] = TextDrawCreate(576.000000, 307.000000, "-"); TextDrawAlignment(Textdraw1[player], 2); TextDrawBackgroundColor(Textdraw1[player], 255); TextDrawFont(Textdraw1[player], 1); TextDrawLetterSize(Textdraw1[player], 0.500000, 6.699998); TextDrawColor(Textdraw1[player], 255); TextDrawSetOutline(Textdraw1[player], 0); TextDrawSetProportional(Textdraw1[player], 1); TextDrawSetShadow(Textdraw1[player], 1); TextDrawUseBox(Textdraw1[player], 1); TextDrawBoxColor(Textdraw1[player], 255); TextDrawTextSize(Textdraw1[player], 0.000000, 104.000000); Textdraw2[player] = TextDrawCreate(525.000000, 379.000000, "Velocimetro"); TextDrawBackgroundColor(Textdraw2[player], 255); TextDrawFont(Textdraw2[player], 2); TextDrawLetterSize(Textdraw2[player], 0.349999, 1.100000); TextDrawColor(Textdraw2[player], -1); TextDrawSetOutline(Textdraw2[player], 0); TextDrawSetProportional(Textdraw2[player], 1); TextDrawSetShadow(Textdraw2[player], 1); Textdraw3[player] = TextDrawCreate(526.000000, 307.000000, "Combustible"); TextDrawBackgroundColor(Textdraw3[player], 255); TextDrawFont(Textdraw3[player], 2); TextDrawLetterSize(Textdraw3[player], 0.349999, 1.100000); TextDrawColor(Textdraw3[player], -1); TextDrawSetOutline(Textdraw3[player], 0); TextDrawSetProportional(Textdraw3[player], 1); TextDrawSetShadow(Textdraw3[player], 1); Textdraw4[player] = TextDrawCreate(609.000000, 326.000000, "0/120"); TextDrawAlignment(Textdraw4[player], 3); TextDrawBackgroundColor(Textdraw4[player], 255); TextDrawFont(Textdraw4[player], 1); TextDrawLetterSize(Textdraw4[player], 0.549999, 2.399999); TextDrawColor(Textdraw4[player], -1); TextDrawSetOutline(Textdraw4[player], 0); TextDrawSetProportional(Textdraw4[player], 1); TextDrawSetShadow(Textdraw4[player], 1); Textdraw5[player] = TextDrawCreate(586.000000, 390.000000, "0"); TextDrawAlignment(Textdraw5[player], 3); TextDrawBackgroundColor(Textdraw5[player], 255); TextDrawFont(Textdraw5[player], 1); TextDrawLetterSize(Textdraw5[player], 0.960000, 4.099999); TextDrawColor(Textdraw5[player], -1); TextDrawSetOutline(Textdraw5[player], 0); TextDrawSetProportional(Textdraw5[player], 1); TextDrawSetShadow(Textdraw5[player], 1); Textdraw6[player] = TextDrawCreate(591.000000, 413.000000, "KM/h"); TextDrawBackgroundColor(Textdraw6[player], 255); TextDrawFont(Textdraw6[player], 1); TextDrawLetterSize(Textdraw6[player], 0.370000, 1.000000); TextDrawColor(Textdraw6[player], -1); TextDrawSetOutline(Textdraw6[player], 0); TextDrawSetProportional(Textdraw6[player], 1); TextDrawSetShadow(Textdraw6[player], 1); Combustible[player] = CreateProgressBar(530.00, 357.00, 92.50, 4.19, 788461567, 120.0); //combus celeste Velocimetro[player] = CreateProgressBar(530.00, 431.00, 95.50, 4.19, 1631063039, 240.0); // veloc marron } return 1; } public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT) { func(playerid, GetPlayerVehicleID(playerid)); timer1[playerid] = SetTimerEx("timer", 30000, true, "u", playerid); timer2[playerid] = SetTimerEx("timerx", 250, true, "u", playerid); ShowTDs(playerid); } else if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER) { KillTimer(timer1[playerid]); KillTimer(timer2[playerid]); HideTDs(playerid); } return 1; } public OnFilterScriptExit() { textlabelsdestroy(); for(new player = 0; player < GetMaxPlayers()+1; player++) { if(IsPlayerConnected(player)) { HideProgressBarForPlayer(player, Velocimetro[player]); HideProgressBarForPlayer(player, Combustible[player]); HideTDs(player); } TextDrawDestroy(Textdraw0[player]); TextDrawDestroy(Textdraw1[player]); TextDrawDestroy(Textdraw2[player]); TextDrawDestroy(Textdraw3[player]); TextDrawDestroy(Textdraw4[player]); TextDrawDestroy(Textdraw5[player]); TextDrawDestroy(Textdraw6[player]); DestroyProgressBar(Combustible[player]); DestroyProgressBar(Velocimetro[player]); } return 1; } ShowTDs(player) { TextDrawShowForPlayer(player, Textdraw0[player]); TextDrawShowForPlayer(player, Textdraw1[player]); TextDrawShowForPlayer(player, Textdraw2[player]); TextDrawShowForPlayer(player, Textdraw3[player]); TextDrawShowForPlayer(player, Textdraw4[player]); TextDrawShowForPlayer(player, Textdraw5[player]); TextDrawShowForPlayer(player, Textdraw6[player]); ShowProgressBarForPlayer(player, Velocimetro[player]); ShowProgressBarForPlayer(player, Combustible[player]); return 1; } forward HideTDs(player); public HideTDs(player) { TextDrawHideForPlayer(player, Textdraw0[player]); TextDrawHideForPlayer(player, Textdraw1[player]); TextDrawHideForPlayer(player, Textdraw2[player]); TextDrawHideForPlayer(player, Textdraw3[player]); TextDrawHideForPlayer(player, Textdraw4[player]); TextDrawHideForPlayer(player, Textdraw5[player]); TextDrawHideForPlayer(player, Textdraw6[player]); HideProgressBarForPlayer(player, Velocimetro[player]); HideProgressBarForPlayer(player, Combustible[player]); return 1; } public OnPlayerSpawn(playerid) { KillTimer(timer1[playerid]); KillTimer(timer2[playerid]); HideTDs(playerid); return 1; } new Text3D:texts[25]; textlabels() { new text[] = "{FFFFFF}Para llenar el tanque usa {00FFD2}/llenar\n {FFFFFF}Para cargar una cantidad diferente, usa {00FFD2}/combustible\n {FFFFFF}Para comprar un bidуn de 5 litros usa {00FFD2}/comprarbidon\n {FFFFFF}Cada litro de combustible cuesta: {00FFD2}$10{FFFFFF}\n"; texts[0] = Create3DTextLabel(text, 0xFFFFFFFF, 1004.0070,-939.3102,42.1797,40.0, 0, 0); texts[1]=Create3DTextLabel(text, 0xFFFFFFFF, 1944.3260,-1772.9254,13.3906,40.0, 0, 0); texts[2]=Create3DTextLabel(text, 0xFFFFFFFF, -90.5515,-1169.4578,2.4079,40.0, 0, 0); texts[3]=Create3DTextLabel(text, 0xFFFFFFFF, -1609.7958,-2718.2048,48.5391,40.0, 0, 0); texts[4]=Create3DTextLabel(text, 0xFFFFFFFF, 2114.5444,920.1169,10.8203,40.0, 0, 0); texts[5]=Create3DTextLabel(text, 0xFFFFFFFF, -1609.7958,-2718.2048,48.5391,40.0, 0, 0); texts[6]=Create3DTextLabel(text, 0xFFFFFFFF, 1625.0463,-2167.6428,13.4402,40.0, 0, 0); texts[7]=Create3DTextLabel(text, 0xFFFFFFFF, -1676.6323,414.0262,6.9484,40.0, 0, 0); texts[8]=Create3DTextLabel(text, 0xFFFFFFFF, 2202.2349,2474.3494,10.5258,40.0, 0, 0); texts[9]=Create3DTextLabel(text, 0xFFFFFFFF, -1676.6323,414.0262,6.9484,40.0, 0, 0); texts[10]=Create3DTextLabel(text, 0xFFFFFFFF, -1328.8250,2677.2173,49.7665,40.0, 0, 0); texts[11]=Create3DTextLabel(text, 0xFFFFFFFF, 70.3882,1218.6783,18.5165,40.0, 0, 0); texts[12]=Create3DTextLabel(text, 0xFFFFFFFF, 2113.7390,920.1079,10.5255,40.0, 0, 0); texts[13]=Create3DTextLabel(text, 0xFFFFFFFF, -1327.7218,2678.8723,50.0625,40.0, 0, 0); texts[14]=Create3DTextLabel(text, 0xFFFFFFFF, 1637.0149,2331.5129,10.8722,40.0, 0, 0); texts[15]=Create3DTextLabel(text, 0xFFFFFFFF, 1636.6686,2325.8711,10.8722,40.0, 0, 0); texts[16]=Create3DTextLabel(text, 0xFFFFFFFF, 1636.6140,2320.6423,10.8722,40.0, 0, 0); texts[17]=Create3DTextLabel(text, 0xFFFFFFFF, 1595.5337,2198.9404,10.8203,40.0, 0, 0); texts[18]=Create3DTextLabel(text, 0xFFFFFFFF, 1595.5337,2198.9404,10.8203,40.0, 0, 0); texts[19]=Create3DTextLabel(text, 0xFFFFFFFF, 1839.58, -2522.52, 13.55,40.0, 0, 0); texts[21]=Create3DTextLabel(text, 0xFFFFFFFF, 1839.58, -2522.52, 13.55,40.0, 0, 0); texts[22]=Create3DTextLabel(text, 0xFFFFFFFF, 656.4265,-559.8610,16.5015,40.0, 0, 0); texts[23]=Create3DTextLabel(text, 0xFFFFFFFF, 656.3797,-570.4138,16.5015,40.0, 0, 0); texts[24]=Create3DTextLabel(text, 0xFFFFFFFF, 2294.2227,-1911.0593,13.5971,40.0, 0, 0); } textlabelsdestroy() { for(new t = 0; t < 25; t++) { Delete3DTextLabel(texts[t]); } return 1; } Estaengas(playerid) { if(IsPlayerConnected(playerid)) { if(PlayerToPoint(6.0,playerid,1004.0070,-939.3102,42.1797) || PlayerToPoint(6.0,playerid,1944.3260,-1772.9254,13.3906)) { return 1; } else if(PlayerToPoint(6.0,playerid,-90.5515,-1169.4578,2.4079) || PlayerToPoint(6.0,playerid,-1609.7958,-2718.2048,48.5391)) { return 1; } else if(PlayerToPoint(6.0,playerid,2114.5444,920.1169,10.8203) || PlayerToPoint(8.0,playerid,2640.6272,1106.5349,10.8203)) { // return 1; } else if(PlayerToPoint(5.0,playerid,1625.0463,-2167.6428,13.4402) || PlayerToPoint(8.0,playerid,-1676.6323,414.0262,6.9484)) {// return 1; } else if(PlayerToPoint(6.0,playerid,2202.2349,2474.3494,10.5258) || PlayerToPoint(10.0,playerid,614.9333,1689.7418,6.6968)) {// return 1; } else if(PlayerToPoint(8.0,playerid,-1328.8250,2677.2173,49.7665) || PlayerToPoint(6.0,playerid,70.3882,1218.6783,18.5165)) {// return 1; } else if(PlayerToPoint(8.0,playerid,2113.7390,920.1079,10.5255) || PlayerToPoint(6.0,playerid,-1327.7218,2678.8723,50.0625)) {// return 1; } else if(PlayerToPoint(8.0,playerid,1637.0149,2331.5129,10.8722) || PlayerToPoint(6.0,playerid,1636.6686,2325.8711,10.8722)) {// return 1; } else if(PlayerToPoint(8.0,playerid,1636.6140,2320.6423,10.8722) || PlayerToPoint(6.0,playerid,1595.5337,2198.9404,10.8203)|| PlayerToPoint(6.0,playerid,1839.58, -2522.52, 13.55)) {// return 1; } else if(PlayerToPoint(8.0,playerid,1489.9305,-1562.3641,13.5498) || PlayerToPoint(6.0,playerid,1489.9305,-1562.3641,13.5498)|| PlayerToPoint(6.0,playerid,1839.58, -2522.52, 13.55)) { return 1; } else if(PlayerToPoint(8.0,playerid,656.4265,-559.8610,16.5015) || PlayerToPoint(6.0,playerid,656.3797,-570.4138,16.5015) || PlayerToPoint(6.0,playerid,2294.2227,-1911.0593,13.5971) ) { return 1; } } return 0; } new varex[MAX_PLAYERS][5]; public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[256], idx, tmp[128]; cmd = strtok(cmdtext, idx); if(strcmp(cmd, "/llenar", true) == 0) { Gastrade(playerid, GetPlayerVehicleID(playerid)); varex[playerid][3] = 1; return 1; } if(strcmp(cmd, "/combustible", true) == 0) { if(!Estaengas(playerid)) return SendClientMessage(playerid, 0xF07B0FFF, "No estas en una estaciуn de gasolina."); if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, 0xF07B0FFF, "Debes ser el conductor de un vehiculo para pagar por gasolina."); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid, 0xF07B0FFF, "/Combustible [cantidad de litros]"); if(!strval(tmp)) return SendClientMessage(playerid, 0xF07B0FFF, "/Combustible [cantidad en numero]"); new veh = GetPlayerVehicleID(playerid), cadena[128], result, gas = Info[veh][Gasolina]; varex[playerid][3] = 2; if(Escamion(veh)) result = 120; else result = 100; new litro = strval(tmp), price = 10; result = result - gas; if(litro > result) { format(cadena, 128, "Cantidad de litros exedente para tu vehiculo, Posible:[%d]", result); SendClientMessage(playerid, 0xF07B0FFF, cadena); return 1; } new differex = litro*price; if(GetPlayerMoney(playerid) < differex) { new differ = differex - GetPlayerMoney(playerid); format(cadena, 128, "El litro cuesta $10, te faltan $%d para pagar %d litros", differ, litro); SendClientMessage(playerid, 0xF07B0FFF, cadena); return 1; } timercharge[playerid] = SetTimerEx("timerchargef", 5000, false, "u", playerid); TogglePlayerControllable(playerid, 0); GameTextForPlayer(playerid, "~y~Llenando tanque, espera porfavor.", 5000, 5); varex[playerid][0] = litro, varex[playerid][1] = differex; return 1; } if(strcmp(cmd, "/tirarbidon", true) == 0) { if(GetPVarInt(playerid, "bidon") == 0) return SendClientMessage(playerid, 0xF07B0FFF, "No tienes un bidуn."); SetPVarInt(playerid, "bidon", 0); RemovePlayerAttachedObject(playerid, 0); GameTextForPlayer(playerid, "~y~Desechaste tu bidon de gas", 2000, 5); return 1; } if(strcmp(cmd, "/motor2", true) == 0) { new vehicleid = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objetive; GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objetive); SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objetive); return 1; } if(strcmp(cmd, "/guardarbidon", true) == 0) { if(GetPVarInt(playerid, "bidon") == 0) return SendClientMessage(playerid, 0xF07B0FFF, "No tienes un bidуn."); if(CarInFrontOfPlayer(playerid) == 0) return SendClientMessage(playerid, 0xF07B0FFF, "Acercate a un coche para guardar el bidon."); RemovePlayerAttachedObject(playerid, 0); SetPVarInt(playerid, "bidon", 0); new vehch = CarInFrontOfPlayer(playerid); bidon[vehch] = 1; SendClientMessage(playerid, 0xF07B0FFF, "Guardaste tu bidon de gas en el coche."); return 1; } if(strcmp(cmd, "/sacarbidon", true) == 0) { if(GetPVarInt(playerid, "bidon") == 1) return SendClientMessage(playerid, 0xF07B0FFF, "tienes un bidуn en la mano."); new vehch = CarInFrontOfPlayer(playerid); if(CarInFrontOfPlayer(playerid) == 0) return SendClientMessage(playerid, 0xF07B0FFF, "Acercate a un coche para llenar su tanque."); if(bidon[vehch] == 0) return SendClientMessage(playerid, 0xF07B0FFF, "No encuentras ningun bidon en el coche."); SetPlayerAttachedObject(playerid,0,1650,5,0.125999,0.011999,0.000000,-4.999999,-98.099983,16.600004,1.000000,1.000000,1.000000); SetPVarInt(playerid, "bidon", 1); bidon[vehch] = 0; SendClientMessage(playerid, 0xF07B0FFF, "Sacaste tu bidon de gas del coche."); return 1; } if(strcmp(cmd, "/comprarbidon", true) == 0) { if(!Estaengas(playerid)) return SendClientMessage(playerid, 0xF07B0FFF, "No estas en una estaciуn de gasolina."); if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xF07B0FFF, "Necesitas al menos $50 para comprar el bidуn."); if(GetPVarInt(playerid, "bidon") == 1) return SendClientMessage(playerid, 0xF07B0FFF, "Ya tienes un bidуn."); if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xF07B0FFF, "Baja del vehiculo para realizar esta acciуn."); SetPVarInt(playerid, "bidon", 1); SendClientMessage(playerid, 0xF07B0FFF , "Compraste un bidon de gasolina de 5 litros por $65. Para usarlo ingresa /usarbidon"); SetPlayerAttachedObject(playerid,0,1650,5,0.125999,0.011999,0.000000,-4.999999,-98.099983,16.600004,1.000000,1.000000,1.000000); GivePlayerMoney(playerid, -65); return 1; } if(strcmp(cmd, "/gasolinatodos", true) == 0) { if(IsPlayerAdmin(playerid)) { for(new v = 1; v < MAX_VEHICLES; v++) { if(Escamion(v)) Info[v][Gasolina] = 120; Info[v][Gasolina] = 100; } SendClientMessageToAll(0xF07B0FFF, "Gasolina recargada por un admin"); } return 1; } if(strcmp(cmd, "/usarbidon", true) == 0) { if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xF07B0FFF, "Baja del vehiculo para realizar esta acciуn."); if(GetPVarInt(playerid, "bidon") == 0) return SendClientMessage(playerid, 0xF07B0FFF, "No tienes un bidon de gasolina, adquierelo en una gasolinera."); new vehch = CarInFrontOfPlayer(playerid); if(CarInFrontOfPlayer(playerid) == 0) return SendClientMessage(playerid, 0xF07B0FFF, "Acercate a un coche para llenar su tanque."); if(Escamion(vehch)) { if(Info[vehch][Gasolina] > 115) return SendClientMessage(playerid, 0xF07B0FFF, "El camion tiene gasolina suficiente, no puedes cargarlo con este galуn."); } else { if(Info[vehch][Gasolina] > 95) return SendClientMessage(playerid, 0xF07B0FFF, "El vehiculo tiene gasolina suficiente, no puedes cargarlo con este galуn."); } Info[vehch][Gasolina] += 5; new cadena[128]; GameTextForPlayer(playerid, "~y~Cargaste el coche con el bidon", 2000, 5); format(cadena, 128, "Tanque del coche llenado correctamente con 5 litros."); SetPVarInt(playerid, "bidon", 0); RemovePlayerAttachedObject(playerid, 0); SendClientMessage(playerid, 0xF07B0FFF, cadena); return 1; } return 0; } CarInFrontOfPlayer(playerid) // by escobar { new Float: x, Float: y, Float: z; GetXYZInFrontOfPlayer(playerid, x, y, z, 3.0); new carid = GetClosestVehicleID(playerid); if(GetVehicleDistanceFromPoint(carid, x, y, z) < 3.0) { return carid; } return 0; } public OnPlayerDisconnect(playerid, reason) { KillTimer(timer1[playerid]); KillTimer(timer2[playerid]); HideTDs(playerid); return 1; } forward timerchargef(playerid); public timerchargef(playerid) { if(varex[playerid][3] == 2) { new cadena[128]; Info[GetPlayerVehicleID(playerid)][Gasolina] += varex[playerid][0]; GivePlayerMoney(playerid, -varex[playerid][1]); format(cadena, 128, "Tanque cargado con %d litros por: $%d", varex[playerid][0], varex[playerid][1]); SendClientMessage(playerid, 0xF07B0FFF, cadena); TogglePlayerControllable(playerid, 1); } else if(varex[playerid][3] == 1) { if(varex[playerid][0] == 120) { new cadena[128]; Info[GetPlayerVehicleID(playerid)][Gasolina] = 120; format(cadena, 128, "Tanque llenado correctamente por: $%d", varex[playerid][1]); SendClientMessage(playerid, 0xF07B0FFF, cadena); GivePlayerMoney(playerid, -varex[playerid][1]); TogglePlayerControllable(playerid, 1); } if(varex[playerid][0] == 100) { new cadena[128]; Info[GetPlayerVehicleID(playerid)][Gasolina] = 100; format(cadena, 128, "Tanque llenado correctamente por: $%d", varex[playerid][1]); SendClientMessage(playerid, 0xF07B0FFF, cadena); GivePlayerMoney(playerid, -varex[playerid][1]); TogglePlayerControllable(playerid, 1); } } func(playerid, GetPlayerVehicleID(playerid)); return 1; } forward Gastrade(playerid, vehicleid); public Gastrade(playerid, vehicleid) { if(!Estaengas(playerid)) return SendClientMessage(playerid, 0xF07B0FFF, "No estas en una estaciуn de gasolina."); if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, 0xF07B0FFF, "Debes ser el conductor de un vehiculo para pagar por gasolina."); new veh = GetPlayerVehicleID(playerid), gas = Info[veh][Gasolina], price = 10, cadena[256]; if(Escamion(veh)){ new result = 120 - gas, mony = GetPlayerMoney(playerid); result = result * price; if(gas == 120) return SendClientMessage(playerid, 0xF07B0FFF, "El tanque esta lleno."); if(mony < result) { new differ = result - mony; format(cadena, 256, "El litro de gasolina cuesta $10, te faltan $%d para poder llenar tanque, usa /combustible para pagar otra cantidad.", differ); return SendClientMessage(playerid, 0xF07B0FFF, cadena); } varex[playerid][0] = 120; varex[playerid][1] = result; timercharge[playerid] = SetTimerEx("timerchargef", 5000, false, "u", playerid); TogglePlayerControllable(playerid, 0); GameTextForPlayer(playerid, "~y~Llenando tanque, espera porfavor.", 5000, 5); } else if(!Escamion(playerid)){ new result = 100 - gas, mony = GetPlayerMoney(playerid); result = result * price; if(gas == 100) return SendClientMessage(playerid, 0xF07B0FFF, "El tanque esta lleno."); if(mony < result) { new differ = result - mony; format(cadena, 256, "El litro de gasolina cuesta $10, te faltan $%d para poder llenar tanque, usa /litro para pagar otra cantidad.", differ); return SendClientMessage(playerid, 0xF07B0FFF, cadena); } varex[playerid][0] = 100; varex[playerid][1] = result; timercharge[playerid] = SetTimerEx("timerchargef", 5000, false, "u", playerid); TogglePlayerControllable(playerid, 0); GameTextForPlayer(playerid, "~y~Llenando tanque, espera porfavor.", 5000, 5); } return 1; } Escamion(vehicleid) { switch(GetVehicleModel(vehicleid)) { case 499, 498, 609, 524, 578, 455, 403, 414, 443, 514, 408, 456: return 1; } return 0; } stock GetXYZInFrontOfPlayer(playerid, &Float: x, &Float: y, &Float: z, Float: distance) { new Float: a; GetPlayerPos (playerid, x, y, z); GetPlayerFacingAngle (playerid, a); x += (distance * floatsin (-a, degrees)); y += (distance * floatcos (-a, degrees)); return 1; } GetClosestVehicleID(playerid) { new Float:min_dist = 100.0; new Float:dist; new Float:vehx,Float:vehy,Float:vehz; new Float:px,Float:py,Float:pz; new Float:x,Float:y,Float:z; GetPlayerPos(playerid,px,py,pz); new close_vehid; for(new i = 1; i < MAX_VEHICLES;i++) { if(GetVehicleModel(i) > 0) { GetVehiclePos(i,vehx,vehy,vehz); x = px - vehx; y = py - vehy; z = pz - vehz; dist = floatsqroot((x * x) + (y * y) + (z * z)); if(dist < min_dist) { min_dist = dist; close_vehid = i; } } } return close_vehid; }