pRoBLemI

Započeo Lonka, Novembar 10, 2009, 12:50:20 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 2 gostiju pregledaju ovu temu.

Skripta:

new Float:Trip[MAX_VEHICLES];

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("Jakku - Speedometer/Fuel system");
print("--------------------------------------\n");

for(new Vehicles = 0; Vehicles < MAX_VEHICLES; Vehicles++)
{
Fuel[Vehicles] = Random(SPAWN_GAS_MIN, SPAWN_GAS_MAX);
Trip[Vehicles] = 0.00;
//Engine[Vehicles] = 0; or Engine[Vehicles] = random(1);
  }
for(new i = 0; i < MAX_PLAYERS; i++)
  {
  ShowSpeed[i] = 1;
  Refueling[i] = 0;
}
SetTimer("Speedometer", 1000, true);
return 1;
}

public OnVehicleSpawn(vehicleid)
{
Fuel[vehicleid] = Random(SPAWN_GAS_MIN, SPAWN_GAS_MAX);
Fuel[vehicleid] = 0.00;
//Engine[vehicleid] = 0; or Engine[vehicleid] = random(1);
return true;
}

public Speedometer()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
    {
        if(ShowSpeed[i] == 1)
        {
            #define MULTIPLY_SPEED  4
new Float:x, Float:y, Float:z, Float:Dis, Float:health, string[256];TextDrawDestroy(black[i]); TextDrawDestroy(Speedom[i]);
GetPlayerPos(i, x, y, z); GetVehicleHealth(GetPlayerVehicleID(i), health); new vehicleid = GetPlayerVehicleID(i);
new VehicleModel = GetVehicleModel(GetPlayerVehicleID(i));
Dis = floatsqroot(floatpower(floatabs(floatsub(OldCoordsX[i],x)),2) + floatpower(floatabs(floatsub(OldCoordsY[i],y)),2));
if(Fuel[vehicleid] <= 0){ RemovePlayerFromVehicle(i); SendClientMessage(i, COLOR_YELLOW, "Your vehicle has ran out of fuel! Have a nice walk");}
if(VehicleModel==509||VehicleModel==481||VehicleModel==510) {SetVehicleHealth(GetPlayerVehicleID(i), 1000); Fuel[vehicleid] = 100;}
if(VehicleModel==520||VehicleModel==476||VehicleModel==593||VehicleModel==553||VehicleModel==513||VehicleModel==512||VehicleModel==577||VehicleModel==592||VehicleModel==511||VehicleModel==539||VehicleModel==464||VehicleModel==519) { Fuel[vehicleid] = 100; }
new speed = (floatround(Dis)*MULTIPLY_SPEED);

    if( speed == 0 ){
format(string,sizeof(string),"~B~Vehicle:~n~~w~%s~n~~B~Speed: ~R~%dkm/h~n~~B~Fuel: ~W~%.1f~n~~B~Health: ~W~%.0f%~n~~B~Trip:~w~%d Km",VehiclesName[GetVehicleModel(GetPlayerVehicleID(i))-400],speed,Fuel[vehicleid],health/10,Trip[vehicleid]);
} else if( speed >= 1 && speed <= 99 ){
format(string,sizeof(string),"~B~Vehicle:~n~~w~%s~n~~B~Speed: ~R~%dkm/h~n~~B~Fuel: ~W~%.1f~n~~B~Health: ~W~%.0f%~n~~B~Trip:~w~%d Km",VehiclesName[GetVehicleModel(GetPlayerVehicleID(i))-400],speed,Fuel[vehicleid],health/10,Trip[vehicleid]);
Fuel[vehicleid] -= 0.02;
Trip[vehicleid] += 0.03;
} else if( speed >= 100 && speed <= 179 ){
format(string,sizeof(string),"~B~Vehicle:~n~~w~%s~n~~B~Speed: ~R~%dkm/h~n~~B~Fuel: ~W~%.1f~n~~B~Health: ~W~%.0f%~n~~B~Trip:~w~%d Km",VehiclesName[GetVehicleModel(GetPlayerVehicleID(i))-400],speed,Fuel[vehicleid],health/10,Trip[vehicleid]);
Fuel[vehicleid] -= 0.07;
Trip[vehicleid] += 0.06;
} else {
format(string,sizeof(string),"~B~Vehicle:~n~~w~%s~n~~B~Speed: ~R~%dkm/h~n~~B~Fuel: ~W~%.1f~n~~B~Health: ~W~%.0f%~n~~B~Trip:~w~%d Km",VehiclesName[GetVehicleModel(GetPlayerVehicleID(i))-400],speed,Fuel[vehicleid],health/10,Trip[vehicleid]);
Fuel[vehicleid] -= 0.08;
Trip[vehicleid] += 0.10;
}

black[i] = TextDrawCreate(504.000000,379.000000,"_");
TextDrawUseBox(black[i],0);
TextDrawBoxColor(black[i],0x00000085);
TextDrawTextSize(black[i],621.000000,0.000000);
TextDrawAlignment(black[i],0);
TextDrawBackgroundColor(black[i],0x000000FF);
TextDrawFont(black[i],3);
TextDrawLetterSize(black[i],1.700000,5.250000);
TextDrawColor(black[i],0xFFFFFFFF);
TextDrawSetOutline(black[i],1);
TextDrawSetProportional(black[i],1);
TextDrawSetShadow(black[i],1);

Speedom[i] = TextDrawCreate(505.000000,380.000000,string);
TextDrawUseBox(Speedom[i],0);
TextDrawBoxColor(Speedom[i],0xFFFFFF85);
TextDrawTextSize(Speedom[i],620.000000,0.000000);
TextDrawAlignment(Speedom[i],0);
TextDrawBackgroundColor(Speedom[i],0x000000FF);
TextDrawFont(Speedom[i],1);
TextDrawLetterSize(Speedom[i],0.299999,1.000000);
TextDrawColor(Speedom[i],0xFFFFFFFF);
TextDrawSetOutline(Speedom[i],1);
TextDrawSetProportional(Speedom[i],1);
TextDrawSetShadow(Speedom[i],1);

TextDrawShowForPlayer(i, black[i]);
TextDrawShowForPlayer(i, Speedom[i]);
OldCoordsX[i] = x; OldCoordsY[i] = y;
} else { TextDrawDestroy(black[i]); TextDrawDestroy(Speedom[i]); }
}
}
return true;
}


