Erstmal ein dank an Neophonix oder wie auch immer Super FS auch dir dank ich da du mir mit dem HP reduzieren geholfen hast...
Und auch ein dank an Chaosfatz der dies Möglich machte...
Nun eine Kleine information was hab ich hinzugefügt...
Also ich habe hinzugefügt..
- Mehrer fun Texte beim Starten des motors
- Schaden reduziert sich beim fehlerhaften starten trotzdem fährt es...
- Erlitt man Grosen schaden fängt das auto an zu brennen... und die HP reduziert sich da man in den Flammen fast erstickt..
- Beim einsteigen ist der Motor aus es kommt kein Qualm aus dem Auspuff
#include <a_samp>
//CREDITS TO AN UNKNOWS AUTHOR FOR THE PROX DETECOTOR
//CREDITS TO NEOPHOENIX FOR THE OTHER
#define SCM SendClientMessage
#define COLOR_PURPLE 0xC2A2DAAA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_LIGHTGREEN 0x9ACD32AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_YELLOW2 0xF5DEB3AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_ROT 0xFF0000FF
#define COLOR_SCHWARZ 0x000000FF
#define COLOR_DUNKELGRUEN 0x006600FF
#define COLOR_GRUEN 0x00FF00FF
#define COLOR_WEISS 0xFFFFFFFF
#define COLOR_BLAU 0x0000FFFF
#define COLOR_GELB 0xFFFF00FF
#define COLOR_PINK 0xFF00FFFF
#define COLOR_LILA 0xCC33CACA
#define COLOR_HELLBLAU 0x3366FFCA
#define COLOR_WASSER 0x0066FFFF
#define COLOR_GIFT 0xCCFF00CA
#pragma tabsize 0
new MotorAN[MAX_VEHICLES];
new sendername[MAX_PLAYER_NAME];
new rauchtimer[MAX_PLAYERS];
forward Reduhp(playerid);
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
forward Anstellen(playerid);
public OnFilterScriptInit()
{
print("\n--Motorsystem by NeoPhoenix--\n");
print("--Dieses Produkt steht unter Creativ Common Licenses--\n");
new Autos;
for(Autos=0;Autos<MAX_VEHICLES;Autos++)
return 1;
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new AutoID = GetPlayerVehicleID(playerid);
new AutoMOD = GetVehicleModel(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
if(MotorAN[AutoID] == 0 && AutoMOD != 510 && AutoMOD != 509 && AutoMOD != 481)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 510 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 509 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 481){
return 1;
}
TogglePlayerControllable(playerid,0);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(AutoID,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(AutoID,0,lights,alarm,doors,bonnet,boot,objective);
SCM(playerid,COLOR_GIFT,"* Drücke SHIFT um den Motor zu starten");
}else{
SCM(playerid,COLOR_RED,"* Der Motor ist schon an!");
}
}
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
TogglePlayerControllable(playerid,1);
new Vehicle = GetPlayerVehicleID(playerid);
if(MotorAN[Vehicle] == 1)
{
SCM(playerid, COLOR_GIFT, "Du hast den Motor laufen lassen!");
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_ACTION)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Vehicle = GetPlayerVehicleID(playerid);
if(MotorAN[Vehicle] == 1)
{
RemovePlayerFromVehicle(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(Vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(Vehicle,0,lights,alarm,doors,bonnet,boot,objective);
SCM(playerid,COLOR_RED,"* Du hast den Motor ausgestellt.");
TogglePlayerControllable(playerid,1);
MotorAN[Vehicle] = 0;
}
}
// }
}
if(newkeys == KEY_JUMP)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(IsPlayerConnected(playerid))
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 510 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 509 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 481){
return 1;
}
new Vehicle = GetPlayerVehicleID(playerid);
if(MotorAN[Vehicle] == 0)
{
new string[256];
SCM(playerid,COLOR_GIFT,"* Starte Motor...");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s dreht den Zündschlüssel um und versucht den Motor zu starten.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~g~Motor wird gestartet...",3000,3);
SetTimerEx("Anstellen",3500,0,"i",playerid);
}
}
}
}
return 1;
}
public Anstellen(playerid)
{
new Vehicle = GetPlayerVehicleID(playerid);
new Zufall;
if(IsPlayerConnected(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
Zufall = random(10);
switch(Zufall)
{
case 0:
{
new string[256];
MotorAN[Vehicle] = 1;
TogglePlayerControllable(playerid,1);
GameTextForPlayer(playerid,"~r~Motor Gestartet", 1000, 1);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s hat den Motor gestartet.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(Vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(Vehicle,1,lights,alarm,doors,bonnet,boot,objective);
}
case 1:
{
new string[256];
SendClientMessage(playerid,COLOR_RED,"* Der Motor erlitt durch das starten einen kleinen schaden *");
format(string, sizeof(string), "* %s hat den Motor starten können aber er hat leichte kratzer", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(Vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(Vehicle,1,lights,alarm,doors,bonnet,boot,objective);
new Float:veh_hp,vehicleid = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehicleid,veh_hp);
new random_string[10];
format(random_string,10,"%d",random(10));
veh_hp -= floatstr(random_string);
SetVehicleHealth(vehicleid, veh_hp);
TogglePlayerControllable(playerid,1);
MotorAN[Vehicle] = 1;
}
case 2:
{
new string[256];
SendClientMessage(playerid,COLOR_RED,"* Der Motor erlitt durch das starten einen geringen schaden *");
format(string, sizeof(string), "* %s hat den Motor starten können aber er ist leicht beschädigt", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(Vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(Vehicle,1,lights,alarm,doors,bonnet,boot,objective);
new Float:veh_hp,vehicleid = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehicleid,veh_hp);
new random_string[15];
format(random_string,15,"%d",random(15));
veh_hp -= floatstr(random_string);
SetVehicleHealth(vehicleid, veh_hp);
TogglePlayerControllable(playerid,1);
MotorAN[Vehicle] = 1;
}
case 3:
{
new string[256];
MotorAN[Vehicle] = 1;
TogglePlayerControllable(playerid,1);
GameTextForPlayer(playerid,"~r~Motor Gestartet", 1000, 1);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s hat den Motor gestartet.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(Vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(Vehicle,1,lights,alarm,doors,bonnet,boot,objective);
}
case 4:
{
new string[256];
SendClientMessage(playerid,COLOR_RED,"* Der Motor erlitt durch das starten einen kleinen schaden *");
format(string, sizeof(string), "* %s hat den Motor starten können aber das öl läuft aus..", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(Vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(Vehicle,1,lights,alarm,doors,bonnet,boot,objective);
new Float:veh_hp,vehicleid = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehicleid,veh_hp);
new random_string[15];
format(random_string,15,"%d",random(15));
veh_hp -= floatstr(random_string);
SetVehicleHealth(vehicleid, veh_hp);
TogglePlayerControllable(playerid,1);
MotorAN[Vehicle] = 1;
}
case 5:
{
new string[256];
SendClientMessage(playerid,COLOR_RED,"* Der Motor erlitt durch das starten einen sehr mittleren schaden *");
format(string, sizeof(string), "* %s hat den Motor starten können aber er raucht etwas", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(Vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(Vehicle,1,lights,alarm,doors,bonnet,boot,objective);
new Float:veh_hp,vehicleid = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehicleid,veh_hp);
new random_string[20];
format(random_string,20,"%d",random(20));
veh_hp -= floatstr(random_string);
SetVehicleHealth(vehicleid, veh_hp);
TogglePlayerControllable(playerid,1);
MotorAN[Vehicle] = 1;
}
case 6:
{
new string[256];
SendClientMessage(playerid,COLOR_RED,"* Der Motor erlitt durch das starten einen mittleren schaden *");
format(string, sizeof(string), "* %s hat den Motor starten können aber irgendwas stimmt noch nicht..", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(Vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(Vehicle,1,lights,alarm,doors,bonnet,boot,objective);
new Float:veh_hp,vehicleid = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehicleid,veh_hp);
new random_string[10];
format(random_string,10,"%d",random(10));
veh_hp -= floatstr(random_string);
SetVehicleHealth(vehicleid, veh_hp);
}
case 7:
{
new string[256];
SendClientMessage(playerid,COLOR_RED,"* Der Motor erlitt durch das starten einen großen schaden *");
format(string, sizeof(string), "* %s hat den Motor starten können aber er ist stark beschädigt", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(Vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(Vehicle,1,lights,alarm,doors,bonnet,boot,objective);
new Float:veh_hp,vehicleid = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehicleid,veh_hp);
new random_string[30];
format(random_string,30,"%d",random(30));
veh_hp -= floatstr(random_string);
SetVehicleHealth(vehicleid, veh_hp);
TogglePlayerControllable(playerid,1);
MotorAN[Vehicle] = 1;
}
case 8:
{
new string[256];
SendClientMessage(playerid,COLOR_RED,"* Der Motor erlitt durch das starten einen sehr Großen schaden *");
format(string, sizeof(string), "* %s hat den Motor starten können aber er qualmt allmälig schon", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(Vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(Vehicle,1,lights,alarm,doors,bonnet,boot,objective);
new Float:veh_hp,vehicleid = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehicleid,veh_hp);
if(veh_hp >= 555) {
SetVehicleHealth(vehicleid, 552);
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
}
}
case 9:
{
rauchtimer[playerid] = SetTimerEx("Reduhp", 1000, 1, "i", playerid);
new string[256];
//SendClientMessage(playerid,COLOR_RED,"* Der Motor erlitt durch das starten einen kleinen schaden *");
format(string, sizeof(string), "* %s hat den Motor nicht starten können er ist nicht mehr funktionstüchtig", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SCM(playerid, COLOR_ROT, "Du erstickst langsam in den Flammen rufe die Feuerwehr oder du bist tot");
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(Vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(Vehicle,0,lights,alarm,doors,bonnet,boot,objective);
new Float:veh_hp,vehicleid = GetPlayerVehicleID(playerid);
MotorAN[Vehicle] = 1;
GetVehicleHealth(vehicleid,veh_hp);
if(veh_hp >= 555) {
SetVehicleHealth(vehicleid, 300);
TogglePlayerControllable(playerid,0);
}
}
case 10:
{
new string[256];
SendClientMessage(playerid,COLOR_RED,"* Der Motor konnte nicht gestartet werden! *");
format(string, sizeof(string), "* %s hat den Motor absaufen lassen.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
}
}
return 1;
}
public Reduhp(playerid)
{
new Float:hp;
new random_string[3];
format(random_string,3,"%d",random(3));
GetPlayerHealth(playerid,hp);
hp -= floatstr(random_string);
if(hp > 09.0)
{
SetPlayerHealth(playerid, hp);
}
else
{
SCM(playerid, COLOR_RED, "Du bist durch die gase des feuers Sehr Stark geschwächt...und kannst dich deswegen nicht bewegen..");
SCM(playerid, COLOR_RED, "Ein Artzt kann dich nur noch retten rufe ihn mit /service medic");
RemovePlayerFromVehicle(playerid);
new Float:PosX, Float:PosY, Float:Angle, Float:PosZ;
GetPlayerPos(playerid, PosX, PosY, PosZ);
GetPlayerFacingAngle(playerid, Angle);
SetPlayerPos(playerid,PosX+3,PosY+3,PosZ+2.1);
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 1200);
GetPlayerPos(playerid, PosX, PosY, PosZ);
SetPlayerCheckpoint(playerid, PosX, PosY, PosZ, 3.0);
KillTimer(rauchtimer[playerid]);
}
}
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
if(IsPlayerConnected(playerid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
{
SendClientMessage(i, col1, string);
}
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
{
SendClientMessage(i, col2, string);
}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
{
SendClientMessage(i, col3, string);
}
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
{
SendClientMessage(i, col4, string);
}
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
SendClientMessage(i, col5, string);
}
}
}
}
return 1;
}
Ich hoffe ihr könnt damit was anfangen...
Ein dank nochmal an ChaosFatz uund Neo
- Bitte ein Admin in den schowroom verschieben - Da ich da nicht Posten kann
hier auch nochmal ein Pastebin
Danke