NPC doesent move? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: NPC doesent move? (
/showthread.php?tid=293151)
NPC doesent move? -
Everybody - 27.10.2011
pawn Код:
if(strcmp(cmdtext, "/mewantzpr0n", true)==0)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(!strcmp(name, "Rafael_Rodriguez", true) || !strcmp(name, "Pedro_Rodriguez", true))
{
ResetPlayerWeapons(npcid);
SetPlayerPos(playerid, 1204.2649,16.9675,1000.9219);
SetPlayerPos(npcid, 1202.7460,14.7477,1000.9219);
SetPlayerInterior(npcid, 2);
SetPlayerInterior(playerid, 2);
SetPlayerSkin(npcid, 256);
SendClientMessage(playerid, COLOR_WHITE, "Angelica_Winter says: So, handsome, want to do something?");
if(!strcmp(name, "Rafael_Rodriguez", true))
{
SetPlayerChatBubble(npcid,"Hey Rafael, want to have some fun?\nTell me what to do.",0xFFFFFFAA,50,5000);
barkeeperactivated = 1;
return 1;
}
else if(!strcmp(name, "Pedro_Rodriguez", true))
{
SetPlayerChatBubble(npcid,"Hey Pedro, want to have some fun?\nTell me what to do.",0xFFFFFFAA,50,5000);
barkeeperactivated = 1;
return 1;
}
}
return 1;
}
It all works fine, sets the player and the message appears that angelica says, but the NPC doesent get set to the correct position, i cant see it at all. Help? I set the interiors to the correct ones.
Re: NPC doesent move? -
[MWR]Blood - 27.10.2011
Use the actual NPC id.
Re: NPC doesent move? -
Everybody - 27.10.2011
it is defined, I am using the intelliNPC and its name is still michael

On top of OnPlayerCommandText:
pawn Код:
new npcid = GetPlayerID("Michael");
GetPlayerID function:
pawn Код:
stock GetPlayerID(const playername[], partofname=0)
{
new i;
new playername1[64];
for (i=0;i<MAX_PLAYERS;i++)
{
if (IsPlayerConnected(i))
{
GetPlayerName(i,playername1,sizeof(playername1));
if (strcmp(playername1,playername,true)==0)
{
return i;
}
}
}
new correctsigns_userid=-1;
new tmpuname[128];
new hasmultiple=-1;
if(partofname)
{
for (i=0;i<MAX_PLAYERS;i++)
{
if (IsPlayerConnected(i))
{
GetPlayerName(i,tmpuname,sizeof(tmpuname));
if(!strfind(tmpuname,playername1[partofname],true, 0))
{
hasmultiple++;
correctsigns_userid=i;
}
if (hasmultiple>0)
{
return -2;
}
}
}
}
return correctsigns_userid;
}