Kad idem kompilat, errori:

D:\Documents\My Documents\Downloads\SAMP\filterscripts\wds.pwn(1) : error 017: undefined symbol "MAX_VEHICLES"
D:\Documents\My Documents\Downloads\SAMP\filterscripts\wds.pwn(1) : error 009: invalid array size (negative, zero or out of bounds)
D:\Documents\My Documents\Downloads\SAMP\filterscripts\wds.pwn(3) : warning 235: public function lacks forward declaration (symbol "OnFilterScriptInit")
D:\Documents\My Documents\Downloads\SAMP\filterscripts\wds.pwn(5) : error 017: undefined symbol "print"
D:\Documents\My Documents\Downloads\SAMP\filterscripts\wds.pwn(6) : error 017: undefined symbol "print"
D:\Documents\My Documents\Downloads\SAMP\filterscripts\wds.pwn(7) : error 017: undefined symbol "print"
D:\Documents\My Documents\Downloads\SAMP\filterscripts\wds.pwn(9) : error 017: undefined symbol "MAX_VEHICLES"
D:\Documents\My Documents\Downloads\SAMP\filterscripts\wds.pwn(11) : error 017: undefined symbol "Fuel"
D:\Documents\My Documents\Downloads\SAMP\filterscripts\wds.pwn(11) : warning 215: expression has no effect
D:\Documents\My Documents\Downloads\SAMP\filterscripts\wds.pwn(11) : error 001: expected token: ";", but found "]"
D:\Documents\My Documents\Downloads\SAMP\filterscripts\wds.pwn(11) : error 029: invalid expression, assumed zero
D:\Documents\My Documents\Downloads\SAMP\filterscripts\wds.pwn(11) : fatal error 107: too many error messages on one line


Pomoc?

Ajde, Klikcite, Jos je u jajetu xD