#include <a_samp>
#include <streamer>
#include <zcmd>
new vpara[MAX_PLAYERS];
new para[MAX_VEHICLES];
public OnPlayerSpawn(playerid)
{
vpara[playerid]=0;//use this onplayerconnect too to avoid bugs
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
vpara[playerid]=0;
DestroyDynamicObject(para[vehicleid]);
}
return 1;
}
public OnPlayerUpdate(playerid)
{
if(vpara[playerid]==1)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
static vid, Float:x, Float:y, Float:z;
vid = GetPlayerVehicleID(playerid);
GetVehicleVelocity(vid,x,y,z);
SetVehicleVelocity(vid,x,y,-0.2);
}
}
}
return 1;
}
CMD:vpara(playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "EREOR: You Must Be In Vehicle To Use That Command.");
new vid = GetPlayerVehicleID(playerid);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(vpara[playerid]==0)
{
para[vid] = CreateDynamicObject(18849,0.0,0.0,-6000.0,0.0,0.0,0.0,GetPlayerVirtualWorld(playerid),GetPlayerInterior(playerid));
SendClientMessage(playerid, -1, "~Parachute Attached.");
switch(random(5))
{
case 0: {
SetDynamicObjectMaterial(para[vid],0,18841,"MickyTextures","Smileyface2",0x00000000);
SetDynamicObjectMaterial(para[vid],2,10412,"hotel1","carpet_red_256",0x00FFFFFF);
}
case 1: {
SetDynamicObjectMaterial(para[vid],0,18841,"MickyTextures","red032",0x00000000);
SetDynamicObjectMaterial(para[vid],2,10412,"hotel1","carpet_red_256",0x00FFFFFF);
}
case 2: {
SetDynamicObjectMaterial(para[vid],0,18841,"MickyTextures","ws_gayflag1",0x00000000);
SetDynamicObjectMaterial(para[vid],2,10412,"hotel1","carpet_red_256",0x00FFFFFF);
}
case 3: {
SetDynamicObjectMaterial(para[vid],0,18841,"MickyTextures","waterclear256",0x00000000);
SetDynamicObjectMaterial(para[vid],2,10412,"hotel1","carpet_red_256",0x00FFFFFF);
}
case 4: {
SetDynamicObjectMaterial(para[vid],2,10412,"hotel1","carpet_red_256",0x00FFFFFF);
}
}
new Float:x,Float:y,Float:z;
GetVehicleModelInfo(GetVehicleModel(vid),VEHICLE_MODEL_INFO_SIZE,x,y,z);
z /= 2.0;
AttachDynamicObjectToVehicle(para[vid],vid,0.0,0.0,z+6.0,0.0,0.0,90.0);
vpara[playerid] = 1;
return 1;
}
if(vpara[playerid]==1)
{
SendClientMessage(playerid, -1, "~Parachute Removed.");
DestroyDynamicObject(para[vid]);
vpara[playerid]=0;
return 1;
}
}
return 1;
}