[CAMPANIE STAFF]Cautam moderatori si designeri activi!
Welcome to WTFCS Community Forums!
Servere gaming la super-preturi! [HOSTING SERVICE]
-->






[Tutorial] Cum faci un NPC sa execute un ANIM + ChatBubble
Author : SaTaNa99, Category : Tutoriale, 0 Replyes, 1163 Views
EVALUATE THIS TOPIC
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
1 Guest(s)
fondator rsp.wtfcs.com
 
421
POSTS
150
THREADS
0
REPUTATION
Male
Sex

WtfCs Coins: -0.01[w]
01-09-2014, 11:25 AM
#1
Acest tutorial este pentru cei care se pricep cat de cat in pawno, daca nu aveti cunostinte suficiente nu urmariti acest tutorial.



Pentru inceput trebuie sa vedem daca NPC-ul este langa player




forward GetClosestNPC(p1);
public GetClosestNPC(p1)
{
new x,Float:dis,Float:dis2,player;
player = -1;
dis = 99999.99;
for (x=0;x<MAX_PLAYERS;x++)
{
if(IsPlayerNPC(x))
{
if(x != p1)
{
dis2 = GetDistanceBetweenPlayers(x,p1);
if(dis2 < dis && dis2 != -1.00)
{
dis = dis2;
player = x;
}
}
}
}
return player;
}



Sa zicem ca vrei sa pui un NPC la bariera Los Santos Department, iar cand un player va deschide bariera, NPC-ul sa execute o animatie + un text (ChatBubble, pentru cunoscatori)



Simplu


if(newkeys==KEY_CROUCH)
{
new bot = GetClosestNPC(playerid); // Aceasta este importanta
if(IsPlayerInAnyVehicle(playerid))
{
if((IsACop(playerid)) && PlayerToPoint(15.0, playerid, 1588.2966,-1637.8121,13.4255))
{
MoveObject(PDGATE,1597.846802, -1638.088257, 14.655367,1);
SetTimer("PDGATECLOSE", 10000, false);
}
if((IsACop(playerid)) && PlayerToPoint(15.0, playerid,1541.8696,-1628.0836,13.3828))
{
SetObjectRot(barrier, 0, 0, 270);
SetTimer("outbarrier", 6000, false);
SetPlayerChatBubble(bot,"I opened the barrier for you Officer! Have a nice day!",COLOR_WHITE,35.0,5000); // textul care sa i se afiseze npc-ului deasupra capului
ApplyAnimation(bot, "BAR","Barserve_bottle", 4.0, 0, 0, 0, 0, 0, 1); // aici puneti animatia dorita pt bot
}
Regulament forum: You are not allowed to view links. Register or Login to view.

You are not allowed to view links. Register or Login to view.

You are not allowed to view links. Register or Login to view.


Forum Jump: