pawn Код:
#include <a_samp>
forward RampCreate();forward RemoveRamp(id);forward Float:GetOptimumRampDistance(playerid);
forward Float:GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance);
new keydown[MAX_PLAYERS] = {false, ...},rampid[MAX_PLAYERS] = {-1, ...};
public OnFilterScriptInit() {
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
print("STG Ramp Filterscript by Matze_Bellic");
print("Idde by Script Monopoly");
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
SetTimer("RampCreate", 100, 1);
}
public RampCreate(){
new Key1,Key2,Key3,Float:px,Float:py,Float:pz,Float:pa;
for(new i; i < MAX_PLAYERS; i++){
if(IsPlayerConnected(i)){
GetPlayerPos(i,px,py,pz);GetPlayerKeys(i,Key1,Key2,Key3);
if(Key1 & KEY_ACTION && IsPlayerInAnyVehicle(i)){
if(GetVehicleModel(GetPlayerVehicleID(i)) == 481)return false;
if(GetPlayerState(i) == PLAYER_STATE_DRIVER){
if(!keydown[i]){
keydown[i] = 1;
if(rampid[i] == -1){
pa = GetXYInFrontOfPlayer(i, px, py, GetOptimumRampDistance(i));pz += 0.5;
rampid[i] = CreateObject(1632, px, py, pz - 0.5, 0.0, 0.0, pa);
SetTimerEx("RemoveRamp", 2000, 0, "d", i);
}
}
}
}else keydown[i] = 0;
}
}
return 1;
}
public RemoveRamp(id){
if (rampid[id] != -1){DestroyObject(rampid[id]);rampid[id] = -1;}
}
stock GetVehicleWithinDistance(playerid, Float:x1, Float:y1, Float:z1, Float:dist, &veh){
for(new i = 1; i < MAX_VEHICLES; i++){
if(GetVehicleModel(i) > 0){
if(GetPlayerVehicleID(playerid) != i){
new Float:x, Float:y, Float:z,Float:x2, Float:y2, Float:z2;
GetVehiclePos(i, x, y, z);x2 = x1 - x; y2 = y1 - y; z2 = z1 - z;
new Float:vDist = (x2*x2+y2*y2+z2*z2);
if (vDist < dist){veh = i;dist = vDist;}
}
}
}
}
Float:GetOptimumRampDistance(playerid){
new ping = GetPlayerPing(playerid), Float:dist;
dist = floatpower(ping, 0.25);dist = dist*4.0;dist = dist+5.0;
return dist;
}
Float:GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance){
new Float:a;GetPlayerPos(playerid, x, y, a);
if (IsPlayerInAnyVehicle(playerid)) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
else GetPlayerFacingAngle(playerid, a);
x += (distance * floatsin(-a, degrees));y += (distance * floatcos(-a, degrees));
return a;
}
let me know if it's fixed..