NPC on OnPlayerRequestClass -
[DFE]Roy - 03.10.2009
Hello,
I want to make the bots on OnPlayerRequestClass but they are invisivle (not spawned). How can i do that bots for every time spawned?
Greets
Re: NPC on OnPlayerRequestClass -
Beaver07 - 03.10.2009
wat you trying to do ? make a bot in the OnPlayerRequestClass? or are you trying to spawn a bot?
if your trying to spawn a bot at the top of OnPlayerRequestClass then try
Код:
if (IsPlayerNPC(playerid))
{
return 1;
}
put that at the top of your public so bots can spawn past the class selection
Re: NPC on OnPlayerRequestClass -
[DFE]Roy - 03.10.2009
I try this on a filterscript:
Код:
public OnPlayerRequestClass(playerid, classid)
{
if(IsPlayerNPC(playerid)) {
StartRecordingPlayback(RECORDING_TYPE, RECORDING);
return 1;
}
But dont work...
Re: NPC on OnPlayerRequestClass -
FUNExtreme - 03.10.2009
Read the tutorial ....
Re: NPC on OnPlayerRequestClass -
[DFE]Roy - 03.10.2009
I did already... see:
Код:
#include <a_npc>
#define RECORDING "B0T"
#define RECORDING_TYPE 2
main()
{
}
public OnRecordingPlaybackEnd()
StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#if RECORDING_TYPE == 1
public OnNPCEnterVehicle(vehicleid, seatid)
StartRecordingPlayback(RECORDING_TYPE, RECORDING);
public OnNPCExitVehicle()
StopRecordingPlayback();
#else
public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
And the other filterscript:
Код:
#include <a_samp>
new MyFirstNPCVehicle;
public OnGameModeInit()
{
ConnectNPC("B0T", "B0T");
MyFirstNPCVehicle = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
return 1;
}
public OnPlayerSpawn(playerid)
{
if(!IsPlayerNPC(playerid)) return 0;
new NPCName[MAX_PLAYER_NAME];
GetPlayerName(playerid, NPCName, 64);
if(!strcmp(NPCName, "B0T", true)) {
SetPlayerInterior(playerid, 2);
PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0);
SetSpawnInfo( playerid, 0, 152, 1958.33, 1343.12, 15.36, 269.15, 31, 1000, 0, 0, 0, 0 );
}
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
if(IsPlayerNPC(playerid)) {
return 0;
}
return 1;
}
See? I dont need tutorials that i red more then 10x, I need some usefull help... -.-
Re: NPC on OnPlayerRequestClass -
allarw - 03.10.2009
public OnFilterScriptInit() and also
define RECORDING_TYPE 1 = IN VEHICLE
define RECORDING_TYPE 2 = ON FOOT
You have 2 i think that should be 1 because you are using car.
Re: NPC on OnPlayerRequestClass -
[DFE]Roy - 03.10.2009
No... i dont use a car, it is from the tutorial script, i use a NPC Bot on foot and it work but only not in Class selection...
Re: NPC on OnPlayerRequestClass -
Beaver07 - 03.10.2009
please explain wat you are trying to do exactly because reading the code you have put there it seems as if you want a bot to spawn then enter a vehicle but i can also see your using return 0; which would then stop the callback from actually happening so with the code you placed Players cannot spawn because it is return 0; and onplayerrequestclass is being stopped from calling if the player is an npc because of return 0; unless i'm looking at it wrong that could be the problem but i suggest if you are trying to create npcs in vehicles then re-read the tutorial it helped me create a bot within minutes
Re: NPC on OnPlayerRequestClass -
Jay_ - 03.10.2009
The bot can only follow instructions when it is spawned, not when it is choosing a skin.
Re: NPC on OnPlayerRequestClass -
[DFE]Roy - 03.10.2009
So forget the code over me: -.-
Код:
#include <a_samp>
public OnFilterScriptInit()
{
ConnectNPC("B0T", "B0T");
return 1;
}
public OnPlayerSpawn(playerid)
{
if(!IsPlayerNPC(playerid)) return 0;
new NPCName[MAX_PLAYER_NAME];
GetPlayerName(playerid, NPCName, 64);
if(!strcmp(NPCName, "B0T", true)) {
SetPlayerInterior(playerid, 2);
SetSpawnInfo( playerid, 0, 152, 1958.33, 1343.12, 15.36, 269.15, 31, 1000, 0, 0, 0, 0 );
}
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
if(IsPlayerNPC(playerid)) {
return 1;
}
Quote:
Originally Posted by Jay_
The bot can only follow instructions when it is spawned, not when it is choosing a skin.
|
It is spawned.
Quote:
Originally Posted by Beaver07
please explain wat you are trying to do
|
I want to make that everyone see the bot on the skin selection...
Quote:
Originally Posted by Beaver07
Players cannot spawn because it is return 0; and onplayerrequestclass is being stopped from calling
|
Can you correct it then please?
Re: NPC on OnPlayerRequestClass -
Sew_Sumi - 03.10.2009
You need to use the return 1, after the IsPlayerNPC so it doesn't get locked into the request.
The NPC cannot select a character.
Code:
{
if(IsPlayerNPC(playerid)) {
return 1;
}
return 1;
}
You need to read the NPC Tutorials and extras CAREFULLY.
The NPCs can ONLY drive/fly/walk/run on pre-recorded actions.
If you want your NPCs to stand idling at the skin selection screen doing something, then you need to record them doing so, and set them on a loop or something.
They cannot stand there selecting characters. Thats not part of the NPCs features.