SA-MP Forums Archive
[FilterScript] Dynamic Stingers System - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Dynamic Stingers System (/showthread.php?tid=633408)



Dynamic Stingers System - AbyssMorgan - 30.04.2017

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



Re: Dynamic Stingers System - IlanZ - 30.04.2017

Very good, very useful for RPG / RP servers


Re: Dynamic Stingers System - JessThompson - 02.05.2017

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


Re: Dynamic Stingers System - coool - 03.05.2017

Good work


Re: Dynamic Stingers System - AbyssMorgan - 17.05.2017

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;




Re: Dynamic Stingers System - JR_Junior - 29.09.2017

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


Re: Dynamic Stingers System - Meller - 29.09.2017

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


Re: Dynamic Stingers System - AbyssMorgan - 29.09.2017

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


Re: Dynamic Stingers System - AzaMx - 30.09.2017

Wow nice, great work!


Re: Dynamic Stingers System - Crystallize - 03.10.2017

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


Re: Dynamic Stingers System - AbyssMorgan - 03.10.2017

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