Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2013-03-19, 13:06


TerraNova







Wiek: 36
Na forum: 5118 dni
Posty: 98
Nick w MP: Lonalchemik

Piwa: 797

Respekt: 70,5

Nie dzia?aj? mi rowery odpalam 2+e nic si? nie dzieje inne pojazdy dzia?aj? czy?by problem by? po stronie tego


Kod:

for(new i = 0; i<MAX_VEHICLES; i++)
{
Pojazd[i][Zamkniety] = -1;
Pojazd[i][Paliwo] = 50;

if(IsTruck(i))
{
Pojazd[i][Paliwo] = 220;
}
else if(IsDost(i) == 1)
{
Pojazd[i][Paliwo] = 70;
}
else if(IsMotor(i) == 1)
{
Pojazd[i][Paliwo] = 18;
}
}


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-03-19, 16:34


Combacior







Wiek: 29
Na forum: 5796 dni
Posty: 1516

Piwa: 2161

Respekt: 1060
Respekt: 1060

Ostrzeżeń: 20%
Poka? funkcje IsTruck, IsDost oraz IsMotor

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-03-19, 16:47


TerraNova







Wiek: 36
Na forum: 5118 dni
Posty: 98
Nick w MP: Lonalchemik

Piwa: 797

Respekt: 70,5

w public OnPlayerUpdate(playerid)

Kod:

if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
GetVehicleHealth(GetPlayerVehicleID(playerid), Pojazd[GetPlayerVehicleID(playerid)][Stan]);
if(IsBicycle(GetPlayerVehicleID(playerid)) == 1)
{
format(FormatPojazdTD, sizeof(FormatPojazdTD), "|Nazwa: %s|Predkosc: %d km/h|Przebieg: %.1f km|HP: %.0f%|", GetVehicleName(GetPlayerVehicleID(playerid)), GetPlayerSpeed(playerid),Pojazd[GetPlayerVehicleID(playerid)][Przebieg], Pojazd[GetPlayerVehicleID(playerid)][Stan]/10);
TextDrawSetString(PojazdTD[playerid], FormatPojazdTD);
}
else if(IsTruck(GetPlayerVehicleID(playerid)) == 1)
{
GetPVarString(playerid, "Towar", Towar[playerid], 24);
format(FormatPojazdTD, sizeof(FormatPojazdTD), "|Nazwa: %s|Predkosc: %d km/h|Paliwo: %d l|Przebieg: %.1f km|HP: %.0f%|Towar: %s|", GetVehicleName(GetPlayerVehicleID(playerid)), GetPlayerSpeed(playerid),Pojazd[GetPlayerVehicleID(playerid)][Paliwo],Pojazd[GetPlayerVehicleID(playerid)][Przebieg], Pojazd[GetPlayerVehicleID(playerid)][Stan]/10, Towar[playerid]);
TextDrawSetString(PojazdTD[playerid], FormatPojazdTD);
}
else if(IsDost(GetPlayerVehicleID(playerid)) == 1)
{
GetPVarString(playerid, "Towar", Towar[playerid], 24);
format(FormatPojazdTD, sizeof(FormatPojazdTD), "|Nazwa: %s|Predkosc: %d km/h|Paliwo: %d l|Przebieg: %.1f km|HP: %.0f%|Towar: %s|", GetVehicleName(GetPlayerVehicleID(playerid)), GetPlayerSpeed(playerid),Pojazd[GetPlayerVehicleID(playerid)][Paliwo],Pojazd[GetPlayerVehicleID(playerid)][Przebieg], Pojazd[GetPlayerVehicleID(playerid)][Stan]/10, Towar[playerid]);
TextDrawSetString(PojazdTD[playerid], FormatPojazdTD);
}
else if(IsPlane(GetPlayerVehicleID(playerid)) == 1)
{
GetPlayerPos(playerid,Gracz[playerid][Wysokosc1],Gracz[playerid][Wysokosc2], Gracz[playerid][Wysokosc3]);
format(FormatPojazdTD, sizeof(FormatPojazdTD), "|Nazwa: %s|Predkosc: %d km/h|Wysokosc: %.2f m|Paliwo: %d l|Przebieg: %.1f km|HP: %.0f%|", GetVehicleName(GetPlayerVehicleID(playerid)), GetPlayerSpeed(playerid),Gracz[playerid][Wysokosc3],Pojazd[GetPlayerVehicleID(playerid)][Paliwo],Pojazd[GetPlayerVehicleID(playerid)][Przebieg], Pojazd[GetPlayerVehicleID(playerid)][Stan]/10);
TextDrawSetString(PojazdTD[playerid], FormatPojazdTD);
}
else if(IsHeli(GetPlayerVehicleID(playerid)) == 1)
{
GetPlayerPos(playerid,Gracz[playerid][Wysokosc1], Gracz[playerid][Wysokosc2], Gracz[playerid][Wysokosc3]);
format(FormatPojazdTD, sizeof(FormatPojazdTD), "|Nazwa: %s|Predkosc: %d km/h|Wysokosc: %.2f m|Paliwo: %d l|Przebieg: %.1f km|HP: %.0f%|", GetVehicleName(GetPlayerVehicleID(playerid)), GetPlayerSpeed(playerid),Gracz[playerid][Wysokosc3],Pojazd[GetPlayerVehicleID(playerid)][Paliwo],Pojazd[GetPlayerVehicleID(playerid)][Paliwo], Pojazd[GetPlayerVehicleID(playerid)][Przebieg], Pojazd[GetPlayerVehicleID(playerid)][Stan]/10);
TextDrawSetString(PojazdTD[playerid], FormatPojazdTD);
}
else
{
format(FormatPojazdTD, sizeof(FormatPojazdTD), "|Nazwa: %s|Predkosc: %d km/h|Paliwo: %d l|Przebieg: %.1f km|HP: %.0f%|", GetVehicleName(GetPlayerVehicleID(playerid)), GetPlayerSpeed(playerid),Pojazd[GetPlayerVehicleID(playerid)][Paliwo],Pojazd[GetPlayerVehicleID(playerid)][Przebieg],Pojazd[GetPlayerVehicleID(playerid)][Stan]/10);
TextDrawSetString(PojazdTD[playerid], FormatPojazdTD);
}
}



