SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 28/09/2019, 02:47 PM   #1
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,213
Reputation: 352
Cool Faction Mini Missions

Hello, I would like to present you the Faction Mini Missions.

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

Example Code:
PHP Code:
public OnPlayerEnterPatrol(playerid,mobid){
    if(
GetPlayerTeam(playerid) == TEAM_POLICEMAN) return 1//policeman clear unsafe zone 
    
return 0//player get robbed
}

public 
OnPlayerDestroyPatrol(playerid,mobid){
    
//give mission prize
    
GivePlayerMoney(playerid,100);
    return 
1;
}

public 
OnPlayerRobbed(playerid,mobid,mission_state){
    switch(
mission_state){
        case 
MISSIONS_STATE_FAIL_ROBBERY: {
            
SendClientMessage(playerid,0xFFFFFFFF,"The thief stumbled and you managed to escape :)");
        }
        case 
MISSIONS_STATE_ROBBED: {
            
SendClientMessage(playerid,0xFFFFFFFF,"You lose $100 by robbers");
            
GivePlayerMoney(playerid,-100);
        }
    }
    return 
1;
}

public 
OnPlayerFoundCorpse(playerid,mobid){
    if(
GetPlayerTeam(playerid) == TEAM_MEDIC) return 1;
    return 
0//player able hit corpse (if in vehicle)
}

public 
OnPlayerHitCorpse(playerid,mobid){
    
SendClientMessage(playerid,0xFFFFFFFF,"You hit corpse by vehicle, you got mandate $100");
    
GivePlayerMoney(playerid,-100);
    return 
1;
}

public 
OnPlayerHealCorpse(playerid,mobid){
    if(
GetPlayerTeam(playerid) == TEAM_MEDIC){
        
SendClientMessage(playerid,0xFFFFFFFF,"You healed the corpse");
        return 
1;
    }
    return 
0;
}

public 
OnPlayerFoundScrap(playerid,mobid){
    if(
GetPlayerTeam(playerid) == TEAM_METAL_SCRAPPER) return 1//player able to pickup Scrap (Only for vehicle 578)
    
return 0;
}

public 
OnPlayerTakeScrap(playerid,mobid,mission_state,count_items){
    switch(
mission_state){
        case 
MISSIONS_SCRAP_FULL: {
            
SendClientMessage(playerid,0xFFFFFFFF,"Your vehicle cargo is full");
        }
        case 
MISSIONS_SCRAP_LOADED: {
            
SendClientMessage(playerid,0xFFFFFFFF,"You picked up scrap metal");
        }
    }
    return 
1;
}

public 
OnPlayerExceededSpeed(playerid,mobid,Float:speed,Float:max_speed){
    new 
buffer[256];
    
format(buffer,sizeof(buffer),"You exceeded the maximum speed %.1f mph you were driving %.1f mph",max_speed,speed);
    
SendClientMessage(playerid,0xFFFFFFFF,buffer);
    
//mandate or something :D
    
return 1;
}

public 
OnPlayerPutOutFire(playerid,mobid){
    
SendClientMessage(playerid,0xFFFFFFFF,"You put out fire");
    return 
1;
}

public 
OnPlayerVehicleDamagedByRoad(playerid,mobid,old_health,new_health,veh_damage){

    return 
1;
}

public 
OnPlayerDestroyedTreeOnRoad(playerid,mobid){
    
SendClientMessage(playerid,0xFFFFFFFF,"You destroyed tree on road");
    return 
1;
}

public 
OnPlayerUnloadingScrap(playerid,count_items){
    if(
Item::InCircle(playerid,item_player,0.0,0.0,10.0)){
        
SendClientMessage(playerid,0xFFFFFFFF,"You unloading scrap");
        return 
1;
    }
    return 
0;
}

public 
OnPlayerTryDisarmBomb(playerid,mobid){
    if(
GetPlayerTeam(playerid) == TEAM_ARMY) return 1;
    return 
0;
}

public 
OnPlayerDisarmBomb(playerid,mobid,mission_state){
    switch(
mission_state){
        case 
MISSIONS_BOMB_DISARM_FAIL: {
            
SendClientMessage(playerid,0xFFFFFFFF,"Failed to disarm bomb !!!");
        }
        case 
MISSIONS_BOMB_DISARM_SUCCESS: {
            
SendClientMessage(playerid,0xFFFFFFFF,"Bomb disarmed");
        }
        case 
MISSIONS_BOMB_DISARM_TOO_LATE: {
            
SendClientMessage(playerid,0xFFFFFFFF,"Is too late to disarm bomb !!!");
        }
    }
    return 
1;
}

