[FilterScript] Hunting System
#1

Hello, I would like to present you the Hunting System.

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

Functions:
PHP Code:
Hunting::Create(type,Float:x,Float:y,Float:z,Float:health,respawntime,worldid=-1,interiorid=-1,playerid=-1,Float:streamdistance=200.0,moving_area 0);
Hunting::Destroy(mobid);
Hunting::Respawn(mobid);
Hunting::ForceRespawn(mobid,Float:x,Float:y,Float:z);
Hunting::Kill(mobid,playerid=INVALID_PLAYER_ID);
Hunting::Stop(mobid,delay=-1);
Hunting::GoTo(mobid,Float:x,Float:y,bool:disable_moving=false);
Hunting::GetDrop(mobid);
Hunting::SetDrop(mobid,drop);
Hunting::GetPos(mobid,Float:x,Float:y,Float:z);
Hunting::SetPos(mobid,Float:x,Float:y,Float:z,bool:disable_moving=false);
Hunting::GetScaredRange(mobid);
Hunting::SetScaredRange(mobid,Float:range);
Hunting::GetHealth(mobid);
Hunting::SetHealth(mobid,Float:health);
Hunting::GetSpawnHealth(mobid);
Hunting::SetSpawnHealth(mobid,Float:health);
Hunting::GetRespawnTime(mobid);
Hunting::SetRespawnTime(mobid,respawntime);
Hunting::GetSpawn(mobid,&Float:x,&Float:y,&Float:z);
Hunting::SetSpawn(mobid,Float:x,Float:y,Float:z);
Hunting::GetInterior(mobid);
Hunting::SetInterior(mobid,interiorid);
Hunting::GetVirtualWorld(mobid);
Hunting::SetVirtualWorld(mobid,worldid);
Hunting::GetSpeed(mobid);
Hunting::SetSpeed(mobid,Float:speed);
Hunting::GetPressTime(mobid);
Hunting::SetPressTime(mobid,miliseconds);
Hunting::GetFacingAngle(mobid);
Hunting::SetCalmTime(mobid,time=0);
Hunting::IsPlayerInRange(playerid,mobid,Float:range);
Hunting::IsToggledMoving(mobid);
Hunting::ToggleMoving(mobid,toggle);
Hunting::IsValid(mobid);
Hunting::IsSpawned(mobid);
Hunting::IsDead(mobid);
Hunting::IsScared(mobid);
Hunting::IsStopped(mobid);
Hunting::IsMoving(mobid); 
Extended Functions:
PHP Code:
Hunting::Count();
Hunting::GetKey();
Hunting::SetKey(key);
Hunting::GetFreeID();
Hunting::GetActiveMob(playerid,mob_state); 
Callbacks:
PHP Code:
OnPlayerTakeHuntDrop(playerid,mobid,drop);
OnPlayerKillHuntAnimal(playerid,mobid);
OnPlayerApproachingAnimal(playerid,mobid,mob_state);
OnPlayerExitApproachingAnimal(playerid,mobid,mob_state);
OnAnimalTakeDamage(mobid,playerid,Float:amount,weaponid);
OnHuntAnimalRespawn(mobid);
OnAnimalScareStateChanged(mobid,playerid,isscared);
OnPlayerHuntDropStateChange(playerid,mobid,drop_state); //only called if press time > 0 
Definitions:
PHP Code:
//Config
MAX_HUNTING_ANIMALS     //default is 100 allowed to redefine
HUNTING_UPDATE_INTERVAL //default is 500 allowed to redefine

//Animal types
HUNTING_TYPE_COW
HUNTING_TYPE_DEER

//Animal state
HUNTING_STATE_DESTROYED //animal not exist
HUNTING_STATE_SPAWNED   //animal is spawned
HUNTING_STATE_DEAD      //animal is dead

//Drop State
HUNTING_DROP_STATE_FINISH
HUNTING_DROP_STATE_START
HUNTING_DROP_STATE_INTERRUPT

//Other
INVALID_HUNTING_ID
HUNTING_NO_AUTO_RESPAWN 
//disable auto respawn (respawntime param) 
Example Pawn Code:
PHP Code:
#include <a_samp>
#include <streamer>
#include <ColAndreas>
#include <ADM/3DTryg>
#include <Hunting>

public OnFilterScriptInit(){

    new 
my_zone CreateDynamicRectangle(-100.0,-100.0,100.0,100.0);
    for(new 
05i++){
        
Hunting::Create(HUNTING_TYPE_COW,0.0,0.0,3.0,55.0,30,.moving_area=my_zone);
    
        
Hunting::Create(HUNTING_TYPE_DEER,5.0,0.0,3.0,55.0,30,.moving_area=my_zone);
    }

    return 
1;
}

public 
OnPlayerTakeHuntDrop(playerid,mobid,drop){
    
    if(
drop){
        
SendClientMessage(playerid,-1,"You received $2500");
        
GivePlayerMoney(playerid,2500);
    }
    return 
0//set drop flag 0
}

