12.09.2009, 22:56
Hi there,
I'm having some problems with NPCs. I've followed kc's tutorial but my bots won't connect to my server!
Here take a look at some of my script.
npcmodes script:
parts involving NPCs in my Gamemode:
So this is the code involving NPCs I wrote. When I open my server, it freezes when ConnectNPC is called and it unfreezes few seconds later, and the GM finishes loading, without any NPC connecting.
Please, help mehhhh!!!
TANHKS!! lol
I'm having some problems with NPCs. I've followed kc's tutorial but my bots won't connect to my server!
Here take a look at some of my script.
npcmodes script:
Код:
#include <a_npc> new NPCVAR; main() { print("NPC: ''airport-cityhall'' - Script Initializing."); } public OnNPCModeInit() { print("NPC: ''airport-cityhall'' - Script has been loaded."); return 1; } public OnNPCModeExit() { print("NPC: ''airport-cityhall'' - Script has been unloaded."); return 1; } public OnNPCSpawn() { print("NPC: ''airport-cityhall'' - Spawned."); SendCommand("/ooc Hello everyone! I'm a bot! Have fun :P"); return 1; } public OnRecordingPlaybackEnd() { if(NPCVAR==0) { StopRecordingPlayback(); StartRecordingPlayback(1, "airport2cityhall"); NPCVAR++; return 1; } if(NPCVAR==1) { StopRecordingPlayback(); StartRecordingPlayback(1,"cityhall2airport"); NPCVAR--; return 1; } return 1; } public OnNPCEnterVehicle(vehicleid, seatid) { StopRecordingPlayback(); StartRecordingPlayback(1, "cityhall2airport"); return 1; }
Код:
// this is under #include a_samp new npc1car; #define npc1name "Paul_Ference"
Код:
// this part is in OnGameModeInit ConnectNPC(npc1name,"airport-cityhall"); npc1car=CreateVehicleEx(420,-2196.8511,965.4650,79.7805,269.1402,6,1,1800,npc1name,0); // Taxi // function of my custom vehicle system. last two parameters are: ownername and price
Код:
// part of OnPlayerSpawn if(IsPlayerNPC(playerid)) { new npcname[24]; GetPlayerName(playerid, npcname, 24); if(!strcmp(npcname, npc1name, true)) { SetPlayerPos(playerid,-2196.8511,965.4650,79.7805); PutPlayerInVehicle(playerid, npc1car, 0); //Putting the NPC into the vehicle we created for it. } return 1; }
Please, help mehhhh!!!
TANHKS!! lol