/ramp
#3

i've done this umm hold on .....
Код:
#if defined _ramp_included
#endinput
#endif

#define _ramp_included
#pragma library ramp


static Pressedkey[MAX_PLAYERS] = {false, ...};
new jumped[MAX_PLAYERS] = {-1, ...};
static ramped[MAX_PLAYERS];
static noramp[MAX_PLAYERS];
forward Keys();
forward DeleteRamp(playerid);
forward RampCommandText(playerid, cmdtext[]);

public RampCommandText(playerid, cmdtext[]){
    if (strcmp("/ramphelp ", cmdtext, true, 9) == 0)	{
		SendClientMessage(playerid, COLOUR_GOOD, "Type /rampon to turn ramp spawning on.");
        SendClientMessage(playerid, COLOUR_GOOD, "Type /rampoff to turn ramp spawning off.");
        SendClientMessage(playerid, COLOUR_GOOD, "Press the [Fire] button whilst in a vehicle to spawn a ramp.");

        return 1;
	}
	if (strcmp("/rampoff ", cmdtext, true, 8) == 0)	{
		ramped[playerid] = 1;
		noramp[playerid] = 1;
		SendClientMessage(playerid, COLOUR_BAD, "Type /rampon to turn it back on!");
		return 1;
	}
	if (strcmp("/rampon ", cmdtext, true, 7) == 0)	{
		ramped[playerid] = 0;
		noramp[playerid] = 0;
		SendClientMessage(playerid, COLOUR_BAD, "Type /rampoff to turn it back off!");
		return 1;
	}
    return 0;
}

public Keys(){
	new keys, jump, updown, playerid;
	new Float:x, Float:y, Float:z, Float:angle;
	for (playerid = 0; playerid < MAX_PLAYERS; playerid++) {
	    if (IsPlayerConnected(playerid)) {
			GetPlayerKeys(playerid, keys, jump, updown);
			if(ramped[playerid] == 1 && noramp[playerid] == 1)	{
			if(keys & KEY_FIRE && IsCarRampable(playerid))	{
                        SendClientMessage(playerid, COLOUR_BAD, "You have Ramping turned off!");
                        SendClientMessage(playerid, COLOUR_BAD, "Type /rampon to turn it back on!");
				}
			}
			else if(ramped[playerid] == 1)	{
			
			}
			else if (keys & KEY_FIRE && IsPlayerInCar(playerid)) {{
					    GetPlayerPos(playerid, x, y, z);
					    angle = GetPosInFrontOfPlayer(playerid, x, y, GetRampDistance(playerid));
					    jumped[playerid] = CreateObject(1632, x, y, z - 0.5, 0.0, 0.0, angle);
					    ramped[playerid] = 1;
					    SetTimerEx("DeleteRamp", 800, 0, "d", playerid);
				    }
			    }
			} else Pressedkey[playerid] = false;
		}
}

public DeleteRamp(playerid){
	if (jumped[playerid] != -1) {
	    DestroyObject(jumped[playerid]);
	    jumped[playerid] = -1;
	    ramped[playerid]=0;
	}
}

#endinput
save that as ramp.inc and put it in your .pwn folder same as project

then at the top of ya game go #include "ramp"

then under OnGameModeInit()
Код:
SetTimer("Keys", 100, 1);
then at the bottom of OnPlayerCommandText(playerid, cmdtext[]) just above Return 0; go
Код:
new gcmd;
gcmd += RampCommandText(playerid, cmdtext);
if(gcmd >= 1) return 1;
try that

edit... edit
Reply


Messages In This Thread
/ramp - by Mr.Jvxmc - 26.10.2010, 21:25
Re: /ramp - by Miguel - 27.10.2010, 01:40
Re: /ramp - by (SF)Noobanatior - 27.10.2010, 05:30
Re: /ramp - by Mr.Jvxmc - 27.10.2010, 13:49

Forum Jump:


Users browsing this thread: 4 Guest(s)