NPC. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: NPC. (
/showthread.php?tid=216831)
NPC. -
Gh0sT_ - 26.01.2011
Why NPC logs out after 5sec when I turn on server?
OnPlayerSpawn
pawn Код:
//==================================================== NPC
if( IsPlayerNPC( playerid ) )
{
new
Vardas[ 24 ]
;
GetPlayerName( playerid, Vardas, 24 );
if( !strcmp( Vardas, "AutobusoVairuotojas", true ) ) PutPlayerInVehicle( playerid, Autobusas, 0 );
if( !strcmp( Vardas, "Serifas", true ) ) SetPlayerInterior( playerid, 6 );
if( !strcmp( Vardas, "Mokytojas", true ) ) SetPlayerInterior( playerid, 3 );
if( !strcmp( Vardas, "Barmenas", true ) ) SetPlayerInterior( playerid, 18 );
if( !strcmp( Vardas, "Sekretore", true ) ) SetPlayerInterior( playerid, 3 );
}
//==================================================== another shit!
if( IsPlayerNPC( playerid ) ) return 1;
..
server.cfg
maxnpc 5
Added if( IsPlayerNPC( playerid ) ) return false; in all timers, callbacks. using only one fs - fsdebug, tryied to turn it off, but..
Please, help me
Re: NPC. -
Steven Paul - 26.01.2011
that is because something letting them out. Did you have password or something
Re: NPC. -
Sasino97 - 26.01.2011
Код:
if( !strcmp( Vardas, "Serifas", true ) ) SetPlayerInterior( playerid, 6 );
I think its wrong.
Try
Код:
if(strfind(Vardas, "Serifas",true) != -1) SetPlayerInterior(playerid, 6);
or
Код:
if(strcmp(Vardas, "Serifas",true) == 0) SetPlayerInterior(playerid, 6);
Re: NPC. -
Gh0sT_ - 26.01.2011
No, server isnt locked. Sasino, it can't be wrong, because all this script is from tut.
Re: NPC. -
Gh0sT_ - 27.01.2011
bump. ;<>
Re: NPC. -
Mean - 27.01.2011
If you have a register/login system, you need to bypass it for npcs,
pawn Код:
LoginCommand()
{
if(IsPlayerNPC(playerid))
{
CodeToByPass
}
return 1;
}
Re: NPC. -
Gh0sT_ - 27.01.2011
I sayd that checking is added, so I dont think that is bad -.-
pawn Код:
public OnPlayerConnect(playerid)
{
if( IsPlayerNPC( playerid ) ) return 1;
TextDrawShowForPlayer( playerid, Puslapis );
SetPVarInt( playerid, "Prisijunges", 0 );
new
Stringas[ 130 ]
;
format( Stringas, 130, ""#h_Balta"[ > ] "#h_Geltona"%s "#h_Zalia"prisijungл prie "#h_Orandzine"Fort Carson gyvenimo.", ZaidejoVardas( playerid ) );
SendClientMessageToAll( -1, Stringas );
new
Failas[ 51 ]
;
format( Failas, 51, "DuomenuBaze/Zaidejai/%s.ini", ZaidejoVardas( playerid ) );
if( dini_Exists( Failas ) ) ShowPlayerDialog( playerid, 4, DIALOG_STYLE_INPUT, ""#h_Geltona"Prisi"#h_Zalia"jun"#h_Raudona"gimas", ""#h_Balta"Sveiki sugrбюж б "#h_Geltona"Fort Carson "#h_Raudona"Gyvenimа!\n"#h_Balta"Suveskite savo "#h_Orandzine"slaptaюodб ir юaiskite!", "Jungtis", "Palikti" );
if( !dini_Exists( Failas ) ) ShowPlayerDialog( playerid, 3, DIALOG_STYLE_INPUT, ""#h_Geltona"Re"#h_Zalia"gis"#h_Raudona"tracija", ""#h_Balta"Jыs esate "#h_Zalia"Naujokas. "#h_Orandzine"\nSuveskite slaptaюodб, ir pradлkite юaidimа "#h_Raudona"Fort Carson Gyvenime.", "Vesti", "Palikti" );
return 1;
}
Re: NPC. -
Mean - 27.01.2011
Oh, then I really dunno.
Re: NPC. -
iMonk3y - 27.01.2011
oh wait sorry...
You don't need to change NPC's interior, I believe they're visible in all interiors.
Re: NPC. -
Gh0sT_ - 27.01.2011
buumppx
iM: nah, tryied this.