SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 24/04/2018, 02:36 PM   #1
nguyendinhdat
Little Clucker
 
Join Date: Apr 2017
Location: Viet Nam , City Da Nang
Posts: 10
Reputation: 0
Default How will the player attack the NPC to be attacked by the NPC?

Code :

#include <a_samp>

public OnFilterScriptInit()
{
print("\n-----------------------------------");
print(" NPC policijski botovi | StjepanS");
print("------------------------------------\n");
return 1;
}

public OnGameModeInit()
{
ConnectNPC("StjepanSBot","npcstjepans");
ConnectNPC("StjepanSBot1","npcstjepans1");
return 1;
}

public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid)) // Provjerava da li se spawnao NPC.
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname)); // Dobivanje imena NPCa
if(!strcmp(npcname, "StjepanSBot", true))
{
SetPlayerColor(playerid, 0xFFFFFFAA);// Stavlja bijelu boju NPCu.
SetPlayerSkin(playerid, 281);// Stavlja skin NPCu id 281
SetPlayerAttachedObject(playerid,0,19142,1,0.04930 0,0.035000,-0.003500,0.000000,0.000000,0.000000,1.100000,1.100 000,1.100000);// Postavlja NPCu objekt pancirke
}
if(!strcmp(npcname, "StjepanSBot1", true))
{
SetPlayerColor(playerid, 0xFFFFFFAA);// Stavlja bijelu boju NPCu.
SetPlayerSkin(playerid, 280);// Stavlja skin NPCu id 280
SetPlayerAttachedObject(playerid,0,19142,1,0.04930 0,0.035000,-0.003500,0.000000,0.000000,0.000000,1.100000,1.100 000,1.100000);// Postavlja NPCu objekt pancirke
}
}
return 1;
}
nguyendinhdat is offline   Reply With Quote
Old 26/04/2018, 09:16 AM   #2
Neutralneu
Big Clucker
 
Join Date: Oct 2012
Location: Russia
Posts: 70
Reputation: 41
Default Re: How will the player attack the NPC to be attacked by the NPC?

If you wish to make an NPC attack you in return then you should use FCNPC plugin which allows you to do almost everything with NPC and making complex artificial intelligence for it.
Neutralneu is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Attack Material Object to player s0ZNIz Scripting Help 2 26/01/2015 12:22 AM
NPC Attack Player [REP +1] Thresholdold Scripting Help 4 08/12/2011 10:17 AM
[Question] Check player attack? godknightx Help Archive 1 05/10/2009 04:20 PM


All times are GMT. The time now is 06:41 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.