Hallo Leute,
ich habe gerade in meinen Script ein TachoSystem eingefügt und wollte es testen aber dann hat der Server auf einmal nicht mehr gestartet. Ich bitte um schnelle Hilfe...
Screen:
MfG
Jojonas (AvoReallife)
Hallo Leute,
ich habe gerade in meinen Script ein TachoSystem eingefügt und wollte es testen aber dann hat der Server auf einmal nicht mehr gestartet. Ich bitte um schnelle Hilfe...
Screen:
MfG
Jojonas (AvoReallife)
mhhh zeige uns doch einfach mal den Codeschnipsel was du eingefügt hast^^
MFG Daniel
enum vehicle_info {
Float:Kilometerstand,
Float:LetzteX,
Float:LetzteY,
Float:LetzteZ
}
new Text:tBack1, Text:tBack2, Text:tMotor[MAX_PLAYERS], Text:tZustand[MAX_PLAYERS], Text:tSpeed[MAX_PLAYERS], Text:tStand[MAX_PLAYERS], Text:tLicht[MAX_PLAYERS], Text:tName[MAX_PLAYERS], Text:tBenzin[MAX_PLAYERS];
new bool:Motor[MAX_VEHICLES]=false, bool:Licht[MAX_VEHICLES]=false, bool:TanktGerade[MAX_VEHICLES]=false, Tank[MAX_VEHICLES], tanktimer[MAX_PLAYERS], aInfo[MAX_VEHICLES][vehicle_info];
new engine,lights,alarm,doors,bonnet,boot,objective;
new VehNames[212][] = {
{"Landstalker"},
{"Bravura"},
{"Buffalo"},
{"Linerunner"},
{"Perrenial"},
{"Sentinel"},
{"Dumper"},
{"Firetruck"},
{"Trashmaster"},
{"Stretch"},
{"Manana"},
{"Infernus"},
{"Voodoo"},
{"Pony"},
{"Mule"},
{"Cheetah"},
{"Ambulance"},
{"Leviathan"},
{"Moonbeam"},
{"Esperanto"},
{"Taxi"},
{"Washington"},
{"Bobcat"},
{"Mr Whoopee"},
{"BF Injection"},
{"Hunter"},
{"Premier"},
{"Enforcer"},
{"Securicar"},
{"Banshee"},
{"Predator"},
{"Bus"},
{"Rhino"},
{"Barracks"},
{"Hotknife"},
{"Trailer 1"},
{"Previon"},
{"Coach"},
{"Cabbie"},
{"Stallion"},
{"Rumpo"},
{"RC Bandit"},
{"Romero"},
{"Packer"},
{"Monster"},
{"Admiral"},
{"Squalo"},
{"Seasparrow"},
{"Pizzaboy"},
{"Tram"},
{"Trailer 2"},
{"Turismo"},
{"Speeder"},
{"Reefer"},
{"Tropic"},
{"Flatbed"},
{"Yankee"},
{"Caddy"},
{"Solair"},
{"Berkley's RC Van"},
{"Skimmer"},
{"PCJ-600"},
{"Faggio"},
{"Freeway"},
{"RC Baron"},
{"RC Raider"},
{"Glendale"},
{"Oceanic"},
{"Sanchez"},
{"Sparrow"},
{"Patriot"},
{"Quad"},
{"Coastguard"},
{"Dinghy"},
{"Hermes"},
{"Sabre"},
{"Rustler"},
{"ZR-350"},
{"Walton"},
{"Regina"},
{"Comet"},
{"BMX"},
{"Burrito"},
{"Camper"},
{"Marquis"},
{"Baggage"},
{"Dozer"},
{"Maverick"},
{"News Chopper"},
{"Rancher"},
{"FBI Rancher"},
{"Virgo"},
{"Greenwood"},
{"Jetmax"},
{"Hotring"},
{"Sandking"},
{"Blista Compact"},
{"Police Maverick"},
{"Boxville"},
{"Benson"},
{"Mesa"},
{"RC Goblin"},
{"Hotring Racer A"},
{"Hotring Racer B"},
{"Bloodring Banger"},
{"Rancher"},
{"Super GT"},
{"Elegant"},
{"Journey"},
{"Bike"},
{"Mountain Bike"},
{"Beagle"},
{"Cropdust"},
{"Stunt"},
{"Tanker"},
{"Roadtrain"},
{"Nebula"},
{"Majestic"},
{"Buccaneer"},
{"Shamal"},
{"Hydra"},
{"FCR-900"},
{"NRG-500"},
{"HPV1000"},
{"Cement Truck"},
{"Tow Truck"},
{"Fortune"},
{"Cadrona"},
{"FBI Truck"},
{"Willard"},
{"Forklift"},
{"Tractor"},
{"Combine"},
{"Feltzer"},
{"Remington"},
{"Slamvan"},
{"Blade"},
{"Freight"},
{"Streak"},
{"Vortex"},
{"Vincent"},
{"Bullet"},
{"Clover"},
{"Sadler"},
{"Firetruck LA"},
{"Hustler"},
{"Intruder"},
{"Primo"},
{"Cargobob"},
{"Tampa"},
{"Sunrise"},
{"Merit"},
{"Utility"},
{"Nevada"},
{"Yosemite"},
{"Windsor"},
{"Monster A"},
{"Monster B"},
{"Uranus"},
{"Jester"},
{"Sultan"},
{"Stratum"},
{"Elegy"},
{"Raindance"},
{"RC Tiger"},
{"Flash"},
{"Tahoma"},
{"Savanna"},
{"Bandito"},
{"Freight Flat"},
{"Streak Carriage"},
{"Kart"},
{"Mower"},
{"Duneride"},
{"Sweeper"},
{"Broadway"},
{"Tornado"},
{"AT-400"},
{"DFT-30"},
{"Huntley"},
{"Stafford"},
{"BF-400"},
{"Newsvan"},
{"Tug"},
{"Trailer 3"},
{"Emperor"},
{"Wayfarer"},
{"Euros"},
{"Hotdog"},
{"Club"},
{"Freight Carriage"},
{"Trailer 3"},
{"Andromada"},
{"Dodo"},
{"RC Cam"},
{"Launch"},
{"Polizeiauto"},
{"Polizeiauto"},
{"Polizeiauto"},
{"Polizei Ranger"},
{"Picador"},
{"S.W.A.T. Van"},
{"Alpha"},
{"Phoenix"},
{"Glendale"},
{"Sadler"},
{"Luggage Trailer A"},
{"Luggage Trailer B"},
{"Stair Trailer"},
{"Boxville"},
{"Pflug"},
{"Utility Trailer"}
};
#define VERLUST 3000 // Zeit die ein Fahrzeug benötigt um 0,1l Benzin zu verbrauchen (in Millisekunden)
#define BENZINPREIS 3 // Preis pro Liter
#define KEY_MOTOR KEY_ACTION // Taste um Motor zu starten
#define KEY_LIGHT KEY_FIRE // Taste um Licht einzuschalten
// Die einzelnen möglichen Keys gibt es unten auf folgender Seite:
// http://wiki.sa-mp.com/wiki/GetPlayerKeys
#define SPEED_KOEFF 1.3 // Koeffizient um die Geschwindigkeit zu setzen. Je niedriger der Wert, desto höher die angezeigte Geschwindigkeit.
new Float:Tankstellen[][3] = { // Tankstellen müssen auf jeden Fall hinzugefügt werden.
{1004.2614,-939.5943,41.8769}, // Die aktuellen Zeilen müssen ersetzt werden, sie dienen nur als Beispiel für den Aufbau der Koordinaten.
{2.2222, 2.3333, 2.4444}
};
forward BenzinVerlust();
forward Auftanken(playerid);
forward Kilometer();
forward KilometerStart();
public BenzinVerlust()
{
for(new i=0; i<MAX_VEHICLES; i++)
{
if (Motor[i] == true)
{
Tank[i] = Tank[i]-1;
if (Tank[i]<1)
{
Tank[i] = 0;
GetVehicleParamsEx(i,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(i,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
Motor[i] = false;
}
}
}
return 1;
}
public KilometerStart()
{
SetTimer("Kilometer", 1000, true);
return 1;
}
public Kilometer()
{
for(new i=0; i<MAX_VEHICLES; i++)
{
aInfo[i][Kilometerstand] = aInfo[i][Kilometerstand]+GetVehicleDistanceFromPoint(i, aInfo[i][LetzteX], aInfo[i][LetzteY], aInfo[i][LetzteZ]);
GetVehiclePos(i, aInfo[i][LetzteX], aInfo[i][LetzteY], aInfo[i][LetzteZ]);
}
return 1;
}
public Auftanken(playerid)
{
new car = GetPlayerVehicleID(playerid);
Tank[car] = Tank[car] +5;
if(Tank[car] >= 1000)
{
TanktGerade[car] = false;
Tank[car] = 1000;
SendClientMessage(playerid, 0x00CD00FF, "Dein Fahrzeug wurde vollgetankt.");
TogglePlayerControllable(playerid,1);
KillTimer(tanktimer[playerid]);
}
return 1;
}
stock GetVehicleSpeed(vehicleid, &Float:Speed)
{
new
Float:X,
Float:Y,
Float:Z;
GetVehicleVelocity(vehicleid, X, Y, Z);
Speed = floatsqroot(X*X + Y*Y + Z*Z)*200;
}
tBack1 = TextDrawCreate(638.000000, 362.000000, "_");
TextDrawBackgroundColor(tBack1, 255);
TextDrawFont(tBack1, 1);
TextDrawLetterSize(tBack1, 1.000000, 9.000000);
TextDrawSetProportional(tBack1, 1);
TextDrawUseBox(tBack1, 1);
TextDrawBoxColor(tBack1, 68);
TextDrawTextSize(tBack1, 534.000000, -26.000000);
tBack2 = TextDrawCreate(640.000000, 360.000000, "_");
TextDrawBackgroundColor(tBack2, 255);
TextDrawFont(tBack2, 1);
TextDrawLetterSize(tBack2, 1.000000, 9.500001);
TextDrawSetProportional(tBack2, 1);
TextDrawUseBox(tBack2, 1);
TextDrawBoxColor(tBack2, 68);
TextDrawTextSize(tBack2, 532.000000, -29.000000);
for(new playerid=0; playerid < MAX_PLAYERS; playerid++)
{
tMotor[playerid] = TextDrawCreate(548.000000, 430.000000, "[~g~Motor~w~]");
TextDrawBackgroundColor(tMotor[playerid], 255);
TextDrawFont(tMotor[playerid], 1);
TextDrawLetterSize(tMotor[playerid], 0.250000, 1.200000);
TextDrawColor(tMotor[playerid], -1);
TextDrawSetOutline(tMotor[playerid], 1);
TextDrawSetProportional(tMotor[playerid], 1);
tZustand[playerid] = TextDrawCreate(610.000000, 370.000000, "Zustand:~n~--- %");
TextDrawAlignment(tZustand[playerid], 2);
TextDrawBackgroundColor(tZustand[playerid], 255);
TextDrawFont(tZustand[playerid], 1);
TextDrawLetterSize(tZustand[playerid], 0.250000, 1.200000);
TextDrawColor(tZustand[playerid], -1);
TextDrawSetOutline(tZustand[playerid], 1);
TextDrawSetProportional(tZustand[playerid], 1);
tSpeed[playerid] = TextDrawCreate(545.000000, 398.000000, "Geschw.: --- Km/h");
TextDrawBackgroundColor(tSpeed[playerid], 255);
TextDrawFont(tSpeed[playerid], 1);
TextDrawLetterSize(tSpeed[playerid], 0.250000, 1.200000);
TextDrawColor(tSpeed[playerid], -1);
TextDrawSetOutline(tSpeed[playerid], 1);
TextDrawSetProportional(tSpeed[playerid], 1);
tStand[playerid] = TextDrawCreate(545.000000, 410.000000, "KM-Stand: --- km");
TextDrawBackgroundColor(tStand[playerid], 255);
TextDrawFont(tStand[playerid], 1);
TextDrawLetterSize(tStand[playerid], 0.250000, 1.200000);
TextDrawColor(tStand[playerid], -1);
TextDrawSetOutline(tStand[playerid], 1);
TextDrawSetProportional(tStand[playerid], 1);
tLicht[playerid] = TextDrawCreate(596.000000, 430.000000, "[~r~Licht~w~]");
TextDrawBackgroundColor(tLicht[playerid], 255);
TextDrawFont(tLicht[playerid], 1);
TextDrawLetterSize(tLicht[playerid], 0.250000, 1.200000);
TextDrawColor(tLicht[playerid], -1);
TextDrawSetOutline(tLicht[playerid], 1);
TextDrawSetProportional(tLicht[playerid], 1);
tName[playerid] = TextDrawCreate(631.000000, 345.000000, "Uranus");
TextDrawAlignment(tName[playerid], 3);
TextDrawBackgroundColor(tName[playerid], 255);
TextDrawFont(tName[playerid], 0);
TextDrawLetterSize(tName[playerid], 0.559999, 1.900000);
TextDrawColor(tName[playerid], -1);
TextDrawSetOutline(tName[playerid], 0);
TextDrawSetProportional(tName[playerid], 1);
TextDrawSetShadow(tName[playerid], 1);
tBenzin[playerid] = TextDrawCreate(560.000000, 370.000000, "Benzin:~n~--- l");
TextDrawAlignment(tBenzin[playerid], 2);
TextDrawBackgroundColor(tBenzin[playerid], 255);
TextDrawFont(tBenzin[playerid], 1);
TextDrawLetterSize(tBenzin[playerid], 0.250000, 1.200000);
TextDrawColor(tBenzin[playerid], -1);
TextDrawSetOutline(tBenzin[playerid], 1);
TextDrawSetProportional(tBenzin[playerid], 1);
}
SetTimer("BenzinVerlust", VERLUST, true);
SetTimer("KilometerStart", 5000, false);
new path[32];
for (new i=0; i< MAX_VEHICLES; i++)
{
format(path, 32, "%i", i);
if(!dini_Exists("/vehicle.ini"))
{
dini_Create("/vehicle.ini");
aInfo[i][Kilometerstand] = 0;
}
else aInfo[i][Kilometerstand] = dini_Float("/vehicle.ini", path);
GetVehicleParamsEx(i,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(i,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
Motor[i] = false;
Licht[i] = false;
Tank[i] = random(1000-800)+800;
}
public OnGameModeExit()
{
new path[32];
for (new i=0; i< MAX_VEHICLES; i++)
{
format(path, 32, "%i", i);
if(!dini_Exists("/vehicle.ini")) dini_Create(path);
dini_FloatSet("/vehicle.ini", path, aInfo[i][Kilometerstand]);
}
TextDrawHideForAll(tBack1);
TextDrawDestroy(tBack1);
TextDrawHideForAll(tBack2);
TextDrawDestroy(tBack2);
return 1;
}
public OnVehicleSpawn(vehicleid)
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
Motor[vehicleid] = false;
Licht[vehicleid] = false;
return 1;
}
ocmd:tanken(playerid,params[])
{
new car = GetPlayerVehicleID(playerid), bool:nah = false;
if (GetPlayerVehicleSeat(playerid) != 0) return SendClientMessage(playerid,0xB22222FF,"Du bist in keinem Fahrzeug (oder kein Fahrer).");
else if (TanktGerade[car]) return SendClientMessage(playerid,0xB22222FF,"Du tankst schon!");
else if (Motor[car] == true) return SendClientMessage(playerid,0xB22222FF,"Du musst vor dem Tanken den Motor ausschalten.");
for(new i=0; i<sizeof(Tankstellen); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 10.0, Tankstellen[i][0], Tankstellen[i][1], Tankstellen[i][2]))
{
nah = true;
break;
}
}
if(nah == false) return SendClientMessage(playerid, 0xB22222FF, "Du bist nicht in der Nähe einer Tankstelle.");
new ZuTanken = 100-Tank[car];
new preis = ZuTanken * BENZINPREIS;
if (GetPlayerMoney(playerid)-preis < 0) return SendClientMessage(playerid,0xB22222FF,"Du hast nicht genug Geld!");
GivePlayerMoney(playerid, -preis);
SendClientMessage(playerid, 0x00CD00FF, "Tanken wird gestartet.");
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid,0);
TanktGerade[car] = true;
tanktimer[playerid] = SetTimerEx("Auftanken",500,true,"i",playerid);
return 1;
}
ocmd:motor(playerid,params[])
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(Tank[vehicleid]<1) return SendClientMessage(playerid,0xB22222FF, "Der Tank ist leer.");
if(Motor[vehicleid] == true)
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
Motor[vehicleid] = false;
TextDrawSetString(tMotor[playerid], "[~r~Motor~w~]");
}
else
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
Motor[vehicleid] = true;
TextDrawSetString(tMotor[playerid], "[~g~Motor~w~]");
}
if(GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 510)
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
}
return 1;
}
ocmd:licht(playerid,params[])
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(Licht[vehicleid] == true)
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
Licht[vehicleid] = false;
TextDrawSetString(tLicht[playerid], "[~r~Licht~w~]");
}
else
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
Licht[vehicleid] = true;
TextDrawSetString(tLicht[playerid], "[~g~Licht~w~]");
}
}
return 1;
}
if(newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid), vName[32];
if(GetVehicleModel(vehicleid) != 509 && GetVehicleModel(vehicleid) != 481 && GetVehicleModel(vehicleid) != 510)
{
TextDrawShowForPlayer(playerid, tBack1);
TextDrawShowForPlayer(playerid, tBack2);
TextDrawShowForPlayer(playerid, tMotor[playerid]);
TextDrawShowForPlayer(playerid, tZustand[playerid]);
TextDrawShowForPlayer(playerid, tSpeed[playerid]);
TextDrawShowForPlayer(playerid, tStand[playerid]);
TextDrawShowForPlayer(playerid, tLicht[playerid]);
TextDrawShowForPlayer(playerid, tName[playerid]);
TextDrawShowForPlayer(playerid, tBenzin[playerid]);
if(Motor[vehicleid] == false) TextDrawSetString(tMotor[playerid], "[~r~Motor~w~]");
else TextDrawSetString(tMotor[playerid], "[~g~Motor~w~]");
if(Licht[vehicleid] == false) TextDrawSetString(tLicht[playerid], "[~r~Licht~w~]");
else TextDrawSetString(tLicht[playerid], "[~g~Licht~w~]");
}
if(GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 510)
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
format(vName, 32, "%s", VehNames[GetVehicleModel(vehicleid)-400]);
TextDrawSetString(tName[playerid], vName);
}
else if(oldstate == PLAYER_STATE_DRIVER)
{
TextDrawHideForPlayer(playerid, tBack1);
TextDrawHideForPlayer(playerid, tBack2);
TextDrawHideForPlayer(playerid, tMotor[playerid]);
TextDrawHideForPlayer(playerid, tZustand[playerid]);
TextDrawHideForPlayer(playerid, tSpeed[playerid]);
TextDrawHideForPlayer(playerid, tStand[playerid]);
TextDrawHideForPlayer(playerid, tLicht[playerid]);
TextDrawHideForPlayer(playerid, tName[playerid]);
TextDrawHideForPlayer(playerid, tBenzin[playerid]);
}
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid), benzin[128], Float:h, string[32], Float:speed;
GetVehicleHealth(vehicleid, h);
format(string, 32, "Zustand:~n~%f %", h/10);
if(h<1000)
{
strdel(string, 15, 20);
strdel(string, 13, 14);
strins(string, ",", 13);
}
else strdel(string, 14, 21);
format(benzin, 128, "Benzin:~n~%i l", Tank[vehicleid]);
if(Tank[vehicleid]<1000) strins(benzin, ",", 12);
else if(Tank[vehicleid]<100) strins(benzin, ",", 11);
else if(Tank[vehicleid]<10) strins(benzin, ",", 10);
else strdel(benzin, 12, 13);
TextDrawSetString(tBenzin[playerid], benzin);
TextDrawSetString(tZustand[playerid], string);
GetVehicleSpeed(vehicleid, speed);
format(string, 32, "Geschw.: %f Km/h", speed/SPEED_KOEFF);
if(speed/SPEED_KOEFF<100) strdel(string, 10, 17);
else strdel(string, 11, 18);
TextDrawSetString(tSpeed[playerid], string);
if(Tank[vehicleid]<1) TextDrawSetString(tMotor[playerid], "[~r~Motor~w~]");
format(string, 32, "KM-Stand: %f km", aInfo[vehicleid][Kilometerstand]/1300);
strdel(string, 14, 17);
TextDrawSetString(tStand[playerid], string);
}
//Edit Kommando zurück aber ich würde trotzdem gerne wissen warum der Server eine Weile braucht bis er den Script geladen hat?