public 
OnPlayerFixedRoad(playerid,mobid){
    
SendClientMessage(playerid,0xFFFFFFFF,"Road fixed");
    return 
1;
}

public 
OnGameModeInit(){
    
    
Missions::SetMissionsScrapKey(KEY_YES);
    
Missions::SetMissionsCorpseKey(KEY_YES);
    
Missions::SetMissionsBombKey(KEY_YES);

    
Missions::Enable(MISSIONS_TYPE_BOMB);
    
Missions::Enable(MISSIONS_TYPE_WOOD);
    
Missions::Enable(MISSIONS_TYPE_SCRAP);
    
Missions::Enable(MISSIONS_TYPE_CORPSE);
    
Missions::Enable(MISSIONS_TYPE_DMGROUTE);
    
Missions::Enable(MISSIONS_TYPE_FIRE);
    
Missions::Enable(MISSIONS_TYPE_PATROL);
    
    
Missions::SetSpawnRectangle(MISSIONS_TYPE_BOMB,-3000.0,-3000.0,3000.0,3000.0);
    
Missions::SetSpawnRectangle(MISSIONS_TYPE_CORPSE,-3000.0,-3000.0,3000.0,3000.0);
    
Missions::SetSpawnRectangle(MISSIONS_TYPE_FIRE,-3000.0,-3000.0,3000.0,3000.0);
    
Missions::SetSpawnRectangle(MISSIONS_TYPE_WOOD,-3000.0,-3000.0,3000.0,3000.0);
    
Missions::SetSpawnRectangle(MISSIONS_TYPE_SCRAP,-3000.0,-3000.0,3000.0,3000.0);
    
Missions::SetSpawnRectangle(MISSIONS_TYPE_DMGROUTE,-3000.0,-3000.0,3000.0,3000.0);
    
Missions::SetSpawnRectangle(MISSIONS_TYPE_PATROL,-3000.0,-3000.0,3000.0,3000.0);
    
    
Missions::Generate(); //force mission generate after server restart
    
    
return 1;
}

CMD:speedcamera_del(playerid,params[]){
    if(
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFFFFFFF,"Leave vehicle");
    new 
mobid;
    if(
sscanf(params,"d",mobid)) return SendClientMessage(playerid,0xFFFFFFFF,"Usage /speedcamera_del <id>");
    if(
mobid || mobid >= MISSIONS_MAX_RADAR) return SendClientMessage(playerid,0xFFFFFFFF,"Wrong speed camera ID (0 - 99)");
    if(!
Missions::RadarData[mobid][f_active]) return SendClientMessage(playerid,0xFFFFFFFF,"Speed camera is not active");
    
Missions::DestroyRadar(mobid);
    
SendClientMessage(playerid,0xFFFFFFFF,"Speed camera deleted");
    return 
1;
}

CMD:speedcamera_add(playerid,params[]){
    if(
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFFFFFFF,"Leave vehicle");
    new 
Float:speed;
    if(
sscanf(params,"f",speed)) return SendClientMessage(playerid,0xFFFFFFFF,"Używaj /speedcamera_add <max_speed>");
    new 
Float:x,Float:y,Float:z,Float:z_angle;
    
GetPlayerPos(playerid,x,y,z);
    
GetPointInFrontOfPlayer(playerid,x,y,1.0);
    
GetPlayerFacingAngle(playerid,z_angle);
    if(
Missions::CreateRadar(x,y,z,z_angle,0,0,speed)){
        
SendClientMessage(playerid,0xFFFFFFFF,"Speed camera added");
        
ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.1,0,0,0,0,0);
    } else {
        
SendClientMessage(playerid,0xFFFFFFFF,"Unable to add speed camera (limit exceeded)");
    }
    return 
1;

Functions:
PHP Code:
Missions::SetMissionsScrapKey(key);
Missions::SetMissionsCorpseKey(key);
Missions::SetMissionsBombKey(key);
Missions::CountVehicleScrap(vehicleid);
Missions::DropScrap(vehicleid);
Missions::HealCorpse(playerid);
Missions::CreateRadar(Float:x,Float:y,Float:z,Float:rz,worldid=0,interiorid=0,Float:speed=80.0);
Missions::DestroyRadar(mobid);
Missions::SetSpawnRectangle(mission_type,Float:minx,Float:miny,Float:maxx,Float:maxy,bool:spawn_validation=true);
Missions::SetSpawnPolygon(mission_type,Float:points[],maxpoints=sizeof(points),bool:spawn_validation=true); 
Download:
Missions.inc
route_rand.inc
route_rand.bin (put in /scriptfiles)
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

Last edited by AbyssMorgan; 11/10/2019 at 03:21 PM. Reason: Update v1.1.0
AbyssMorgan is offline   Reply With Quote
Old 28/09/2019, 05:48 PM   #2
josh
Little Clucker
 
Join Date: Jul 2019
Posts: 29
Reputation: 0
Default Re: Faction Mini Missions

good job!
josh is offline   Reply With Quote
Old 30/09/2019, 10:44 AM   #3
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 536
Reputation: 18
Default Re: Faction Mini Missions

Great script as always. Good job.
__________________


Discord | Play Now | Website

Add your server to favourites and join our Discord.
Symon is offline   Reply With Quote
Old 30/09/2019, 10:49 AM   #4
Bolex_
Gangsta
 
Bolex_'s Avatar
 
Join Date: Aug 2015
Location: Croatia.
Posts: 591
Reputation: 117
Default Re: Faction Mini Missions

Abyss is back.
Bolex_ is offline   Reply With Quote
Old 05/10/2019, 03:20 AM   #5
Uberanwar
Gangsta
 
Uberanwar's Avatar
 
Join Date: May 2012
Location: Malaysia
Posts: 855
Reputation: 62
Default Re: Faction Mini Missions

Great script. It would be cool if there is an option where to generate the missions, such as at LS map only, considering the fact that most servers dont use whole map for their gameplay. Also another suggestion, add a function whereby if a mission is generated, it will inform players of the mission
Uberanwar is offline   Reply With Quote
Old 05/10/2019, 07:44 AM   #6
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,213
Reputation: 352
Default Re: Faction Mini Missions

Quote:
Originally Posted by Uberanwar View Post
Great script. It would be cool if there is an option where to generate the missions, such as at LS map only, considering the fact that most servers dont use whole map for their gameplay. Also another suggestion, add a function whereby if a mission is generated, it will inform players of the mission
I can do it soon, i have a lot projects now


Join my Discord to stay up to date:
https://discord.gg/SydWwbs
AbyssMorgan is offline   Reply With Quote
Old 06/10/2019, 08:19 AM   #7
SiaReyes
Huge Clucker
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 323
Reputation: 22
Default Re: Faction Mini Missions

Awsome good job!
__________________
Offshowtime Fuck It!

Quote:
Originally Posted by Toroi View Post
blackmail people that join your server using their ip address as hostage

or get a job and play sa-mp for fun
SiaReyes is offline   Reply With Quote
Old 06/10/2019, 08:42 AM   #8
Proxus
Huge Clucker
 
Proxus's Avatar
 
Join Date: May 2018
Location: United Kingdom
Posts: 325
Reputation: 13
Default Re: Faction Mini Missions

Looks good, keep it up!
__________________
Developer @ Trucknation
Administrator & Developer @ Lost Legacy
"Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity"


IMPORTANT LINKS
Proxus is offline   Reply With Quote
Old 11/10/2019, 03:22 PM   #9
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,213
Reputation: 352
Default Re: Faction Mini Missions

Update v1.1.0:

- Added functions:
PHP Code:
//return 0 if is failed spawn_validation (MISSIONS_TYPE_WOOD, MISSIONS_TYPE_DMGROUTE, MISSIONS_TYPE_PATROL, MISSIONS_TYPE_SCRAP)
//disabling verification may cause the server to freeze if no spawn is in the zone
Missions::SetSpawnRectangle(mission_type,Float:minx,Float:miny,Float:maxx,Float:maxy,bool:spawn_validation=true);
Missions::SetSpawnPolygon(mission_type,Float:points[],maxpoints=sizeof(points),bool:spawn_validation=true); 
- Disabled force Missions::Generate(); on Missions::Init(); missions can respawn only 15 after server start or you can call Missions::Generate(); after you change Spawn areas

- Fixed some MISSION_ to MISSIONS_ definitions

- Example code updated
AbyssMorgan is offline   Reply With Quote
Old 12/10/2019, 04:14 AM   #10
Uberanwar
Gangsta
 
Uberanwar's Avatar
 
Join Date: May 2012
Location: Malaysia
Posts: 855
Reputation: 62
Default Re: Faction Mini Missions

Is there a way I can put a limit if theres way too many woods/dmgroute spawned? Like max 10 every time when timer is executed
Uberanwar 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
[GameMode] Mini Missions R1 freshOrange Gamemode Scripts 17 01/01/2014 12:12 PM
[FilterScript] [FS] Mini-Missions 111vovan111 Filterscripts 7 07/10/2011 09:44 PM
[GameMode] [Mini-Missions] BASITJALIL Gamemode Scripts 15 16/03/2011 06:14 PM
Mini Missions Nameless303 Help Archive 15 07/11/2009 11:25 AM


All times are GMT. The time now is 03:30 AM.


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