forward RobCluckin(playerid);
public RobCluckin(playerid)
{
new rand = random(5000)+0;
GivePlayerMoney(playerid,rand);
new pname[MAX_PLAYER_NAME], string[80 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), ""COLOR_RED"[ROBBERY] %s has robbed Cluckin Bell (Downtown) and received %i.", pname, rand);
SendClientMessageToAll(-1, string);
return 1;
}
public OnGameModeInit()
{
ConnectNPC("CluckinBOT","Cluckin");
CreatePickup(1318, 1, -1816.5437,618.0901,35.1719, 0);
CreatePickup(1318, 1, 364.8150,-11.6074,1001.8516, 9);
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SECONDARY_ATTACK)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, -1816.5437,618.0901,35.1719))
{
SetPlayerPos(playerid, 364.8150,-11.6074,1001.8516);
SetPlayerInterior(playerid, 9);
}
else if(IsPlayerInRangeOfPoint(playerid, 3.0, 364.8150,-11.6074,1001.8516))
{
SetPlayerPos(playerid, -1816.5437,618.0901,35.1719);
SetPlayerInterior(playerid, 0);
}
}
if(PRESSED(KEY_HANDBRAKE))
{
new wid = GetPlayerWeapon(playerid);
if(wid > 10)
{
new NPCID = GetPlayerIDFromName("CluckinBOT");
if(IsPlayerFacingPlayer(playerid,NPCID,10) == 1)
{
ApplyAnimation(NPCID,"ped","handsup",3.0,0,0,0,1,0);
SendClientMessage(playerid, -1, ""COLOR_YELLOW"[WANTED LEVEL] {FFFFFF}Your wanted level is increased by four. (Robbing Cluckin Bell)");
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+4);
SetTimerEx("RobCluckin", 25000, false, "i", playerid);
SetTimerEx("After1", 50000, false, "i", playerid);
}
}
}
return 1;
}
Use actors for such purposes instead of NPCs, and there are some includes that provide you with callbacks such as "OnPlayerAimActor(playerid, actorid)".
|