Jump to content
  • 0

pomoc Palivovy TextDraw


DJ_Oli22

Dotaz

Zdravim

Mam problem ze sa mi bugol TextDraw paliva vsetko fungovalo ako mala a zrazu mi ten textdraw zacalo hadzat ako keby k inemu ze tam kde mam hodiny serveru tak mi skacu raz hodiny raz palivo a kazde auto ma na zaciatku 0 paliva vedeli by ste mi poradit?

Nehadze mi to ani warning..teda ohladom benzinu ani jeden :)

new Text:BenzinTD[MAX_PLAYERS];

OnGameModeInIt

for(new i; i < MAX_PLAYERS;i++){
BenzinTD[i] = TextDrawCreate(280.000000, 390.000000, "~b~~b~PALIVO: ~w~100");
TextDrawBackgroundColor(BenzinTD[i],255);
TextDrawFont(BenzinTD[i],2);
TextDrawLetterSize(BenzinTD[i], 0.440000, 2.400000);
TextDrawColor(BenzinTD[i], 16711935);
TextDrawSetOutline(BenzinTD[i], 1);
TextDrawSetProportional(BenzinTD[i], 1);
}
for(new y; y < MAX_VEHICLES;y++){
Benzin[y] = 100;
}

v Include

public FuelUp(playerid){
new engine,lights,alarm,doors,bonnet,boot,objective;
for(new i; i <= BenzinCount;i++){
if(IsPlayerInRangeOfPoint(playerid,4,BenzinPos[i][0],BenzinPos[i][1],BenzinPos[i][2])){
new car = GetPlayerVehicleID(playerid);
if(GetPlayerMoney(playerid) < BENZIN_CENA){
IB(playerid,1,"Nemas dostatok penazi");
}else{
if(Benzin[car] < 100){
Benzin[car]++;
GivePlayerMoney(playerid,-BENZIN_CENA);
GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(car,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
}
break;
}
}
return true;
}


public FuelUpdate(){
new engine,lights,alarm,doors,bonnet,boot,objective;
ForPlayers(i){
new car = GetPlayerVehicleID(i);
if(car == 481 || car == 509 || car == 510){
Benzin[car] = 20;
TextDrawHideForPlayer(i,BenzinTD[i]);
}else if(car > 0 && car != 481 && car != 509 && car != 510){
new str[100];
SetPVarInt(i,"BenzinUpdate",GetPVarInt(i,"BenzinUpdate")+1);
if(GetPlayerState(i) == PLAYER_STATE_DRIVER){
FuelUp(i);
}
if(GetPVarInt(i,"BenzinUpdate") == 50 && GetPlayerSpeed(car,true) > 0) {
SetPVarInt(i,"BenzinUpdate",0);
Benzin[car] -= random(2)+1;
}
format(str,100,"~b~~b~PALIVO: ~w~%d",Benzin[car]);
TextDrawSetString(BenzinTD[i],str);
TextDrawShowForPlayer(i,BenzinTD[i]);
if(Benzin[car] < 1){
GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(car,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
IB(i,2,"Vozidlu dosiel benzin");
}
}
}
return true;
}

OnPlayerStateChange

if(newstate == PLAYER_STATE_DRIVER){
new car = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
if(Benzin[car] < 1){
GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(car,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
IB(i,2,"Vozidlu dosiel benzin");
}
Link to comment
Share on other sites

2 odpovědí na tuto otázku

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...