All pastes #944931 Raw Edit

RCRL

public cpp v1 · immutable
·published 2008-03-16 15:58 UTC
rendered paste body
#include <a_samp>//---------------------SETTINGS-------------------------//#define MG_RADIUS 5 //spread of shooting#define MG_RANGE 30 //distance of shooting#define ShootingCar 502 //change this if you want and other shooting car then the hotringnew minigun;//--------------------------------------------------------public OnFilterScriptInit(){	print("\n--------------------------------------");	print("----Rocket Launcher on Car by R@f-----");	print("--------------------------------------\n");	return 1;}public OnFilterScriptExit(){    DestroyObject(minigun);	return 1;}main(){}//------------------------------------------------------------stock Float:GetDistanceBetweenPlayers(p1,p2){	new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;	if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2))	{		return -1.00;	}	GetPlayerPos(p1,x1,y1,z1);	GetPlayerPos(p2,x2,y2,z2);	return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));}//-----------------------------------------------------------public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){	if(newkeys==2)	{	if(GetVehicleModel(GetPlayerVehicleID(playerid))==ShootingCar)	{    new Float:x,Float:y,Float:z,Float:vx,Float:vy,Float:a;	new vehicleid = GetPlayerVehicleID(playerid);	GetVehiclePos(vehicleid,x,y,z);	GetVehicleZAngle(vehicleid,a);	for (new r = 10; r < MG_RANGE; r++)	{	vx = x + (r * floatsin(-a, degrees));    vy = y + (r * floatcos(-a, degrees));    if(GetPlayersOnline()==1)    {    vx = x + (40 * floatsin(-a, degrees));    vy = y + (40 * floatcos(-a, degrees));	CreateExplosion(vx,vy,z+0.5,2,1.0);    }    for (new i = 0; i < MAX_PLAYERS; i++)	{	if((i!=playerid)&&(IsPlayerConnected(i)==1))	{	//	if(IsPlayerInSphere(i,vx,vy,z,MG_RADIUS)==1)	{	new Float:dis,Float:dis2,player;	new pteam[MAX_PLAYERS];	player = -1;	dis = 99999.99;	dis2 = GetDistanceBetweenPlayers(i,playerid);	if (dis2 < dis && dis2 != -1.00 && pteam[i] == pteam[playerid])	{	dis = dis2;	player = i;	new Float:px,Float:py,Float:pz;	GetPlayerPos(player,px,py,pz);    CreateExplosion(px,py,pz+0.5,2,1.0);	}	}	//	else if(IsPlayerInSphere(i,vx,vy,z,MG_RADIUS)==0)	{	vx = x + (40 * floatsin(-a, degrees));    vy = y + (40 * floatcos(-a, degrees));	CreateExplosion(vx,vy,z+0.5,2,1.0);	}	}	}	}    }	}}//------------------------------------------------------------------------------stock IsPlayerInSphere(playerid,Float:x,Float:y,Float:z,radius){ if(GetPlayerDistanceToPointEx(playerid,x,y,z) < radius) {  return 1; } return 0;}//------------------------------------------------------------------------------stock GetPlayerDistanceToPointEx(playerid,Float:x,Float:y,Float:z){new Float:x1,Float:y1,Float:z1;new Float:dis;GetPlayerPos(playerid,x1,y1,z1);dis = floatsqroot((x-x1)*(x-x1)+(y-y1)*(y-y1)+(z-z1)*(z-z1));return floatround(dis);}//------------------------------------------------------------------------------stock GetPlayersOnline(){ new Ile; new g; while(g<GetMaxPlayers() && IsPlayerConnected(g)){  Ile++;  g++; } return Ile;}//------------------------------------------------------------------------------public OnPlayerStateChange(playerid, newstate, oldstate){	if(newstate == PLAYER_STATE_DRIVER)	{    if (GetVehicleModel(GetPlayerVehicleID(playerid))==ShootingCar)	{	minigun=CreateObject(359, 0.0, 0.0, 0.0, 0, 0, 0);	AttachObjectToPlayer(minigun,playerid,0.3,2.0,0.4,90,0,90);	}	}	if(newstate == PLAYER_STATE_ONFOOT)	{	DestroyObject(minigun);	}	return 1;}