Just a help if someone can help
#6

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
new RampActivated[MAX_PLAYERS], Ramp[MAX_PLAYERS], RampTimer[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    RampActivated[playerid] = 0;
    Ramp[playerid] = -1;
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/rampon", true) == 0)
    {
        if(RampActivated[playerid] == 1) return SendClientMessage(playerid, 0xFF0000FF, "You Have Already Activated Ramps. Use {00FF00}/RAMPOFF");
        SendClientMessage(playerid, 0x00FF00FF, "You Have Activated Ramps. Press LCTRL To Create A Ramp.");
        RampActivated[playerid] = 1;
        return 1;
    }
    if(strcmp(cmdtext, "/rampoff", true) == 0)
    {
        if(RampActivated[playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "You Have Not Activated Ramps. Use {00FF00}/RAMPON");
        SendClientMessage(playerid, 0xFF0000FF, "You Have Deactivated Ramps.");
        RampActivated[playerid] = 0;
        if(Ramp[playerid] != -1)
        {
            DestroyObject(Ramp[playerid]);
            Ramp[playerid] = -1;
            KillTimer(RampTimer[playerid]);
        }
        return 1;
    }
    return 0;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(newkeys == KEY_ACTION)
        {
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                if(RampActivated[playerid] == 1)
                {
                    if(Ramp[playerid] != -1)
                    {
                         DestroyObject(Ramp[playerid]);
                         KillTimer(RampTimer[playerid]);
                    }
                    new Float:X, Float:Y, Float:Z, Float:Ang;
                    GetPlayerPos(playerid, X, Y, Z);
                    GetPlayerFacingAngle(playerid, Ang);
                    X += (3 * floatsin(-Ang, degrees));
                    Y += (3 * floatcos(-Ang, degrees));
                    Ramp[playerid] = CreateObject(ObjID, X, Y, Z, 0.0, 0.0, Ang); //Replace ObjID with the ramp object ID
                    RampTimer[playerid] = SetTimerEx("RemoveRamp", 5000, false, "i", playerid);
                }
            }
        }
    }
    return 1;
}

forward RemoveRamp(playerid);
public RemoveRamp(playerid)
{
    DestroyObject(Ramp[playerid]);
    Ramp[playerid] = -1;
    return 1;
}
NOTE: You MUST change 'ObjID' with the model ID for the ramp.
Reply


Messages In This Thread
Just a help if someone can help - by ZBits - 23.08.2012, 09:47
Re: Just a help if someone can help - by ZBits - 23.08.2012, 10:02
Re: Just a help if someone can help - by ThePhenix - 23.08.2012, 10:05
Re: Just a help if someone can help - by ZBits - 23.08.2012, 10:08
Re: Just a help if someone can help - by Team_PRO - 23.08.2012, 10:11
Re: Just a help if someone can help - by clarencecuzz - 23.08.2012, 10:33
Re: Just a help if someone can help - by ZBits - 23.08.2012, 12:09
Re: Just a help if someone can help - by ZBits - 23.08.2012, 12:23
Re: Just a help if someone can help - by clarencecuzz - 23.08.2012, 12:32
Re: Just a help if someone can help - by ZBits - 23.08.2012, 12:38

Forum Jump:


Users browsing this thread: 1 Guest(s)