Wysłany: 2013-12-14, 10:38
Nors
Wszystko wiem.
Wiek: 30 Na forum: 4601 dni Posty: 223
Nick w MP: Nors
Piwa : 10
Witam mam problem mam zrobiony system Naliczania km towaru. Ale gdy za?aduje towar i jade to ca?y czas pisze 0.0KM.
POMOCY!!!
Tutaj system.
Kod: public OnGameModeInit()
{
//Nalicanie km
//
new vehicleid = GetPlayerVehicleID(playerid);
GetVehiclePos(vehicleid, Pozxx[vehicleid][3], Pozxx[vehicleid][4], Pozxx[vehicleid][5]);
Przebieg[vehicleid] += floatsqroot(floatpower(floatsub(Pozxx[vehicleid][3], Pozxx[vehicleid][0]), 2) + floatpower(floatsub(Pozxx[vehicleid][4], Pozxx[vehicleid][1]), 2)+floatpower(floatsub(Pozxx[vehicleid][5], Pozxx[vehicleid][2]), 2));
//
Kod: new vehid = GetPlayerVehicleID(i);
format(string, sizeof(string), "~y~Predkosc:~w~ %dKm/h~n~~y~Paliwo:~w~ %d%L~n~~y~Km Towaru: %.01f", floatround(value/1000),Gas[vehid],Przebieg[vehicleid]/290);
TextDrawSetString(pojazd[i], string);
Wysłany: 2013-12-14, 12:26
Sillence
Wiek: 26 Na forum: 5157 dni Posty: 1514
Nick w MP: Sillence
Piwa : 1517
Nors , Masz ten kod w jakim? timerze ?
Wysłany: 2013-12-14, 12:42
Nors
Wszystko wiem.
Wiek: 30 Na forum: 4601 dni Posty: 223
Nick w MP: Nors
Piwa : 10
"Sillence" napisał/a :Nors , Masz ten kod w jakim? timerze ?
Nie mam tylko to co ci poda?em
Wysłany: 2013-12-14, 12:45
Sillence
Wiek: 26 Na forum: 5157 dni Posty: 1514
Nick w MP: Sillence
Piwa : 1517
Utw?rz nowy timer, w tym miejscu gdzie masz komend? lub dialog z ?adowaniem towaru
http://wiki.sa-mp.com/wiki/SetTimer
Potem wklej kod co poda?e? do funkcji, kt?r? b?dziesz od?wie?a? w podanym timerze.
Wysłany: 2013-12-14, 12:46
Nors
Wszystko wiem.
Wiek: 30 Na forum: 4601 dni Posty: 223
Nick w MP: Nors
Piwa : 10
"Sillence" napisał/a :Utw?rz nowy timer, w tym miejscu gdzie masz komend? lub dialog z ?adowaniem towaru
http://wiki.sa-mp.com/wiki/SetTimer
Potem wklej kod co poda?e? do funkcji, kt?r? b?dziesz od?wie?a? w podanym timerze.
t? funckje do timera?
Kod: new vehicleid = GetPlayerVehicleID(playerid);
GetVehiclePos(vehicleid, Pozxx[vehicleid][3], Pozxx[vehicleid][4], Pozxx[vehicleid][5]);
Przebieg[vehicleid] += floatsqroot(floatpower(floatsub(Pozxx[vehicleid][3], Pozxx[vehicleid][0]), 2) + floatpower(floatsub(Pozxx[vehicleid][4], Pozxx[vehicleid][1]), 2)+floatpower(floatsub(Pozxx[vehicleid][5], Pozxx[vehicleid][2]), 2));
Wysłany: 2013-12-14, 12:52
Sillence
Wiek: 26 Na forum: 5157 dni Posty: 1514
Nick w MP: Sillence
Piwa : 1517
Nors , Tak chodzi tu dok?adnie o:
Kod: forward Kilometry();
public Kilometry()
{
// Co? tu.
}
I potem dajesz w timerze, od?wie?anie tego czyli:
Kod: SetTimer("Kilometry", 5000, true);
Wysłany: 2013-12-14, 12:56
Maajk_El
PawnoMaster :)
Wiek: 29 Na forum: 4841 dni Posty: 162
Nick w MP: "Maajk_El"
Piwa : 2365
Wysłany: 2013-12-14, 12:57
Nors
Wszystko wiem.
Wiek: 30 Na forum: 4601 dni Posty: 223
Nick w MP: Nors
Piwa : 10
Sillence , zrobi??m tak
Kod: forward KM(playerid);
public KM(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
GetVehiclePos(vehicleid, Pozxx[vehicleid][3], Pozxx[vehicleid][4], Pozxx[vehicleid][5]);
Przebieg[vehicleid] += floatsqroot(floatpower(floatsub(Pozxx[vehicleid][3], Pozxx[vehicleid][0]), 2) + floatpower(floatsub(Pozxx[vehicleid][4], Pozxx[vehicleid][1]), 2)+floatpower(floatsub(Pozxx[vehicleid][5], Pozxx[vehicleid][2]), 2));
return 1;
}
i to samo 0.0
Podpis
Daj piweczko. Pić się chce.
Wysłany: 2013-12-14, 13:00
Sillence
Wiek: 26 Na forum: 5157 dni Posty: 1514
Nick w MP: Sillence
Piwa : 1517
Nors , A zobacz w ten spos?b:
Kod: forward KM(playerid);
public KM(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
GetVehiclePos(vehicleid, Pozxx[vehicleid][3], Pozxx[vehicleid][4], Pozxx[vehicleid][5]);
Przebieg[vehicleid] += floatsqroot(floatpower(floatsub(Pozxx[vehicleid][3], Pozxx[vehicleid][0]), 2) + floatpower(floatsub(Pozxx[vehicleid][4], Pozxx[vehicleid][1]), 2)+floatpower(floatsub(Pozxx[vehicleid][5], Pozxx[vehicleid][2]), 2));
format(string, sizeof(string), "~y~Predkosc:~w~ %dKm/h~n~~y~Paliwo:~w~ %d%L~n~~y~Km Towaru: %.01f", floatround(value/1000),Gas[vehicleid],Przebieg[vehicleid]/290);
TextDrawSetString(pojazd[playerid], string);
return 1;
}
Gdzie wklei?e? timer i co ile go od?wie?asz ?
Wysłany: 2013-12-14, 13:01
Nors
Wszystko wiem.
Wiek: 30 Na forum: 4601 dni Posty: 223
Nick w MP: Nors
Piwa : 10
"Sillence" napisał/a :Nors , A zobacz w ten spos?b:
Kod: forward KM(playerid);
public KM(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
GetVehiclePos(vehicleid, Pozxx[vehicleid][3], Pozxx[vehicleid][4], Pozxx[vehicleid][5]);
Przebieg[vehicleid] += floatsqroot(floatpower(floatsub(Pozxx[vehicleid][3], Pozxx[vehicleid][0]), 2) + floatpower(floatsub(Pozxx[vehicleid][4], Pozxx[vehicleid][1]), 2)+floatpower(floatsub(Pozxx[vehicleid][5], Pozxx[vehicleid][2]), 2));
format(string, sizeof(string), "~y~Predkosc:~w~ %dKm/h~n~~y~Paliwo:~w~ %d%L~n~~y~Km Towaru: %.01f", floatround(value/1000),Gas[vehicleid],Przebieg[vehicleid]/290);
TextDrawSetString(pojazd[playerid], string);
return 1;
}
Gdzie wklei?e? timer i co ile go od?wie?asz ?
wklei?em timer do dialogu z za?adunkem do ka?dego towaru ustawi?em od?wie?anie co 4 sec
[ Dodano : 2013-12-14, 13:08 ]
Sillence , Ale patrz bo ja do ka?dego towaru mam dodane takie co?:
Kod: case 0:
{
zmienna[playerid] =1;
new vehicleid = GetPlayerVehicleID(playerid);
new string[256];
format(string, sizeof(string), "~g~Odziez (%.01f)", Przebieg[vehicleid]/290);
TextDrawSetString(naczepa[playerid], string);
zaladowany[playerid]=1;
SetTimerEx("zaladujtimer", 60000 ,0, "d", playerid);
UzylZaladuj[playerid]=1;
SetTimer("KM", 4000, false);
}
case 1:
{
zmienna[playerid] =2;
new vehicleid = GetPlayerVehicleID(playerid);
new string[256];
format(string, sizeof(string), "~g~Marchewki (%.01f)", Przebieg[vehicleid]/290);
TextDrawSetString(naczepa[playerid], string);
zaladowany[playerid]=1;
SetTimerEx("zaladujtimer", 60000 ,0, "d", playerid);
UzylZaladuj[playerid]=1;
SetTimer("KM", 4000, false);
}
i jak w timerze zrobie takie co? to sie bedzie miesza?o a pozatym error:
Kod: (6324) : error 001: expected token: ";", but found "new"
linijka
Kod: new vehicleid = GetPlayerVehicleID(playerid);
Wysłany: 2013-12-14, 13:15
Sillence
Wiek: 26 Na forum: 5157 dni Posty: 1514
Nick w MP: Sillence
Piwa : 1517
"Nors" napisał/a :i jak w timerze zrobie takie co? to sie bedzie miesza?o
Nie powinno si? miesza?. Jak ma Ci timer wy?wietla? now? zawarto?? textdrawu bez od?wie?enia go ?
"Nors" napisał/a :
Na pewno nie pomyli?e? si? przy wklejaniu ? Patrz?c po kodzie to s? wszystkie ?redniki.
Wysłany: 2013-12-14, 13:20
Nors
Wszystko wiem.
Wiek: 30 Na forum: 4601 dni Posty: 223
Nick w MP: Nors
Piwa : 10
Sillence , To od?wierza tylko raz i daje odrazu 8.6KM. i znika towar a wida? tylko KM
Podpis
Daj piweczko. Pić się chce.
Tagi: naliczanie :: towaru
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: