Quantcast
Channel: SA-MP Forums - Filterscripts
Viewing all articles
Browse latest Browse all 595

[FilterScript] Hunting System

$
0
0
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::Respawn(mobid);
Hunting::Destroy(mobid);
Hunting::Kill(mobid,playerid);
Hunting::GetKey();
Hunting::SetKey(key);
Hunting::SetDrop(mobid,drop);
Hunting::GetDrop(mobid);
Hunting::GetPos(mobid,Float:x,Float:y,Float:z);
Hunting::Count(); 

Callbacks:
PHP Code:

OnPlayerTakeHuntDrop(playerid,mobid,drop);
OnPlayerKillHuntAnimal(playerid,mobid);
OnPlayerApproachingAnimal(playerid,mobid,mob_state);
OnAnimalTakeDamage(mobid,playerid,Float:amount,weaponid);
OnHuntAnimalRespawn(mobid); 

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

//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);
        
Hunting::SetDrop(mobid,0);
    }
    return 
1;
}

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 
OnAnimalTakeDamage(mobid,playerid,Float:amount,weaponid){
    
    if(
weaponid != 34) return 0//sniper only :D
    
    
return 1;
}

public 
OnHuntAnimalRespawn(mobid){
    
    return 
1;



Download:
Hunting.inc GitHub / Abyss Morgan Website
3DTryg.inc GitHub / Abyss Morgan Website 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

Viewing all articles
Browse latest Browse all 595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>