w public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])


Kod:

{
if(IsPlayerInAnyVehicle(playerid))
{
if(IsTruck(GetPlayerVehicleID(playerid)))
{
if(Pojazd[GetPlayerVehicleID(playerid)][Paliwo] + 15 > 270)
return SendClientMessage(playerid, JCZERWONY,"Nie mo?esz wla? wi?cej paliwa ni? mie?ci zbiornik.");
}
else if(IsDost(GetPlayerVehicleID(playerid)))
{
if(Pojazd[GetPlayerVehicleID(playerid)][Paliwo] + 15 > 70)
return SendClientMessage(playerid, JCZERWONY,"Nie mo?esz wla? wi?cej paliwa ni? mie?ci zbiornik.");
}
else if(IsMotor(GetPlayerVehicleID(playerid)))
{
if(Pojazd[GetPlayerVehicleID(playerid)][Paliwo] + 15 > 18)
return SendClientMessage(playerid, JCZERWONY,"Nie mo?esz wla? wi?cej paliwa ni? mie?ci zbiornik.");
}
else
{
if(Pojazd[GetPlayerVehicleID(playerid)][Paliwo] + 15 > 50)
return SendClientMessage(playerid, JCZERWONY,"Nie mo?esz wla? wi?cej paliwa ni? mie?ci zbiornik.");
}
if(Plecak[playerid][pKanister] > 0)
{
SendClientMessage(playerid, ZOLTY,"Wla?e? paliwo z kanistra do zbiornika.");
Plecak[playerid][pKanister]--;
Pojazd[GetPlayerVehicleID(playerid)][Paliwo] = Pojazd[GetPlayerVehicleID(playerid)][Paliwo] + 15;
}
else
{
SendClientMessage(playerid, SZARY,"Nie masz kanistra. Udaj si? na stacj? aby go kupi?.");
}
}
else
{
SendClientMessage(playerid, JCZERWONY,"Nie jeste? w poje?dzie wi?c nie mo?esz wla? paliwa.");
}
}


Kod:

{
if(IsTruck(GetPlayerVehicleID(playerid)) == 1)
{
Pojazd[GetPlayerVehicleID(playerid)][Paliwo] = 220;
}
else if(IsDost(GetPlayerVehicleID(playerid)) == 1)
{
Pojazd[GetPlayerVehicleID(playerid)][Paliwo] = 70;
}
else if(IsMotor(GetPlayerVehicleID(playerid)) == 1)
{
Pojazd[GetPlayerVehicleID(playerid)][Paliwo] = 18;
}
else
{
Pojazd[GetPlayerVehicleID(playerid)][Paliwo] = 50;
}
}


