Fuel System
#1

Hello,
My cousin sent me a Fuel System unfinished and that I Error and I do not know about them help you help us?
Code:
Код:
#include <a_samp>
#include <zcmd>

#define MAX_BENZIN 30
#define BENZIN_CENA 10

new Text:BenzinTD[MAX_PLAYERS];
new Float:BenzinPos[MAX_BENZIN][3];
new BenzinCount = -1;
new Benzin[MAX_VEHICLES];

forward FuelUpdate();
forward FuelUp(playerid);

stock AddBenzinka(Float:x,Float:y,Float:z){
BenzinCount++;
if(BenzinCount >= MAX_BENZIN) return print("Bol prekroceny max. pocet benzinek !");
CreatePickup(1686,1,x,y,z);
BenzinPos[BenzinCount][0] = x;
BenzinPos[BenzinCount][1] = y;
BenzinPos[BenzinCount][2] = z;
return true;
}

public FuelUp(playerid){
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){
SendClientMessage(playerid,1,"Nemas dostatok penazi");
}else{
if(Benzin[car] < 100){
Benzin[car]++;
GivePlayerMoney(playerid,-BENZIN_CENA);
}
}
break;
}
}
return true;
}

public FuelUpdate(){
for(new i; i <= MAX_PLAYERS;i++){
if(IsPlayerConnected(i)){
new car = GetPlayerVehicleID(i);
if(car > 0){
SetPVarInt(i,"BenzinUpdate",GetPVarInt(i,"BenzinUpdate")+1);
if(GetPlayerState(i) == PLAYER_STATE_DRIVER){
FuelUp(i);
}
if(GetPVarInt(i,"BenzinUpdate") == 50) {
SetPVarInt(i,"BenzinUpdate",0);
Benzin[car] -= random(2)+1;
}
new str[100];
format(str,100,"~b~~b~PALIVO: ~w~%d~b~ KM/H: ~w~%d",Benzin[car],GetPlayerSpeed(carid,bool:kmh));
TextDrawSetString(BenzinTD[i],str);
TextDrawShowForPlayer(i,BenzinTD[i]);
if(Benzin[car] < 1){
RemovePlayerFromVehicle(i);
SendClientMessage(i,2,"Autu dosiel benzin");
}
}
}
return true;
}

stock GetPlayerSpeed(carid,bool:kmh)
{
new Float:Vx,Float:Vy,Float:Vz,Float:rtn;
GetVehicleVelocity(carid,Vx,Vy,Vz);
rtn = floatsqroot(floatabs(floatpower(Vx + Vy + Vz,2)));
return kmh?floatround(rtn * 100 * 1.61):floatround(rtn * 100);
}

public OnGameModeInit(){
AddBenzinka(2114.4521, 923.2661, 10.5474);
AddBenzinka(2639.2939, 1103.1833, 10.5479);
AddBenzinka(1597.0775, 2195.7436, 10.5474);
AddBenzinka(2146.8232, 2751.2419, 10.5474);
AddBenzinka(616.4793, 1690.5131, 6.7192);
AddBenzinka(-1328.2037, 2677.6928, 49.7896);
AddBenzinka(-1672.7383, 413.3457, 6.9067);
AddBenzinka(-2413.6634, 973.9432, 45.0239);
AddBenzinka(-1606.1141, -2713.7266, 48.2633);
AddBenzinka(1943.9356, -1772.9733, 13.1176);
AddBenzinka(2206.1804, 2474.2966, 10.8203);
AddBenzinka(1421.9689, 1463.2421, 10.8203);
AddBenzinka(1643.6905, -2593.9163, 13.5468);
AddBenzinka(-1411.5501, -2.4991, 14.875);
AddBenzinka(-1476.7148, 1861.8446, 32.6328);
AddBenzinka(1381.4516, 461.3782, 20.0785);
AddBenzinka(657.0178, -569.1056, 16.3358);
AddBenzinka(-95.6028, -1175.3602, 2.2834);
AddBenzinka(2864.75, 1255.6872, 12.3494);
AddBenzinka(-2264.6834, 526.548, 35.5931);

for(new i; i < MAX_PLAYERS;i++){
BenzinTD[i] = TextDrawCreate(205.000000, 374.000000, "~b~~b~PALIVO: ~w~100~b~ KM/H: ~w~300");
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 x; x< MAX_VEHICLES;x++){
Benzin[x] = random(100);
}
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER){
new car = GetPlayerVehicleID(playerid);
if(Benzin[car] < 1){
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,2,"Autu dosiel benzin");
}
}
if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
{
TextDrawHideForPlayer(playerid,BenzinTD[playerid]);
}
return 1;
}

