24.10.2017, 02:33
(
Последний раз редактировалось PatrickGTR; 26.10.2017 в 11:13.
)
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
Callbacks
EXAMPLE CODE
Screenshots: Click Me!
Download: Click Me!
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
Код:
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
Код:
//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);
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;
}
Download: Click Me!