[FilterScript] Dynamic Stingers System
#1

Hello, I would like to present you the Stingers Script (Cops and Robbers)

Video:
https://www.youtube.com/watch?v=nslVT5RC3J0

Download:
Stingers.inc
3DTryg.inc Thread

Installation:
PHP Code:
#include <ADM/3DTryg>
#include <Stingers> 
Functions:
PHP Code:
CreateDynamicStinger(type,Float:x,Float:y,Float:z,Float:rx,Float:ty,Float:rz,worldid=-1,interiorid=-1,playerid=-1,Float:streamdistance=100.0,teamid=ANY_TEAM,byplayerid=INVALID_PLAYER_ID);
DestroyDynamicStinger(mobid);

bool:IsDynamicStingerActive(mobid);
GetDynamicStingerObjectID(mobid);
GetDynamicStingerTeam(mobid);
SetDynamicStingerTeam(mobid,teamid);
GetDynamicStingerPlayerID(mobid);
SetDynamicStingerPlayerID(mobid,byplayerid);
GetPlayerActiveDynamicStinger(playerid);
ToggleDynamicStingerDamage(mobid,bool:toggle); 
Callbacks:
PHP Code:
//called on vehicle damage updated by stinger
OnVehicleDamageByStinger(playerid,killerid,mobid,old_tires,new_tires); 
Definitions:
PHP Code:
STINGER_TYPE_SMALL //Object: 2899
STINGER_TYPE_BIG   //Object: 2892 
Example code:
PHP Code:
public OnVehicleDamageByStinger(playerid,killerid,mobid,old_tires,new_tires){
    if(
killerid != INVALID_PLAYER_ID){
        new 
p_name[MAX_PLAYER_NAME],string[144];
        
GetPlayerName(killerid,p_name,sizeof(p_name));
        
format(string,sizeof(string),"{00AAFF}Your vehicle has been damaged by {00FF00}%s {00AAFF}stinger.",p_name);
        
SendClientMessage(playerid,-1,string);
    }
    return 
1;
}

new 
StingerObj[MAX_PLAYERS];

public 
OnPlayerDisconnect(playerid,reason){
    if(
StingerObj[playerid] != 0){
        
DestroyDynamicStinger(StingerObj[playerid]);
        
StingerObj[playerid] = 0;
    }
    return 
1;
}

CMD:stinger(playerid,params[]){
    if(!
strcmp(params,"destroy",true)){
        
DestroyDynamicStinger(StingerObj[playerid]);
        
StingerObj[playerid] = 0;
        return 
SendClientMessage(playerid,-1,"Stinger Destroyed");
    }
    if(
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"First get out of the vehicle");
    if(
GetPlayerActiveDynamicStinger(playerid)) return SendClientMessage(playerid,-1,"You are near another stinger");
    new 
type;
    if(!
strcmp(params,"big",true)){
        
type STINGER_TYPE_BIG;
    } else if(!
strcmp(params,"small",true)){
        
type STINGER_TYPE_SMALL;
    } else {
        if(!
IsGM(playerid)){
            return 
SendClientMessage(playerid,-1,"Usage /stinger <big/small/destroy>");
        } else {
            return 
SendClientMessage(playerid,-1,"Usage /stinger <big/small/destroy>");
        }
    }
    
    new 
Float:x,Float:y,Float:z,Float:z_angle;
    
GetPlayerPos(playerid,x,y,z);
    
GetPlayerFacingAngle(playerid,z_angle);
    
DestroyDynamicStinger(StingerObj[playerid]);
    
StingerObj[playerid] = CreateDynamicStinger(type,x,y,z-0.9,0.0,0.0,CompRotationFloat(z_angle+90.0),-1,-1,-1,100.0,ANY_TEAM,playerid);
    return 
SendClientMessage(playerid,-1,"Stinger added");

Issues:

- Stinger can not be located near to another stinger

Notice:

Filterscript not exist because filterscripts have limits.

This has been replaced by include, having automatic installation, efficient GameMode/FilterScript.


Non-Registered Users:
Bug Report
Reply
#2

Very good, very useful for RPG / RP servers
Reply
#3

I like it. Since this only pops the tire that touches the stinger, much more realistic. Well done.
Reply
#4

Good work
Reply
#5

Update v1.1.0:


- Added callback:
PHP Code:
//called on vehicle damage updated by stinger
OnVehicleDamageByStinger(playerid,killerid,mobid,old_tires,new_tires); 
- Added function:
PHP Code:
GetPlayerActiveDynamicStinger(playerid);
ToggleDynamicStingerDamage(mobid,bool:toggle); 


- Example code:
PHP Code:
public OnVehicleDamageByStinger(playerid,killerid,mobid,old_tires,new_tires){
    if(
killerid != INVALID_PLAYER_ID && new_tires == 15){
        new 
p_name[MAX_PLAYER_NAME],string[144];
        
GetPlayerName(killerid,p_name,sizeof(p_name));
        
format(string,sizeof(string),"{00AAFF}Your vehicle has been damaged by {00FF00}%s {00AAFF}stinger.",p_name);
        
SendClientMessage(playerid,-1,string);
    }
    return 
1;

Reply
#6

Nice, very nice!
Can you add to prevent damage for a certain team(cops)?
Reply
#7

Quote:
Originally Posted by JR_Junior
View Post
Nice, very nice!

Can you add to prevent damage for a certain team(cops)?
PHP Code:
public OnVehicleDamageByStinger(playerid,killerid,mobid,old_tires,new_tires){ 
    if(
killerid != INVALID_PLAYER_ID && GetPlayerTeam(killerid) == GetPlayerTeam(playerid)){ 
        
// set the vehicle tire status to old_tires
    

    return 
1

ez pz lemon squezy
Reply
#8

Quote:
Originally Posted by JR_Junior
View Post
Nice, very nice!

Can you add to prevent damage for a certain team(cops)?
Code:
CreateDynamicStinger(type,Float:x,Float:y,Float:z,Float:rx,Float:ty,Float:rz,worldid=-1,interiorid=-1,playerid=-1,Float:streamdistance=100.0,
teamid=ANY_TEAM,byplayerid=INVALID_PLAYER_ID);
for SetPlayerTeam


Quote:
Originally Posted by Meller
View Post
PHP Code:
public OnVehicleDamageByStinger(playerid,killerid,mobid,old_tires,new_tires){ 
    if(
killerid != INVALID_PLAYER_ID && GetPlayerTeam(killerid) == GetPlayerTeam(playerid)){ 
        
// set the vehicle tire status to old_tires
    

    return 
1

ez pz lemon squezy
bad idea
Reply
#9

Wow nice, great work!
Reply
#10

Title is so missleading I thought they are missiles lol :P
Good job anyways
Reply
#11

Quote:
Originally Posted by Crystallize
Посмотреть сообщение
Title is so missleading I thought they are missiles lol :P
Good job anyways
Missiles here:
Missile
VehicleMissileCol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)