[FilterScript] Engine System - Max.
#1

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
Reply


Messages In This Thread
Engine System - Max. - by MaxTheMapper - 03.11.2013, 17:44
Re: Engine System - Max. - by kingcrome - 03.11.2013, 21:16
Re: Engine System - Max. - by Marshall32 - 03.11.2013, 21:39
Re: Engine System - Max. - by x96664 - 03.11.2013, 21:47
Re: Engine System - Max. - by [SF]OutLawZ - 04.11.2013, 05:32
Re: Engine System - Max. - by MaxTheMapper - 09.11.2013, 13:27

Forum Jump:


Users browsing this thread: 1 Guest(s)