Creating a robbable actor! -
PatrickGTR - 24.10.2017
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- SHP_Rob_HandsUp
- SHP_Rob_GiveCash
- DUCK_cower
Functions
Код:
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
Код:
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
Код:
Function:
GetActorFreeID
Info:
Retrieves the unused ID of an actor.
Param:
None
Callbacks
Код:
//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 Код:
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!
Re: Creating a robbable actor! - Jelly23 - 24.10.2017
Decent work.
+rep
Re: Creating a robbable actor! -
oMa37 - 24.10.2017
Well done.
+rep.
Re: Creating a robbable actor! -
darkhunter332 - 24.10.2017
Nice work
Re: Creating a robbable actor! -
FrezQ - 24.10.2017
Good work mate!
Rep+
Re: Creating a robbable actor! -
GamezCEO - 24.10.2017
Nice include, gonna use it right away.
Re: Creating a robbable actor! -
Whyd - 24.10.2017
Very nice
Re: Creating a robbable actor! -
StrikerZ - 26.10.2017
Looks pretty great.
Re: Creating a robbable actor! -
PatrickGTR - 26.10.2017
Added example code!
pawn Код:
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
Re: Creating a robbable actor! -
Arbico - 28.10.2017
Nice mate!
Re: Creating a robbable actor! -
Deadpoop - 28.10.2017
good job