SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 21/08/2017, 04:21 PM   #1
AbyssMorgan
High-roller
 
AbyssMorgan's Avatar
 
Join Date: Apr 2015
Location: Poland
Posts: 1,196
Reputation: 302
Cool Hunting System

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 <SAM/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 Thread

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

Last edited by AbyssMorgan; 10/09/2017 at 09:10 PM. Reason: Update v1.3.0
AbyssMorgan is online now   Reply With Quote
Old 21/08/2017, 04:35 PM   #2
iLearner
Banned
 
Join Date: Apr 2017
Posts: 449
Reputation: 89
Default Re: Hunting System

Thank you! It was a personal request from my side.
You completed within 24h!
iLearner is offline   Reply With Quote
Old 21/08/2017, 04:47 PM   #3
Eoussama
Gangsta
 
Eoussama's Avatar
 
Join Date: Jul 2016
Location: Kingdom of Morocco // Tangier
Posts: 926
Reputation: 124
Default Re: Hunting System

Cool release, I picked up a trick or two from the code while reviewing it, gj
__________________
Eoussama is offline   Reply With Quote
Old 21/08/2017, 04:51 PM   #4
IlanZ
High-roller
 
Join Date: Jul 2016
Location: Brasil
Posts: 1,160
Reputation: 59
Default Re: Hunting System

Nice system, congratulations.
__________________
IlanZ is offline   Reply With Quote
Old 21/08/2017, 07:02 PM   #5
cuber
Huge Clucker
 
Join Date: Oct 2016
Posts: 293
Reputation: 32
Default Re: Hunting System

Looks nice.
__________________

www.continuousrp.com | server.continuousrp.com:11285 | ts.continuousrp.com:10201 | continuousrp.com/discord
you can click on the images to get redirected..
cuber is online now   Reply With Quote
Old 21/08/2017, 07:13 PM   #6
FuNkYTheGreat
Huge Clucker
 
FuNkYTheGreat's Avatar
 
Join Date: Jun 2016
Location: Pakistan.
Posts: 226
Reputation: 79
Default Re: Hunting System

That's very nicely done, and its just GREAT with an include, and the zone moving is just dope,
Great Work, once again
FuNkYTheGreat is offline   Reply With Quote
Old 21/08/2017, 07:29 PM   #7
Astralis
High-roller
 
Join Date: Sep 2009
Location: France
Posts: 3,000
Reputation: 374
Default Re: Hunting System

Funny cows, good job.
__________________
Astralis is offline   Reply With Quote
Old 21/08/2017, 11:52 PM   #8
JustMe.77
Huge Clucker
 
JustMe.77's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 267
Reputation: 60
Default Re: Hunting System

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.
JustMe.77 is offline   Reply With Quote
Old 21/08/2017, 11:59 PM   #9
iLearner
Banned
 
Join Date: Apr 2017
Posts: 449
Reputation: 89
Default Re: Hunting System

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.
iLearner is offline   Reply With Quote
Old 22/08/2017, 12:21 AM   #10
Barnwell
Gangsta
 
Barnwell's Avatar
 
Join Date: May 2014
Location: England
Posts: 535
Reputation: 23
Default Re: Hunting System

Pretty good!
Barnwell is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hunting system (deers) Unrea1 Screenshots and Videos 8 18/02/2017 11:23 PM
[FIRST HUNTING SYSTEM] by Fexurious Fexurious Screenshots and Videos 6 13/04/2014 10:56 AM
Hunting system. Closer14 Screenshots and Videos 0 26/06/2013 11:53 AM
Job Hunting Harold Everything and Nothing 4 21/11/2009 11:55 PM


All times are GMT. The time now is 04:53 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.