public 
OnPlayerKillHuntAnimal(playerid,mobid){
    
    
SendClientMessage(playerid,-1,"Animal has been killed !");
    
    return 
1;
}

public 
OnPlayerApproachingAnimal(playerid,mobid,mob_state){

    if(
mob_state == HUNTING_STATE_DEAD){
        
SendClientMessage(playerid,-1,"Press Y to raise prize.");
    }
    
    return 
1;
}

public 
OnPlayerExitApproachingAnimal(playerid,mobid,mob_state){

    return 
1;
}

public 
OnAnimalTakeDamage(mobid,playerid,Float:amount,weaponid){
    
    if(
weaponid != 34) return 0//sniper only :D
    
    
return 1;
}

public 
OnHuntAnimalRespawn(mobid){
    
    return 
1;
}

public 
OnAnimalScareStateChanged(mobid,playerid,isscared){

    return 
1;
}

//only called if press time > 0
public OnPlayerHuntDropStateChange(playerid,mobid,drop_state){
    switch(
drop_state){
        case 
HUNTING_DROP_STATE_FINISH: {
            
//your code
        
}
        case 
HUNTING_DROP_STATE_START: {
            
//your code
        
}
        case 
HUNTING_DROP_STATE_INTERRUPT: {
            
//your code
        
}
    }
    return 
1;

Download:
Hunting.inc
3DTryg.inc Thread
ColAndreas Plugin

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

Thank you! It was a personal request from my side.
You completed within 24h!
Reply
#3

Cool release, I picked up a trick or two from the code while reviewing it, gj
Reply
#4

Nice system, congratulations.
Reply
#5

Looks nice.
Reply
#6

That's very nicely done, and its just GREAT with an include, and the zone moving is just dope,
Great Work, once again
Reply
#7

Funny cows, good job.
Reply
#8

Well done, I might use it in the future.
Would be cool if you add a parameter to set the health of an animal and if you shoot it, a progressbar shows up with the current health of the animal.
Reply
#9

Quote:
Originally Posted by JustMe.77
View Post
Well done, I might use it in the future.

Would be cool if you add a parameter to set the health of an animal and if you shoot it, a progressbar shows up with the current health of the animal.
That's literally not possible, cause from what I know you can't attach a label to an object.
Reply
#10

Pretty good!
Reply
#11

You can't attach a textdraw nor progress bar to an object either.
Reply
#12

TextDraw is HUD element visible on player screen. Not possible to attach to object, also is not possible to attach 3DText to object.
Reply
#13

Another great release!
Reply
#14

Quote:
Originally Posted by iLearner
Посмотреть сообщение
You can't attach a textdraw nor progress bar to an object either.
In the above quote you're talking about a label, so I guess you mean a 3D Textlabel or whatever, that's why I said its maybe possible to attach it on an object (I thought it works but it doesn't) but I'm suggesting a progressbar to appear on the screen, not to attach it on an object (I know it's not possible)..
Reply
#15

Very similar to how I made mine. Good job!
Reply
#16

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
TextDraw is HUD element visible on player screen. Not possible to attach to object, also is not possible to attach 3DText to object.
I made 3D progress bar long time ago using MaterialText!
Reply
#17

Update v1.1.0:

- Blocking moving on water

- Fixed
PHP код:
Hunting::Destroy(mobid); //destroing moving area ??? 
- Fixed Z synchronization

- Added texture for dead animal

- Fixed forward angle for COW

- Fixed wall detection

- Added an escaped animal, the speed will be increased 10 times for 30 seconds after player shot

- Added functions:
PHP код:
Hunting::ToggleMoving(mobid,toggle);
Hunting::IsToggledMoving(mobid);
Hunting::Stop(mobid);
Hunting::GoTo(mobid,Float:x,Float:y,bool:area_check=true,bool:disable_moving=false);
Hunting::GetHealth(mobid);
Hunting::SetHealth(mobid,Float:health);
Hunting::GetSpawnHealth(mobid);
Hunting::SetSpawnHealth(mobid,Float:health);
Hunting::GetRespawnTime(mobid);
Hunting::SetRespawnTime(mobid,respawntime);
Hunting::IsValid(mobid);
Hunting::IsSpawned(mobid);
Hunting::IsDead(mobid);
Hunting::GetSpawn(mobid,&Float:x,&Float:y,&Float:z);
Hunting::SetSpawn(mobid,Float:x,Float:y,Float:z);
Hunting::GetInterior(mobid);
Hunting::SetInterior(mobid,interiorid);
Hunting::GetVirtualWorld(mobid);
Hunting::SetVirtualWorld(mobid,worldid);
Hunting::GetSpeed(mobid);
Hunting::SetSpeed(mobid,Float:speed); 
Reply
#18

Yeeeey! Thanks for the update.
Reply
#19

I see you getting better than before well done mate :*
Reply
#20

Amazing as always. Keep up the good work.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)