19.04.2011, 16:28
Hi How to add a ramp in my server.I want to spawn it with left button of the mouse and to be invissible just the player to see it.How to do that?
#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.");
SendClientMessage(playerid, COLOUR_BAD, "--:Credits:= Lordy [FS creator]:--");
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