#include a_samp
#include progress
#if !defined CallBack
#define CallBack::%0(%1) %0(%1); public %0(%1)
#endif
#define MAX_INT 2
new
Bar:Barra[ MAX_PLAYERS],
Nitro[MAX_PLAYERS char],
PlayersConectados,
Text:TextDraw
;
public OnPlayerConnect(playerid){
Barra[playerid] = CreateProgressBar(505.00, 380.00, 109.50, 9.19, 0x00BFFFFF, 100.0);
Nitro{playerid} = 100;
return PlayersConectados++, true;
}
public OnPlayerDisconnect(playerid, reason){
return PlayersConectados--, true;
}
public OnFilterScriptInit(){
printf (#===========================);
printf (#Advanced Nitrous system);
printf (#Criado por: SuYaNW. Dacio);
printf (#- Carregado!);
printf (#===========================);
SetTimer("UpdateNos", MAX_INT * 1000, true);
TextDraw = TextDrawCreate(501.000000, 366.000000, "Nitro:");
TextDrawBackgroundColor(TextDraw, 16777215);
TextDrawFont(TextDraw, 1);
TextDrawLetterSize(TextDraw, 0.590000, 1.200000);
TextDrawColor(TextDraw, 255);
TextDrawSetOutline(TextDraw, 1);
TextDrawSetProportional(TextDraw, 1);
return true;
}
public OnPlayerEnterVehicle(playerid, vehicleid){
if(zNitro(vehicleid)){
AddVehicleComponent(vehicleid, 1010);
}
return true;
}
public OnPlayerExitVehicle(playerid, vehicleid){
if(zNitro(vehicleid)){
HideProgressBarForPlayer(playerid, Barra[playerid]);
TextDrawHideForPlayer(playerid, TextDraw);
}
return true;
}
public OnPlayerSpawn(playerid){
Nitro{playerid} = 100;
return true;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInAnyVehicle(playerid) && zNitro(GetPlayerVehicleID(playerid)) && (oldkeys & 4)) {
TextDrawShowForPlayer(playerid, TextDraw);
if(Nitro{playerid} != 0){
RemoveVehicleComponent(GetPlayerVehicleID(playerid), 1010);
AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
Nitro{playerid} -= 5;
SetProgressBarValue(Barra[playerid], Nitro{playerid});
UpdateProgressBar(Barra[playerid], playerid);
ShowProgressBarForPlayer(playerid, Barra[playerid]);
}else{
RemoveVehicleComponent(GetPlayerVehicleID(playerid), 1010);
}
}
return true;
}
CallBack::UpdateNos(vehicleid){
static
Interator
;
for(Interator = 0; Interator != PlayersConectados; ++Interator){
if(IsPlayerInAnyVehicle(Interator)){
if(Nitro{Interator} < 100){
Nitro{Interator} += 5;
SetProgressBarValue(Barra[Interator], Nitro{Interator});
UpdateProgressBar(Barra[Interator], Interator);
ShowProgressBarForPlayer(Interator, Barra[Interator]);
}
}
}
return true;
}
CallBack::zNitro(vehicleid){
switch(GetVehicleModel(vehicleid))
{
case
444, 581, 586, 481, 509, 446, 556, 443, 452, 453, 454, 472,
473, 484, 493, 495, 462, 463, 468, 521, 522, 417, 425, 447,
488, 497, 501, 548, 563, 406, 520, 539, 553, 557, 573, 460,
464, 476, 511, 512, 577, 592, 471, 448, 461, 523, 510, 487,
430, 465, 469, 513, 593, 419:
return false ;
}
return true ;
}
boa sobre quem quiser a include progress mais o create progress visite o link do toribio esse cara e foda!
https://sampforum.blast.hk/showthread.php?tid=113443 poucos aqui conhecem as coisas boas que tem pelo forum tem muitas includes foda por ae basta pesquisar! |
Crйditos
Bom, o sistema foi totalmente elaborado por min, mais tive que utilizar uma include, para fazer a barra de progresso, ela se chama Progress Bar, criada pelo nosso amigo Torobio (link). |