Kod:

{
if(!IsPlayerInAnyVehicle(playerid))
return SendClientMessage(playerid,JCZERWONY,"Musisz by? w poje?dzie by m?c zatankowa?.");
if(IsBicycle(GetPlayerVehicleID(playerid)))
return SendClientMessage(playerid,JCZERWONY,"Roweru nie mo?na zatankowa?.");
if(PaliwoStation[GetPVarInt(playerid, "Stacja")] == 0)
return SendClientMessage(playerid,JCZERWONY,"Na tej stacji nie ma paliwa.");
if(IsTruck(GetPlayerVehicleID(playerid)))
{
format(String128, sizeof String128, "Wpisz ile litr?w paliwa chcesz kupi?.\n Maksymalna ilo?? dla twojego pojazdu to %d.", 270 - Pojazd[GetPlayerVehicleID(playerid)][Paliwo]);
}
else if(IsDost(GetPlayerVehicleID(playerid)))
{
format(String128, sizeof String128, "Wpisz ile litr?w paliwa chcesz kupi?.\n Maksymalna ilo?? dla twojego pojazdu to %d.", 70 - Pojazd[GetPlayerVehicleID(playerid)][Paliwo]);
}
else if(IsMotor(GetPlayerVehicleID(playerid)))
{
format(String128, sizeof String128, "Wpisz ile litr?w paliwa chcesz kupi?.\n Maksymalna ilo?? dla twojego pojazdu to %d.", 18 - Pojazd[GetPlayerVehicleID(playerid)][Paliwo]);
}
else
{
format(String128, sizeof String128, "Wpisz ile litr?w paliwa chcesz kupi?.\n Maksymalna ilo?? dla twojego pojazdu to %d.", 50 - Pojazd[GetPlayerVehicleID(playerid)][Paliwo]);
}
ShowPlayerDialog(playerid, ZAKUPPALIWA, DIALOG_STYLE_INPUT, "Zakup paliwa", String128, "Ok", "Anuluj");
}


Kod:

