SHOW:
|
|
- or go back to the newest paste.
| 1 | //############### TODOS OS DIREITOS RESERVADOR À LEONARDO1434 ! | |
| 2 | //############### NÃO REMOVER OS CRÉDITOS ! | |
| 3 | //############### FAÇA BOM USO ! | |
| 4 | ||
| 5 | // includes | |
| 6 | #include <a_samp> | |
| 7 | #include zcmd | |
| 8 | #include <SII> | |
| 9 | // fim includes | |
| 10 | ||
| 11 | // defines | |
| 12 | #define FILTERSCRIPT | |
| 13 | #define VERDE 0x008000FF | |
| 14 | #define VERMELHO 0xFF0000FF | |
| 15 | #define AMARELO 0xFFFF00FF | |
| 16 | #define VEICULO_LIGADO VEHICLE_PARAMS_ON | |
| 17 | #define VEICULO_DESLIGADO VEHICLE_PARAMS_OFF | |
| 18 | // fim defines | |
| 19 | ||
| 20 | // news | |
| 21 | new gasolina[MAX_VEHICLES]; | |
| 22 | new enchendo[MAX_PLAYERS] = 0; | |
| 23 | new marcha[MAX_PLAYERS]; | |
| 24 | new bool:ativado[MAX_PLAYERS]; | |
| 25 | new Text:velocimetro[MAX_PLAYERS]; | |
| 26 | new motor,luzes,alarme,porta,capota,mala,objetivo; | |
| 27 | // fim new | |
| 28 | ||
| 29 | // forwards | |
| 30 | forward poucagas(playerid); | |
| 31 | forward enchertank(playerid); | |
| 32 | forward ativa(playerid,params[]); | |
| 33 | // fim forwards | |
| 34 | ||
| 35 | public OnFilterScriptInit() | |
| 36 | {
| |
| 37 | print("=================================");
| |
| 38 | print("Sistema de engine By Leonardo1434");
| |
| 39 | print("Sistema de engine carregado !");
| |
| 40 | print("=================================");
| |
| 41 | SetTimer("poucagas",6500,true);
| |
| 42 | for(new i=0;i<MAX_PLAYERS;i++) | |
| 43 | {
| |
| 44 | velocimetro[i] = TextDrawCreate(1.0,433.0," "); | |
| 45 | TextDrawAlignment(velocimetro[i],0); | |
| 46 | TextDrawBackgroundColor(velocimetro[i],0x000000ff); | |
| 47 | TextDrawFont(velocimetro[i],1); | |
| 48 | TextDrawLetterSize(velocimetro[i],0.299999,1.200000); | |
| 49 | TextDrawColor(velocimetro[i],0xffffffff); | |
| 50 | TextDrawSetOutline(velocimetro[i],1); | |
| 51 | TextDrawSetProportional(velocimetro[i],1); | |
| 52 | TextDrawSetShadow(velocimetro[i],1); | |
| 53 | } | |
| 54 | for(new i=0;i<MAX_VEHICLES;i++) {
| |
| 55 | gasolina[i] = 0 + random(100); | |
| 56 | } | |
| 57 | return 1; | |
| 58 | } | |
| 59 | public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) | |
| 60 | {
| |
| 61 | TextDrawShowForPlayer(playerid,velocimetro[playerid]); | |
| 62 | return 1; | |
| 63 | } | |
| 64 | public OnPlayerConnect(playerid) | |
| 65 | {
| |
| 66 | CreatePlayer3DTextLabel(playerid,"DIGITAR /GASOLINA PARA ENCHER O TANQUE !",0x008080FF,1944.7036,-1774.6039,13.3906,50.0); | |
| 67 | CreatePlayer3DTextLabel(playerid,"DIGITAR /GASOLINA PARA ENCHER O TANQUE !",0x008080FF,1836.1078,-2428.0291,13.5547,500.0); | |
| 68 | SetPlayerMapIcon( playerid, 54, 1944.7036,-1774.6039,13.3906, 55, 3 ); | |
| 69 | SetPlayerMapIcon( playerid, 55, 1836.1078,-2428.0291,13.5547, 55, 3 ); | |
| 70 | return 1; | |
| 71 | } | |
| 72 | public OnPlayerUpdate(playerid) | |
| 73 | {
| |
| 74 | if(marcha[playerid] == 1) {
| |
| 75 | if(GetPlayerSpeed(playerid) > 10) {
| |
| 76 | marcha[playerid] ++; | |
| 77 | } | |
| 78 | } | |
| 79 | else if(GetPlayerSpeed(playerid) < 10) {
| |
| 80 | marcha[playerid] = 1; | |
| 81 | } | |
| 82 | if(marcha[playerid] == 2) {
| |
| 83 | if(GetPlayerSpeed(playerid) > 40) {
| |
| 84 | marcha[playerid] ++; | |
| 85 | } | |
| 86 | } | |
| 87 | else if(GetPlayerSpeed(playerid) < 40 && GetPlayerSpeed(playerid) > 10) {
| |
| 88 | marcha[playerid] = 2; | |
| 89 | } | |
| 90 | if(marcha[playerid] == 3) {
| |
| 91 | if(GetPlayerSpeed(playerid) > 70) {
| |
| 92 | marcha[playerid] ++; | |
| 93 | } | |
| 94 | } | |
| 95 | else if(GetPlayerSpeed(playerid) < 70 && GetPlayerSpeed(playerid) > 40) {
| |
| 96 | marcha[playerid] = 3; | |
| 97 | } | |
| 98 | if(marcha[playerid] == 4) {
| |
| 99 | if(GetPlayerSpeed(playerid) > 100) {
| |
| 100 | marcha[playerid] ++; | |
| 101 | } | |
| 102 | } | |
| 103 | else if(GetPlayerSpeed(playerid) < 100 && GetPlayerSpeed(playerid) > 70) {
| |
| 104 | marcha[playerid] = 4; | |
| 105 | } | |
| 106 | if(marcha[playerid] == 5) {
| |
| 107 | if(GetPlayerSpeed(playerid) > 130) {
| |
| 108 | marcha[playerid] ++; | |
| 109 | } | |
| 110 | } | |
| 111 | else if(GetPlayerSpeed(playerid) < 130 && GetPlayerSpeed(playerid) > 100) {
| |
| 112 | marcha[playerid] = 5; | |
| 113 | } | |
| 114 | if(marcha[playerid] == 6) {
| |
| 115 | if(GetPlayerSpeed(playerid) > 130) {
| |
| 116 | } | |
| 117 | } | |
| 118 | new string[256]; | |
| 119 | if(IsPlayerInAnyVehicle(playerid)) {
| |
| 120 | new veiculoid = GetPlayerVehicleID(playerid); | |
| 121 | TextDrawHideForPlayer(playerid, velocimetro[playerid]); | |
| 122 | format(string,sizeof(string),"~g~Velocidade ~r~%dKM/H - Marcha %d - Gasolina: %i L",GetPlayerSpeed(playerid),marcha[playerid],gasolina[veiculoid]); | |
| 123 | TextDrawSetString(velocimetro[playerid], string); | |
| 124 | TextDrawShowForPlayer(playerid, velocimetro[playerid]); | |
| 125 | } | |
| 126 | else TextDrawHideForPlayer(playerid,velocimetro[playerid]); | |
| 127 | } | |
| 128 | ||
| 129 | public OnPlayerExitVehicle(playerid, vehicleid) | |
| 130 | {
| |
| 131 | TogglePlayerControllable(playerid,1); | |
| 132 | return 1; | |
| 133 | } | |
| 134 | ||
| 135 | public OnPlayerStateChange(playerid, newstate, oldstate) | |
| 136 | {
| |
| 137 | new veiculoid = GetPlayerVehicleID(playerid); | |
| 138 | if(newstate == PLAYER_STATE_DRIVER) | |
| 139 | {
| |
| 140 | marcha[playerid] = 1; | |
| 141 | GetVehicleParamsEx(veiculoid,motor,luzes,alarme,porta,capota,mala,objetivo); | |
| 142 | SetVehicleParamsEx(veiculoid,VEICULO_DESLIGADO,luzes,alarme,porta,capota,mala,objetivo); | |
| 143 | } | |
| 144 | return 1; | |
| 145 | } | |
| 146 | public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) | |
| 147 | {
| |
| 148 | if (newkeys && KEY_FIRE) | |
| 149 | {
| |
| 150 | if (IsPlayerInAnyVehicle(playerid)) | |
| 151 | {
| |
| 152 | ativado[playerid] = true; | |
| 153 | SetTimerEx("ativa",2000,false,"i",playerid);
| |
| 154 | } | |
| 155 | } | |
| 156 | return 1; | |
| 157 | } | |
| 158 | CMD:gas(playerid,params[]) | |
| 159 | {
| |
| 160 | if(IsPlayerInAnyVehicle(playerid)) | |
| 161 | {
| |
| 162 | new car = GetPlayerVehicleID(playerid); | |
| 163 | SetVehiclePos(car,1944.7036,-1774.6039,13.3906); | |
| 164 | PutPlayerInVehicle(playerid,car,0); | |
| 165 | } | |
| 166 | else SetPlayerPos(playerid,1944.7036,-1774.6039,13.3906); | |
| 167 | return 1; | |
| 168 | } | |
| 169 | CMD:ligarcar(playerid, params[]) | |
| 170 | {
| |
| 171 | new veiculoid = GetPlayerVehicleID(playerid); | |
| 172 | if(IsPlayerInAnyVehicle(playerid)) | |
| 173 | {
| |
| 174 | GetVehicleParamsEx(veiculoid,motor,luzes,alarme,porta,capota,mala,objetivo); | |
| 175 | if(motor == VEICULO_LIGADO) | |
| 176 | {
| |
| 177 | SendClientMessage(playerid,0x800000AA," O Veiculo já está ligado!"); | |
| 178 | return 1; | |
| 179 | } | |
| 180 | else | |
| 181 | {
| |
| 182 | new Chance = random(5); | |
| 183 | {
| |
| 184 | switch(Chance) | |
| 185 | {
| |
| 186 | case 1,2: | |
| 187 | {
| |
| 188 | GetVehicleParamsEx(veiculoid,motor,luzes,alarme,porta,capota,mala,objetivo); | |
| 189 | SetVehicleParamsEx(veiculoid,VEICULO_LIGADO,luzes,alarme,porta,capota,mala,objetivo); | |
| 190 | SendClientMessage(playerid,0x008040AA,"CARRO LIGADO !"); | |
| 191 | } | |
| 192 | case 3,4,5: | |
| 193 | {
| |
| 194 | SendClientMessage(playerid,0x008040AA," Você falhou na iniciação do carro ! tenta novamente !"); | |
| 195 | } | |
| 196 | } | |
| 197 | } | |
| 198 | } | |
| 199 | } | |
| 200 | else | |
| 201 | {
| |
| 202 | SendClientMessage(playerid,0x800000AA," Você não está em um veiculo!"); | |
| 203 | } | |
| 204 | return 1; | |
| 205 | } | |
| 206 | ||
| 207 | CMD:gasolina(playerid,params[]) | |
| 208 | {
| |
| 209 | if(IsPlayerInRangeOfPoint(playerid,3.0,1944.7036,-1774.6039,13.3906) || IsPlayerInRangeOfPoint(playerid,30.0,1836.1078,-2428.0291,13.5547)) | |
| 210 | {
| |
| 211 | if (enchendo[playerid]) return SendClientMessage(playerid,0xFFC800FF,"Já está enchendo o tanque"); | |
| 212 | if (GetPlayerMoney(playerid) - 500 <0) return SendClientMessage(playerid,0xFFC800FF,"Sem dinheiro suficiente"); | |
| 213 | GivePlayerMoney(playerid,-500); | |
| 214 | SendClientMessage(playerid,-1,"Você gastou 500 reais em um combustível aleatório !"); | |
| 215 | TogglePlayerControllable(playerid,0); | |
| 216 | enchendo[playerid] = 1; | |
| 217 | SetTimerEx("enchertank",4500,false,"i",playerid);
| |
| 218 | } | |
| 219 | else SendClientMessage(playerid,-1,"Você não está perto do posto de gasolina"); | |
| 220 | return 1; | |
| 221 | } | |
| 222 | CMD:gass(playerid,params[]) | |
| 223 | {
| |
| 224 | if(IsPlayerInAnyVehicle(playerid)) | |
| 225 | {
| |
| 226 | new car = GetPlayerVehicleID(playerid); | |
| 227 | SetVehiclePos(playerid,1836.1078,-2428.0291,13.5547); | |
| 228 | PutPlayerInVehicle(playerid,car,0); | |
| 229 | } | |
| 230 | else SetPlayerPos(playerid,1836.1078,-2428.0291,13.5547); | |
| 231 | return 1; | |
| 232 | } | |
| 233 | CMD:desligacar(playerid, params[]) | |
| 234 | {
| |
| 235 | new veiculoid = GetPlayerVehicleID(playerid); | |
| 236 | if(IsPlayerInAnyVehicle(playerid)) | |
| 237 | {
| |
| 238 | GetVehicleParamsEx(veiculoid,motor,luzes,alarme,porta,capota,mala,objetivo); | |
| 239 | if(motor == VEICULO_DESLIGADO) | |
| 240 | {
| |
| 241 | SendClientMessage(playerid,0x800000AA," O Veiculo já está desligado!"); | |
| 242 | return 1; | |
| 243 | } | |
| 244 | else {
| |
| 245 | SetVehicleParamsEx(veiculoid,VEICULO_DESLIGADO,luzes,alarme,porta,capota,mala,objetivo); | |
| 246 | SendClientMessage(playerid,0x008040AA," Motor Desligado."); | |
| 247 | } | |
| 248 | } | |
| 249 | else | |
| 250 | {
| |
| 251 | SendClientMessage(playerid,0x800000AA," Você não está em um veiculo!"); | |
| 252 | } | |
| 253 | return 1; | |
| 254 | } | |
| 255 | public poucagas(playerid) | |
| 256 | {
| |
| 257 | for(new i=0;i<MAX_PLAYERS;i++) {
| |
| 258 | if (enchendo[i]) continue; | |
| 259 | new veiculoid = GetPlayerVehicleID(i); | |
| 260 | if (GetPlayerVehicleSeat(i) == 0) {
| |
| 261 | gasolina[veiculoid] = gasolina[veiculoid] -1; | |
| 262 | if (gasolina[veiculoid]<1) | |
| 263 | {
| |
| 264 | gasolina[veiculoid] = 0; | |
| 265 | RemovePlayerFromVehicle(i); | |
| 266 | - | GameTextForPlayer(i,"~r~SEM GASOLINA!",5000,4); |
| 266 | + | SendClientMessage(i,-1,"Sem gasolina"); |
| 267 | } | |
| 268 | } | |
| 269 | new string[125]; | |
| 270 | format(string,sizeof(string),"~g~Velocidade ~r~%dKM/H - Marcha %d - Gasolina %i L",GetPlayerSpeed(playerid),marcha[playerid],gasolina[veiculoid]); | |
| 271 | TextDrawSetString(velocimetro[playerid], string); | |
| 272 | } | |
| 273 | return 1; | |
| 274 | } | |
| 275 | public ativa(playerid,params[]) | |
| 276 | {
| |
| 277 | new veiculoid = GetPlayerVehicleID(playerid); | |
| 278 | GetVehicleParamsEx(veiculoid,motor,luzes,alarme,porta,capota,mala,objetivo); | |
| 279 | if(motor == VEICULO_DESLIGADO) | |
| 280 | {
| |
| 281 | if(ativado[playerid] == true) | |
| 282 | {
| |
| 283 | cmd_ligarcar(playerid,params); | |
| 284 | ativado[playerid] = false; | |
| 285 | } | |
| 286 | } | |
| 287 | else return 0; | |
| 288 | return 1; | |
| 289 | } | |
| 290 | public enchertank(playerid) | |
| 291 | {
| |
| 292 | new veiculoid = GetPlayerVehicleID(playerid); | |
| 293 | gasolina[veiculoid] = gasolina[veiculoid] = 0 + random(200); | |
| 294 | enchendo[playerid] = 0; | |
| 295 | new string[125]; | |
| 296 | format(string,sizeof(string),"~g~Velocidade ~r~%dKM/H - Marcha %d - Gasolina %i L",GetPlayerSpeed(playerid),marcha[playerid],gasolina[veiculoid]); | |
| 297 | TextDrawSetString(velocimetro[playerid], string); | |
| 298 | TogglePlayerControllable(playerid,true); | |
| 299 | SendClientMessage(playerid,-1,"Combustível aleatório adicionado !"); | |
| 300 | } | |
| 301 | stock GetPlayerSpeed(playerid) | |
| 302 | {
| |
| 303 | new Float:ST[4]; | |
| 304 | if(IsPlayerInAnyVehicle(playerid)) | |
| 305 | GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]); | |
| 306 | else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]); | |
| 307 | ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 155.0; | |
| 308 | return floatround(ST[3]); | |
| 309 | } | |
| 310 | ||
| 311 | //########################################################## DIREITOS RESERVADOS À LEONARDO1434 ########################################### |