SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 03/11/2013, 05:44 PM   #1
MaxTheMapper
Banned
 
Join Date: Oct 2013
Location: Canada brahz!
Posts: 53
Reputation: 27
Default Engine System - Max.

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 Code:
#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
MaxTheMapper is offline   Reply With Quote
Old 03/11/2013, 09:16 PM   #2
kingcrome
Big Clucker
 
Join Date: Oct 2013
Posts: 89
Reputation: 0
Default Re: Engine System - Max.

Sweet im going to use this
kingcrome is offline   Reply With Quote
Old 03/11/2013, 09:39 PM   #3
Marshall32
Big Clucker
 
Join Date: Jun 2011
Posts: 183
Reputation: 48
Default Re: Engine System - Max.

Keep up the good work.
Marshall32 is offline   Reply With Quote
Old 03/11/2013, 09:47 PM   #4
x96664
Gangsta
 
x96664's Avatar
 
Join Date: Jun 2009
Posts: 588
Reputation: 7
Default Re: Engine System - Max.

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.
x96664 is offline   Reply With Quote
Old 04/11/2013, 05:32 AM   #5
[SF]OutLawZ
Big Clucker
 
[SF]OutLawZ's Avatar
 
Join Date: Dec 2009
Location: Australia
Posts: 168
Reputation: 32
Default Re: Engine System - Max.

Why wouldn't you set the vehicle params? http://wiki.sa-mp.com/wiki/SetVehicleParamsEx
Toggle the engine status, that's my recommendation
__________________

War_Z up for sale, Contact me for a quote!

War_Z Footage v1.
My 2013 Mapping.
Derbylicious Filterscript.
[SF]OutLawZ is offline   Reply With Quote
Old 09/11/2013, 01:27 PM   #6
MaxTheMapper
Banned
 
Join Date: Oct 2013
Location: Canada brahz!
Posts: 53
Reputation: 27
Default Re: Engine System - Max.

Ok thanks for the tip :=)
MaxTheMapper is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I create an engine system and a total system? Grooty Scripting Help 5 10/09/2013 09:34 AM
/engine system help masca12 Scripting Help 6 08/11/2012 07:38 AM
[HELP]My engine system yarrum3 Help Archive 1 24/03/2011 05:24 AM
[HELP]I just edited my /engine system and when i do /engine it says "unknown Lilcuete Help Archive 2 25/04/2010 01:31 PM
[Help]Engine system leon_sharped Help Archive 2 07/02/2009 10:19 PM


All times are GMT. The time now is 12:58 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.