07.02.2015, 13:57
Hello, i've created NPCs 3 in Cityhalls (LS, LV, SF) according to player's virtual world.
LS Interior Virtual World = 186
LV Interior Virtual World = 185
SF Interior Virtual World = 187
when i press MMB near bot it only work for 1 bot [BOT]Jack Spawned in LS CityHall Interior.
even i press MMB in LV Cityhall it shows me [BOT]Jack work.
please help me...
my code.
OnGameModeInt
Under OnPlayerSpawn
OnPlayerKeyState
setplayerposex
LS Interior Virtual World = 186
LV Interior Virtual World = 185
SF Interior Virtual World = 187
when i press MMB near bot it only work for 1 bot [BOT]Jack Spawned in LS CityHall Interior.
even i press MMB in LV Cityhall it shows me [BOT]Jack work.
please help me...
my code.
OnGameModeInt
pawn Код:
ConnectNPC("[BOT]Jack","npcidle");
ConnectNPC("[BOT]Aaron","npcidle");
ConnectNPC("[BOT]Joshua","npcidle");
pawn Код:
if (IsPlayerNPC(playerid))
{
if (!strcmp(PlayerInfo[playerid][pName],"[BOT]Jack",true))
{
SetPlayerPosEx(playerid,359.713867, 173.678939, 1008.389343, 269.782714, 3, 187);
SetPlayerColor(playerid,COLOR_WANTED_LEVEL_0);
format(string, sizeof(string), "City Hall In Temple");
strmid(PlayerInfo[playerid][pLocation], string, 0, strlen(string), 256);
new Text3D:Jack = Create3DTextLabel("[BOT]Jack", 0xFFFFFFFF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(Jack, playerid, 0.0, 0.0, 0.0);
}
if (!strcmp(PlayerInfo[playerid][pName],"[BOT]Aaron",true))
{
SetPlayerPosEx(playerid,359.713867, 173.678939, 1008.389343, 269.782714, 3, 185);
SetPlayerColor(playerid,COLOR_WANTED_LEVEL_0);
format(string, sizeof(string), "City Hall In South East Las Venturas");
strmid(PlayerInfo[playerid][pLocation], string, 0, strlen(string), 256);
new Text3D:Aaron = Create3DTextLabel("[BOT]Aaron", 0xFFFFFFFF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(Aaron, playerid, 0.0, 0.0, 0.0);
}
if (!strcmp(PlayerInfo[playerid][pName],"[BOT]Joshua",true))
{
SetPlayerPosEx(playerid,359.713867, 173.678939, 1008.389343, 269.782714, 3, 186);
SetPlayerColor(playerid,COLOR_WANTED_LEVEL_0);
format(string, sizeof(string), "City Hall In San Fierro");
strmid(PlayerInfo[playerid][pLocation], string, 0, strlen(string), 256);
new Text3D:Joshua = Create3DTextLabel("[BOT]Joshua", 0xFFFFFFFF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(Joshua, playerid, 0.0, 0.0, 0.0);
}
}
pawn Код:
if (newkeys & KEY_LOOK_BEHIND || newkeys & KEY_SUBMISSION)
{
new npcid = -1, PlayerCount;
for (new i = 0; i < GetMaxPlayers(); i++)
{
if (IsPlayerConnected(i) && i != playerid && PlayerInfo[playerid][pDead] == 0 && GetDistanceBetweenPlayers(playerid,i) < 10)
{
if (IsPlayerNPC(i))
{
PlayerCount ++;
if (PlayerCount > 0) npcid = i; break;
}
}
}
if (npcid > -1)
{
if (!strcmp(PlayerInfo[npcid][pName],"[BOT]Jack",true) || !strcmp(PlayerInfo[npcid][pName],"[BOT]Aaron",true) || !strcmp(PlayerInfo[npcid][pName],"[BOT]Joshua",true))
{
new string[256];
format(string, sizeof(string), "Hello, IM %s",PlayerInfo[npcid][pName]);
SendClientMessage(playerid, -1, string);
}
}
}
pawn Код:
stock SetPlayerPosEx(playerid,Float:x,Float:y,Float:z,Float:angle,interior,world)
{
SetPlayerPos(playerid,x,y,z);
SetPlayerFacingAngle(playerid,angle);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid,interior);
SetPlayerVirtualWorld(playerid,world);
return 1;
}