CMD:tankovat(playerid,params[])
{
for(new i; i < MAX_VEHICLES;i++)
{
Benzin[i] = random(100);
}
new string[128];
format(string,sizeof(string),"Administrбtor %s natankoval vљetky vozidlб na servery !",Jmeno(playerid));
SendClientMessageToAll(-1,string);
return 1;
}
Errors
Код:
C:\Users\Miroslav\Desktop\Banzin.pwn(57) : error 017: undefined symbol "GetPlayerSpeed"
C:\Users\Miroslav\Desktop\Banzin.pwn(69) : error 029: invalid expression, assumed zero
C:\Users\Miroslav\Desktop\Banzin.pwn(69) : error 017: undefined symbol "GetPlayerSpeed"
C:\Users\Miroslav\Desktop\Banzin.pwn(72) : error 017: undefined symbol "carid"
C:\Users\Miroslav\Desktop\Banzin.pwn(74) : error 017: undefined symbol "kmh"
C:\Users\Miroslav\Desktop\Banzin.pwn(77) : warning 225: unreachable code
C:\Users\Miroslav\Desktop\Banzin.pwn(77) : error 029: invalid expression, assumed zero
C:\Users\Miroslav\Desktop\Banzin.pwn(77) : error 004: function "zcmd_OnGameModeInit" is not implemented
C:\Users\Miroslav\Desktop\Banzin.pwn(114) : warning 225: unreachable code
C:\Users\Miroslav\Desktop\Banzin.pwn(114) : error 004: function "OnPlayerStateChange" is not implemented
C:\Users\Miroslav\Desktop\Banzin.pwn(116) : error 017: undefined symbol "newstate"
C:\Users\Miroslav\Desktop\Banzin.pwn(117) : error 017: undefined symbol "playerid"
C:\Users\Miroslav\Desktop\Banzin.pwn(119) : error 017: undefined symbol "playerid"
C:\Users\Miroslav\Desktop\Banzin.pwn(120) : error 017: undefined symbol "playerid"
C:\Users\Miroslav\Desktop\Banzin.pwn(123) : error 017: undefined symbol "oldstate"
C:\Users\Miroslav\Desktop\Banzin.pwn(125) : error 017: undefined symbol "playerid"
C:\Users\Miroslav\Desktop\Banzin.pwn(130) : warning 225: unreachable code
C:\Users\Miroslav\Desktop\Banzin.pwn(130) : error 029: invalid expression, assumed zero
C:\Users\Miroslav\Desktop\Banzin.pwn(130) : error 017: undefined symbol "cmd_tankovat"
C:\Users\Miroslav\Desktop\Banzin.pwn(130) : error 029: invalid expression, assumed zero
C:\Users\Miroslav\Desktop\Banzin.pwn(130) : fatal error 107: too many error messages on one line
Reply
#2

I suggest you download a working fuelsystem FS elsewhere in this forum. As far as i can see there are alot of includes or functions missing.
Fixing would be more work ten finding another system.
Reply
#3

mabey he is not compileing with the pawn in the serverfiles
Reply
#4

Quote:
Originally Posted by JessThompson
Посмотреть сообщение
mabey he is not compileing with the pawn in the serverfiles
that shouldnt be a problem but yea put your script in the filterscript folder and try to compile from there.
Reply
#5

Quote:
Originally Posted by AIped
Посмотреть сообщение
I suggest you download a working fuelsystem FS elsewhere in this forum. As far as i can see there are alot of includes or functions missing.
Fixing would be more work ten finding another system.
I'm looking for such a system and can not find: (
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)