[FilterScript] Engine System - Max. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Engine System - Max. (
/showthread.php?tid=473630)
Engine System - Max. -
MaxTheMapper - 03.11.2013
Hello, this is my first filterscript i made it all by myself im not that experienced as a scripter as im a mapper but i gave it a shot if you dont like it dont download it but if you like it i like you :=)
pawn Код:
#include <a_samp>
#define COLOR_PURPLE 0xBA84D1FF
#define COLOR_RED 0xFA0000FF
#define COLOR_YELLOW 0xFFFF00FF
public OnFilterScriptInit()
{
print("Ґ > Engine Starter loaded by Max < Ґ");
}
public OnFilterScriptExit()
{
print("Ґ > Engine Starter unloaded by Max < Ґ");
}
new Engine[MAX_PLAYERS];
forward EngineStart(playerid);
forward EngineStartup(playerid);
public OnPlayerConnect(playerid)
{
SendClientMessage(playerid, COLOR_YELLOW,"This server is using the engine system made by Max");
Engine[playerid] = 0;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/engine", true) == 0)
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED,"You can't start an engine if you are not in a vehicle!");
new Float:veh_health, vehicle = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehicle, veh_health);
if(veh_health <= 400) return SendClientMessage(playerid, COLOR_RED,"Your engine is to much damaged to start it, please repair it");
SendClientMessage(playerid, COLOR_PURPLE,"You twist the key, and wait 3 seconds");
SetTimerEx("EngineStart", 3000, false, "d", playerid);
return 1;
}
return 0;
}
public EngineStart(playerid)
{
switch(random(3))
{
case 1:
{
Engine[playerid] = 1;
SendClientMessage(playerid, COLOR_YELLOW,"Engine is succesfully started");
TogglePlayerControllable(playerid, 1);
}
case 2:
{
Engine[playerid] = 0;
SendClientMessage(playerid, COLOR_YELLOW,"Engine failed to start, please try again");
TogglePlayerControllable(playerid, 0);
}
}
return 1;
}
public OnPlayerUpdate(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:veh_health, vehicle = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehicle, veh_health);
if(veh_health <= 400)
{
if(Engine[playerid] == 1)
{
Engine[playerid] = 0;
RemovePlayerFromVehicle(playerid);
GameTextForPlayer(playerid, "~r~Engine shutted down", 2000, 3);
}
return 1;
}
}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
SetTimerEx("EngineStartup", 1000, false, "d", playerid);
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
Engine[playerid] = 0;
return 1;
}
public EngineStartup(playerid)
{
TogglePlayerControllable(playerid, 0);
GameTextForPlayer(playerid, "~g~Engine is not started!~n~~r~Use /engine to start it", 3000, 4);
TogglePlayerControllable(playerid, 0);
}
NOTE: Credits : Ehh.. the credits are on me as i made it but you can change it no big deal
Re: Engine System - Max. -
kingcrome - 03.11.2013
Sweet im going to use this
Re: Engine System - Max. -
Marshall32 - 03.11.2013
Keep up the good work.
Re: Engine System - Max. -
x96664 - 03.11.2013
Little suggestion, if you are going to release new versions of this fs, define the vehicle with engine, i.e. bikes don't have engine so they don't need to be started.
Re: Engine System - Max. -
[SF]OutLawZ - 04.11.2013
Why wouldn't you set the vehicle params?
https://sampwiki.blast.hk/wiki/SetVehicleParamsEx
Toggle the engine status, that's my recommendation
Re: Engine System - Max. -
MaxTheMapper - 09.11.2013
Ok thanks for the tip :=)