PDA

Просмотр полной версии : [Include] Controllable NPC



Salvacore
13.04.2014, 17:32
http://i.imgur.com/1Zl9g.png

native CreateCNPC(name[24], skin, Float: X, Float: Y, Float: Z)
native SetNpcMoveTo(nID, Float: X, Float: Y, Float: Z, bool: run = false)
native GetNPCPlayerID(nID)
native GetDistanceBetweenPlayerAndNPC(playerid, nID)
native GetClosestNPC(playerid)
native GetNpcIDFromPlayerID(playerid)
native StopCNPC(npcid)
native GetCNPCTotalCount()
native ReturnNpcName(npcid)
native SetNPCPos(npcid, Float: X, Float: Y, Float: Z)
native ApplyAnimationToNPC(npcid, animlib[], animname[], Float: fDelta, loop, lockx, locky, freeze, time, forcesync = 0)
native SetNPCFacingAngle(npcid, Float: Angle)
native GiveNPCWeapon(npcid, weaponid, ammo)
native ResetNPCWeapons(npcid)
native SetPlayerFacePoint(playerid, Float: fX, Float: fY, Float: offset = 0.0)
native strmatch(const str1[], const str2[])
native strreplacechar(string[], oldchar, newchar)

#include <a_samp>
#include <a_cnpc>
#include <zcmd>

/* ** NPC DATA ** */
new
Npc: PornhubUser,
szTmpstring [128] // I'm being a bit careless about strings now. Haha.
;

main(){}
public OnGameModeInit()
{
SetGameModeText("CNPC 0.1a");
AddPlayerClass(0, 0.0, 0.0, 5.0, 270.0, 0, 0, 0, 0, 0, 0);
CreateCNPC("Jackie", 119, 5, 0, 5);
CreateCNPC("Troll", 289, 0, 5, 5);
PornhubUser = CreateCNPC("Porn Hub User", 5, 5, 5, 5);
CreateCNPC("Porn Hub User", 5, 5, 5, 5);
CreateCNPC("Porn Hub User", 5, 5, 5, 5);
return 1;
}

public OnGameModeExit() return 1;

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}

public OnNpcCreated(npcid)
{
printf("%s(%d) created!", ReturnNpcName(npcid), npcid);
return 1;
}

public OnNpcConnected(npcid)
{
printf("%s(%d) connected!", ReturnNpcName(npcid), npcid);
return 1;
}

public OnNpcFinishedMoving(npcid)
{
printf("%s(%d) finished moving!", ReturnNpcName(npcid), npcid);
return 1;
}

public OnNpcDestroyed(npcid)
{
printf("%s(%d) destroyed!", ReturnNpcName(npcid), npcid);
return 1;
}

CMD:closest(playerid, params[])
{
new Npc: nTmp = GetClosestNPC(playerid);
format(szTmpstring, 128, "Closest: %d", _: nTmp);
SendClientMessage(playerid, -1, szTmpstring);
return 1;
}

CMD:distance(playerid, params[])
{
if(!IsNPCConnected(strval(params))) return 0;
new Float: fTmp = GetDistanceBetweenPlayerAndNPC(playerid, Npc:strval(params));
format(szTmpstring, 128, "Distance: %f", fTmp);
SendClientMessage(playerid, -1, szTmpstring);
return 1;
}

CMD:walk(playerid, params[])
{
new Float: X, Float: Y, Float: Z;
GetPlayerPos(playerid, X, Y,Z);
SetNpcMoveTo(PornhubUser, X, Y, Z, false);
return 1;
}

CMD:run(playerid, params[])
{
new Float: X, Float: Y, Float: Z;
GetPlayerPos(playerid, X, Y,Z);
SetNpcMoveTo(PornhubUser, X, Y, Z, true);
return 1;
}

CMD:runall(playerid, params[])
{
new Float: X, Float: Y, Float: Z;
GetPlayerPos(playerid, X, Y,Z);
foreachcnpc(i)
{
SetNpcMoveTo(i, X, Y, Z, true);
}
return 1;
}
http://img705.imageshack.us/img705/8594/ownageuf.png
Скачать: ТЫК (http://pastebin.com/uw9KDv5G)
Автор: Lorenc_

Spectrum
14.04.2014, 13:52
и в чём их преимущество перед обычными?

DeimoS
14.04.2014, 14:51
О_о это не тот ли плагин, что раньше продавали за хорошие деньги?

Spectrum
14.04.2014, 15:05
О_о это не тот ли плагин, что раньше продавали за хорошие деньги?

неа, это простой инклуд

OKStyle
15.04.2014, 16:13
Который почему-то использует уже занятое название.

Exclusive
16.04.2014, 16:45
Хм, прикольно. Надо испытать)

Spectrum
16.04.2014, 18:48
Хм, прикольно. Надо испытать)

http://risovach.ru/upload/2013/03/generator/toni-stark_14455129_small_.jpeg