{
if(IsTruck(GetPlayerVehicleID(playerid)))
{
new id = GetPVarInt(playerid, "Stacja");
if(strval(inputtext) > 270 - Pojazd[GetPlayerVehicleID(playerid)][Paliwo])
return SendClientMessage(playerid, JCZERWONY, "Tw?j bak nie pomie?ci tyle paliwa.");
if(strval(inputtext) > PaliwoStation[id])
return SendClientMessage(playerid, JCZERWONY, "Na stacji nie ma tyle paliwa.");
if(strval(inputtext) * StationPrice[id] > GetPVarInt(playerid, "kasa"))
return SendClientMessage(playerid, JCZERWONY, "Nie masz tyle pieni?dzy.");
{
format(String128, sizeof(String128),"Zakupi?e? %d litr?w paliwa za kwot? %d z?.", strval(inputtext), strval(inputtext)*StationPrice[id]);
PaliwoStation[id] = PaliwoStation[id] - strval(inputtext);
GivePVarInt(playerid, "kasa", - strval(inputtext)*StationPrice[id]);
Pojazd[GetPlayerVehicleID(playerid)][Paliwo] = Pojazd[GetPlayerVehicleID(playerid)][Paliwo] + strval(inputtext);
ZapiszStacje(id);
}
}
else if(IsDost(GetPlayerVehicleID(playerid)))
{
new id = GetPVarInt(playerid, "Stacja");
if(strval(inputtext) > 70 - Pojazd[GetPlayerVehicleID(playerid)][Paliwo])
return SendClientMessage(playerid, JCZERWONY, "Tw?j bak nie pomie?ci tyle paliwa.");
if(strval(inputtext) > PaliwoStation[id])
return SendClientMessage(playerid, JCZERWONY, "Na stacji nie ma tyle paliwa.");
if(strval(inputtext) * StationPrice[id] > GetPVarInt(playerid, "kasa"))
return SendClientMessage(playerid, JCZERWONY, "Nie masz tyle pieni?dzy.");
{
format(String128, sizeof(String128),"Zakupi?e? %d litr?w paliwa za kwot? %d z?.", strval(inputtext), strval(inputtext)*StationPrice[id]);
PaliwoStation[id] = PaliwoStation[id] - strval(inputtext);
GivePVarInt(playerid, "kasa", - strval(inputtext)*StationPrice[id]);
Pojazd[GetPlayerVehicleID(playerid)][Paliwo] = Pojazd[GetPlayerVehicleID(playerid)][Paliwo] + strval(inputtext);
ZapiszStacje(id);
}
}
else if(IsMotor(GetPlayerVehicleID(playerid)))
{
new id = GetPVarInt(playerid, "Stacja");
if(strval(inputtext) > 18 - Pojazd[GetPlayerVehicleID(playerid)][Paliwo])
return SendClientMessage(playerid, JCZERWONY, "Tw?j bak nie pomie?ci tyle paliwa.");
if(strval(inputtext) > PaliwoStation[id])
return SendClientMessage(playerid, JCZERWONY, "Na stacji nie ma tyle paliwa.");
if(strval(inputtext) * StationPrice[id] > GetPVarInt(playerid, "kasa"))
return SendClientMessage(playerid, JCZERWONY, "Nie masz tyle pieni?dzy.");
{
format(String128, sizeof(String128),"Zakupi?e? %d litr?w paliwa za kwot? %d z?.", strval(inputtext), strval(inputtext)*StationPrice[id]);
PaliwoStation[id] = PaliwoStation[id] - strval(inputtext);
GivePVarInt(playerid, "kasa", - strval(inputtext)*StationPrice[id]);
Pojazd[GetPlayerVehicleID(playerid)][Paliwo] = Pojazd[GetPlayerVehicleID(playerid)][Paliwo] + strval(inputtext);
ZapiszStacje(id);
}
}


Kod:


public OnVehicleSpawn(vehicleid)
{
Pojazd[vehicleid][Paliwo] = 25;
if(IsTruck(vehicleid) == 1)
{
Pojazd[vehicleid][Paliwo] = 80;
}
else if(IsDost(vehicleid) == 1)
{
Pojazd[vehicleid][Paliwo] = 40;
}
else if(IsMotor(vehicleid) == 1)
{
Pojazd[vehicleid][Paliwo] = 8;
}
Pojazd[vehicleid][Zamkniety] = -1;
DestroyObject(Pojazd[vehicleid][Znaczek]);
return 1;
}



Kod:

//SPRAWDZANIE TYPU POJAZDU

stock IsPlane(vehicleid)
{
switch(GetVehicleModel(vehicleid))
{
case 460,476,511,512,513,519,520,553,577,592,593: return 1;
}
return 0;
}

stock IsHeli(vehicleid)
{
switch(GetVehicleModel(vehicleid))
{
case 417,425,447,469,487,488,497,548,563: return 1;
}
return 0;
}
IsTruck(vehicleid)
{
switch(GetVehicleModel(vehicleid))
{
case 403,514,515: return 1;
}
return 0;
}
IsDost(vehicleid)
{
switch(GetVehicleModel(vehicleid))
{
case 408,413,414,422,433,440,455,456,459,478,482,498,499,524,543,554,573,578,605,609: return 1;
}
return 0;
}

IsMotor(vehicleid)
{
switch(GetVehicleModel(vehicleid))
{
case 586,581,523,522,521,468,463,462,461,448: return 1;
}
return 0;
}
stock IsBicycle(vehicleid)
{
switch(GetVehicleModel(vehicleid))
{
case 481,509,510: return 1;
}
return 0;
}


Kod:

new spalanie = 0;
forward Spalanie();
public Spalanie()
{
spalanie++;
foreach(new i : Player)
{
if(IsPlayerInAnyVehicle(i))
{
if(GetPVarInt(i, "Engine") == 1)
{
if(Pojazd[GetPlayerVehicleID(i)][Paliwo] > 0)
{
if(IsTruck(GetPlayerVehicleID(i)) == 1)
{
Pojazd[GetPlayerVehicleID(i)][Paliwo]-=2;
continue;
}
else
{

Pojazd[GetPlayerVehicleID(i)][Paliwo]--;
continue;
}
}
}
}
}
}


[ Dodano: 2013-03-19, 16:48 ]
nic innego nie mam

Postaw piwo autorowi tego posta
 

 
Tagi: nie :: działające :: rowery
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » PAWN Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku