SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 24/10/2017, 03:33 AM   #1
PatrickGTR
Little Clucker
 
PatrickGTR's Avatar
 
Join Date: Sep 2010
Location: United Kingdom
Posts: 15
Reputation: 48
Default Creating a robbable actor!

Introduction
Inspired by GTA V store robbery. actor_robbery.inc imitates it! You basically aim at the actor and the actor will play 3 animation sequence, the actor will either give you the money or you will leave empty handed. The picture below explains it all.

Animation Sequence
  1. SHP_Rob_HandsUp
  2. SHP_Rob_GiveCash
  3. DUCK_cower

Functions
Code:
Function:
	CreateActorRobbery

Info:
	Creates the robbery actor according to the position set.

Param:
* skinid -> Skin ID of the robbery actor
* Float:x -> Coordinate X of the robbery actor
* Float:y -> Coordinate X of the robbery actor
* Float:z -> Coordinate X of the robbery actor
* Float:ang -> Facing angle of the robbery actor
* actor_vwid -> virtualid of the robbery actor
* r_moneymin -> Minimum money to be robbed from the robbery actor
* r_moneymax -> Maximum money to be robbed from the robbery actor
Code:
Function:
	GetActorRobberyData

Info:
	Retrieves the actor data

Param:
	* actorid -> ID of robbery actor you want to retrieve data from. 
	* &skinid -> Skin ID of the robbery actor
	* &Float:x -> Coordinate X of the robbery actor
	* &Float:y -> Coordinate X of the robbery actor
	* &Float:z -> Coordinate X of the robbery actor
	* &Float:ang -> Facing angle of the robbery actor
	* &actor_vwid -> virtualid of the robbery actor
	* &r_moneymin -> Minimum money to be robbed from the robbery actor
	* &r_moneymax -> Maximum money to be robbed from the robbery actor
Code:
Function: 
	GetActorFreeID

Info:	
	Retrieves the unused ID of an actor.

Param:
	None
Callbacks
Code:
//OnPlayerStartRobbery is called when the player aims at an actor.
forward OnPlayerStartRobbery(playerid, actorid, robbed_recently);

//OnPlayerFinishRobbery is called when the 3 animation sequence has been played.
forward OnPlayerFinishRobbery(playerid, actorid, robbedmoney, type);
EXAMPLE CODE
pawn Code:
public OnPlayerStartRobbery(playerid, actorid, robbed_recently)
{
    new string[128];
    if(robbed_recently)
    {
        format(string, sizeof(string), "ActorID: %i -> has been robbed recently, please try again later!");
        SendClientMessage(playerid, -1, string);
        return 0;
    }
    else
    {
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));

        format(string, sizeof(string), "Player %s(%i) has begun robbing actorid: %i", name, playerid, actorid);
        SendClientMessage(playerid, -1, string);
    }
    return 1;
}


public OnPlayerFinishRobbery(playerid, actorid, robbedmoney, type)
{
    new string[128];

    switch(type)
    {
        case TYPE_SUCCESS:
        {
            format(string, sizeof(string), "[ROBBERY SUCCESS]: You have manage to steal $%i from actorid: %i", robbedmoney, actorid);
            SendClientMessage(playerid, -1, string);

            format(string, sizeof(string), "~w~You stole~n~~g~$%i", robbedmoney);
            GameTextForPlayer(playerid, string, 6000, 1);  
        }
        case TYPE_FAILED:
        {
            SendClientMessage(playerid, -1, "[ROBBERY FAILED]: Cashier refused to give money!");
            GameTextForPlayer(playerid, "~r~Robbery Failed", 6000, 1);
        }
        case TYPE_UNFINISHED:
        {
            SendClientMessage(playerid, -1, "[ROBBERY FAILED]: You have gone too far away from the actor, he managed to call 911! RUN!");
            GameTextForPlayer(playerid, "~r~Robbery Failed", 6000, 1);
        }
    }
    SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 2);
    return 1;
}

Screenshots: Click Me!

Download: Click Me!
__________________

Last edited by PatrickGTR; 26/10/2017 at 12:13 PM.
PatrickGTR is offline   Reply With Quote
Old 24/10/2017, 03:40 AM   #2
Jelly23
Guest
 
Posts: n/a
Default Re: Creating a robbable actor!

Decent work.

+rep
  Reply With Quote
Old 24/10/2017, 05:45 AM   #3
oMa37
High-roller
 
oMa37's Avatar
 
Join Date: Feb 2016
Posts: 1,011
Reputation: 155
Default Re: Creating a robbable actor!

Well done.

+rep.
oMa37 is offline   Reply With Quote
Old 24/10/2017, 06:57 AM   #4
darkhunter332
Huge Clucker
 
darkhunter332's Avatar
 
Join Date: Aug 2013
Posts: 306
Reputation: 29
Default Re: Creating a robbable actor!

Nice work
darkhunter332 is offline   Reply With Quote
Old 24/10/2017, 07:23 AM   #5
FrezQ
Big Clucker
 
FrezQ's Avatar
 
Join Date: Dec 2016
Posts: 51
Reputation: 22
Default Re: Creating a robbable actor!

Good work mate!

Rep+
__________________


Free/Paid Gaming Servers
FrezQ is offline   Reply With Quote
Old 24/10/2017, 09:34 AM   #6
GamezCEO
Big Clucker
 
Join Date: Oct 2017
Posts: 77
Reputation: 37
Default Re: Creating a robbable actor!

Nice include, gonna use it right away.
GamezCEO is offline   Reply With Quote
Old 24/10/2017, 02:44 PM   #7
JustMe.77
Huge Clucker
 
JustMe.77's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 269
Reputation: 63
Default Re: Creating a robbable actor!

Simple idea - awesome release
JustMe.77 is offline   Reply With Quote
Old 24/10/2017, 11:29 PM   #8
Whyd
Huge Clucker
 
Whyd's Avatar
 
Join Date: Sep 2012
Location: /
Posts: 438
Reputation: 30
Default Re: Creating a robbable actor!

Very nice
Whyd is offline   Reply With Quote
Old 26/10/2017, 12:01 PM   #9
StrikerZ
High-roller
 
StrikerZ's Avatar
 
Join Date: Mar 2016
Location: India
Posts: 1,107
Reputation: 154
Default Re: Creating a robbable actor!

Looks pretty great.
__________________
StrikerZ is offline   Reply With Quote
Old 26/10/2017, 12:13 PM   #10
PatrickGTR
Little Clucker
 
PatrickGTR's Avatar
 
Join Date: Sep 2010
Location: United Kingdom
Posts: 15
Reputation: 48
Default Re: Creating a robbable actor!

Added example code!

pawn Code:
public OnPlayerStartRobbery(playerid, actorid, robbed_recently)
{
    new string[128];
    if(robbed_recently)
    {
        format(string, sizeof(string), "ActorID: %i -> has been robbed recently, please try again later!");
        SendClientMessage(playerid, -1, string);
        return 0;
    }
    else
    {
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));

        format(string, sizeof(string), "Player %s(%i) has begun robbing actorid: %i", name, playerid, actorid);
        SendClientMessage(playerid, -1, string);
    }
    return 1;
}


public OnPlayerFinishRobbery(playerid, actorid, robbedmoney, type)
{
    new string[128];

    switch(type)
    {
        case TYPE_SUCCESS:
        {
            format(string, sizeof(string), "[ROBBERY SUCCESS]: You have manage to steal $%i from actorid: %i", robbedmoney, actorid);
            SendClientMessage(playerid, -1, string);

            format(string, sizeof(string), "~w~You stole~n~~g~$%i", robbedmoney);
            GameTextForPlayer(playerid, string, 6000, 1);  
        }
        case TYPE_FAILED:
        {
            SendClientMessage(playerid, -1, "[ROBBERY FAILED]: Cashier refused to give money!");
            GameTextForPlayer(playerid, "~r~Robbery Failed", 6000, 1);
        }
        case TYPE_UNFINISHED:
        {
            SendClientMessage(playerid, -1, "[ROBBERY FAILED]: You have gone too far away from the actor, he managed to call 911! RUN!");
            GameTextForPlayer(playerid, "~r~Robbery Failed", 6000, 1);
        }
    }
    SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 2);
    return 1;
}


Thanks @all
__________________

Last edited by PatrickGTR; 27/10/2017 at 04:06 AM.
PatrickGTR 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
[FilterScript] Robbable Cash Registers rootcause Filterscripts 34 23/12/2017 10:11 AM
[FilterScript] Actor Studio - Creating Actors made easy! v1.0 Lynn Filterscripts 23 01/07/2016 05:44 PM
How to stop actor's animation after the Player stops targetting actor? humayunaftabkhan02 Scripting Help 0 05/05/2016 09:12 PM
[Tutorial] Robbable ATMs Vanter Tutorials 4 04/04/2016 05:55 PM
How to add buildings and how to make them robbable chrism11 Help Archive 1 23/10/2010 10:34 PM


All times are GMT. The time now is 06:15 PM.


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