Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * *
- * ## ## ######## ## ## ######## ## ## ######## ######## *
- * ## ## ## ## ## ## ## ## ## ## ## *
- * ######## #### ## ## ## ## ## ######## ###### *
- * ## ## ## ## ## ## ## ## ## ## *
- * ## ## ######## ## ######## ## ## ######## *
- * *
- * -------------------------------------------------------------------- *
- * *
- * P R O D U C T I O N S *
- * *
- * -------------------------------------------------------------------- *
- * *
- * Scripter: Fake (Philip) Release: 15.07.2012 *
- * *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
- /*
- * Includes
- */
- #include <a_samp>
- /*
- * Deklarationen
- */
- #define HOLDING(%0) \
- ((newkeys & (%0)) == (%0))
- #define PRESSED(%0) \
- (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
- #define RELEASED(%0) \
- (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
- #define WEIS 0xFFFFFFFF
- #define GRAU 0x9F9F9FFF
- #define LILA 0xC2A2DAAA
- new vEngineState[MAX_VEHICLES];
- new playerName[MAX_PLAYER_NAME];
- forward vStartMotor(playerid);
- forward ProxDetector(Float:radi, playerid, string[], col1, col2, col3, col4, col5);
- /*
- * Initialisierung
- */
- public OnFilterScriptInit()
- {
- //
- // Fahrzeuge
- //
- for(new c = 0; c < MAX_VEHICLES; c++)
- {
- vEngineState[c] = 0;
- }
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- /*
- * Funktionen
- */
- strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
- //
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- if(!vEngineState[vehicleid])
- {
- SetVehicleParamsEx(vehicleid, false, lights, alarm, doors, bonnet, boot, objective);
- }
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- if(vEngineState[vehicleid])
- {
- SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- }
- else
- {
- SetVehicleParamsEx(vehicleid, false, false, alarm, doors, bonnet, boot, objective);
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(PRESSED(KEY_FIRE))
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- if(GetPlayerState(playerid) == 2)
- {
- GetPlayerName(playerid, playerName, sizeof(playerName));
- new string[255], engine, lights, alarm, doors, bonnet, boot, objective;
- new vehicle = GetPlayerVehicleID(playerid);
- if(vEngineState[vehicle])
- {
- GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(vehicle, false, false, alarm, doors, bonnet, boot, objective);
- vEngineState[vehicle] = 0;
- format(string, sizeof(string), "* %s schaltet sein Fahrzeug ab.", playerName);
- ProxDetector(30.0, playerid, string, LILA, LILA, LILA, LILA, LILA);
- GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~r~Der Motor ist nun aus.", 3000, 3);
- }
- else
- {
- format(string, sizeof(string), "* %s versucht sein Fahrzeug zu starten.", playerName);
- ProxDetector(30.0, playerid, string, LILA, LILA, LILA, LILA, LILA);
- GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Motor wird gestartet...", 3000, 3);
- SetTimerEx("vStartMotor", 3500, 0, "i", playerid);
- }
- }
- }
- }
- if(PRESSED(KEY_ACTION))
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- if(GetPlayerState(playerid) == 2)
- {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- new vehicle = GetPlayerVehicleID(playerid);
- GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- if(lights)
- {
- SetVehicleParamsEx(vehicle, engine, false, alarm, doors, bonnet, boot, objective);
- }
- else
- {
- SetVehicleParamsEx(vehicle, engine, true, alarm, doors, bonnet, boot, objective);
- }
- }
- }
- }
- return 1;
- }
- public vStartMotor(playerid)
- {
- new StartChance = random(5);
- new string[255], engine, lights, alarm, doors, bonnet, boot, objective;
- new vehicle = GetPlayerVehicleID(playerid);
- if(IsPlayerConnected(playerid))
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- if(GetPlayerState(playerid) == 2)
- {
- switch(StartChance)
- {
- case 0,1,2,3:
- {
- GetPlayerName(playerid, playerName, sizeof(playerName));
- GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(vehicle, true, true, alarm, doors, bonnet, boot, objective);
- vEngineState[vehicle] = 1;
- format(string, sizeof(string), "* %s hat den Motor gestartet.", playerName);
- ProxDetector(30.0, playerid, string, LILA, LILA, LILA, LILA, LILA);
- GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~Der Motor ist nun an.", 3000, 3);
- }
- case 4:
- {
- GetPlayerName(playerid, playerName, sizeof(playerName));
- GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(vehicle, false, lights, alarm, doors, bonnet, boot, objective);
- vEngineState[vehicle] = 0;
- format(string, sizeof(string), "* %s hat den Motor verrecken lassen.", playerName);
- ProxDetector(30.0, playerid, string, LILA, LILA, LILA, LILA, LILA);
- GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~r~Der Motor ist verreckt!", 3000, 3);
- }
- }
- }
- }
- }
- return 1;
- }
- 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;
- }
- /*
- * Kommandos
- */
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[255];
- new idx = 0;
- cmd = strtok(cmdtext, idx);
- if(strcmp(cmd, "/fsinfo", true) == 0)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- SendClientMessage(playerid, GRAU, "------------------------------------------");
- SendClientMessage(playerid, WEIS, "-- 4#Future Productions präsentiert --");
- SendClientMessage(playerid, WEIS, "-- # MotorEngine FS # --");
- SendClientMessage(playerid, GRAU, "------------------------------------------");
- return 1;
- }
- }
- return 1;
- }
- return SendClientMessage(playerid, GRAU, "Der eingegebene Befehl ist nicht bekannt.");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement