NPC disappear after player spawn
#1

Hi,
Problem is that NPC disappear (no disconnects) after right after player spawn. No, I dont have any login system. Using 0.3e, and granlarc npcs in my own gamemode. NPC Spawns at Onplayerspawn.

Is this bug or what I can do for it? Filterscripts used ferriswheel cargoship gl_property pirateship. Those 0.3e. maxnpc 100 and maxplayers 30. Does maxplayers affect to this?

Code:
public OnPlayerSpawn(playerid)
{
    // Show clock
   	TextDrawShowForPlayer(playerid, RealTimeClock);
	gettime(hour, minute, seconda);
	
	// Load NPCs
	if(IsPlayerNPC(playerid))
    {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
    if(!strcmp(npcname,"LSRuokalaBottiA",true))
	{
        SetPlayerSkin(playerid, 205);
        SetPlayerColor(playerid, 0xFFFFFF00);
        return 1;
 	}
 	if(!strcmp(npcname, "LSRuokalaBottiB", true))
	{
        SetPlayerSkin(playerid, 205);
        SetPlayerColor(playerid, 0xFFFFFF00);
        return 1;
 	}
 	if(!strcmp(npcname, "LSRuokalaBottiC", true))
	{
        SetPlayerSkin(playerid, 205);
        SetPlayerColor(playerid, 0xFFFFFF00);
        return 1;
 	}
 	if(!strcmp(npcname, "LSRuokalaBottiD", true))
	{
        SetPlayerSkin(playerid, 270);
        SetPlayerColor(playerid, 0xFFFFFF00);
        return 1;
 	}
 	if(!strcmp(npcname, "LSRuokalaBottiE", true))
	{
        SetPlayerSkin(playerid, 270);
        SetPlayerColor(playerid, 0xFFFFFF00);
        return 1;
 	}
    if(!strcmp(npcname, "TrainDriverLV", true))
	{
	    SetPlayerSkin(playerid, 255);
        PutPlayerInVehicle(playerid, lvtrain, 0);
        SetVehicleParamsEx(lvtrain, 1, 1, 0, 0, 0, 0, 0);
        SetPlayerColor(playerid, 0xFFFFFFFF);
        return 1;
 	}
	if(!strcmp(npcname, "TrainDriverSF", true))
	{
	    SetPlayerSkin(playerid, 255);
	    PutPlayerInVehicle(playerid, sftrain, 0);
        SetVehicleParamsEx(sftrain, 1, 1, 0, 0, 0, 0, 0);
        SetPlayerColor(playerid, 0xFFFFFFFF);
        return 1;
	}
	if(!strcmp(npcname, "TrainDriverLS", true))
	{
	    SetPlayerSkin(playerid, 255);
	    PutPlayerInVehicle(playerid, lstrain, 0);
        SetVehicleParamsEx(lstrain, 1, 1, 0, 0, 0, 0, 0);
        SetPlayerColor(playerid, 0xFFFFFFFF);
        return 1;
	}
	if(!strcmp(npcname, "PilotLV", true))
	{
	    SetPlayerSkin(playerid, 255);
	    PutPlayerInVehicle(playerid, lvplane, 0);
        SetVehicleParamsEx(lvplane, 1, 1, 0, 0, 0, 0, 0);
        SetPlayerColor(playerid, 0xFFFFFFFF);
        return 1;
	}
	if(!strcmp(npcname, "PilotSF", true))
	{
	    SetPlayerSkin(playerid, 255);
	    PutPlayerInVehicle(playerid, sfplane, 0);
        SetVehicleParamsEx(sfplane, 1, 1, 0, 0, 0, 0, 0);
        SetPlayerColor(playerid, 0xFFFFFFFF);
        return 1;
	}
	if(!strcmp(npcname, "PilotLS", true))
	{
	    SetPlayerSkin(playerid, 255);
	    PutPlayerInVehicle(playerid, lsplane, 0);
        SetVehicleParamsEx(lsplane, 1, 1, 0, 0, 0, 0, 0);
        SetPlayerColor(playerid, 0xFFFFFFFF);
        return 1;
	}
    if(!strcmp(npcname, "BottiZ", true))
	{
      SetPlayerSkin(playerid, 255);
      SetVehicleParamsEx(aikyliltakorjaamol, 1, 1, 0, 0, 0, 0, 0);
      PutPlayerInVehicle(playerid, aikyliltakorjaamol, 0);
      return 1;
   	}
	}
	
	// Load Player
	new file[125];
	new string[125];
 	format(file, sizeof(file), "users/%s.ini", RPN(playerid));
	uData[playerid][E_USER_DATA_MONEY] = dini_Int(file, "money");
	uData[playerid][E_USER_DATA_BANK] = dini_Int(file, "bank");
	uData[playerid][E_USER_DATA_PAYS] = dini_Int(file, "pays");
	uData[playerid][E_USER_DATA_FINES] = dini_Int(file, "fines");
	uData[playerid][E_USER_DATA_CRIMINALS] = dini_Int(file, "criminals");
	uData[playerid][E_USER_DATA_WANTED] = dini_Int(file, "wanted");
	uData[playerid][E_USER_DATA_ACLEVEL] = dini_Int(file, "aclevel");
	uData[playerid][E_USER_DATA_WORKID] = dini_Int(file, "workid");
	uData[playerid][E_USER_DATA_SWORKID] = dini_Int(file, "sworkid");
	uData[playerid][E_USER_DATA_DRIVING] = dini_Int(file, "driving");
	uData[playerid][E_USER_DATA_PAIDFLICENCE] = dini_Int(file, "paidfdlicence");
	uData[playerid][E_USER_DATA_LOTTOWON] = dini_Int(file, "lottowon");
	uData[playerid][E_USER_DATA_LOTTOWONAMOUNT] = dini_Int(file, "lottowonamount");
	uData[playerid][E_USER_DATA_Hx] = dini_Float(file, "hx");
	uData[playerid][E_USER_DATA_Hy] = dini_Float(file, "hy");
	uData[playerid][E_USER_DATA_Hz] = dini_Float(file, "hz");
	uData[playerid][E_USER_DATA_Ha] = dini_Float(file, "ha");
 	SetPlayerHealth(playerid, 100.0);
	SetPlayerInterior(playerid, 0);
	SetPlayerArmour(playerid, 100.0);
	SetPlayerPos(playerid, uData[playerid][E_USER_DATA_Hx], uData[playerid][E_USER_DATA_Hy], uData[playerid][E_USER_DATA_Hz]);
	CreateDynamicMapIcon(uData[playerid][E_USER_DATA_Hx], uData[playerid][E_USER_DATA_Hy], uData[playerid][E_USER_DATA_Hz], 32, -1, -1, -1, -1, 100.0);
	ResetPlayerMoney(playerid);
	GivePlayerMoney(playerid, uData[playerid][E_USER_DATA_MONEY]);
 	SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,200);
	SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL_SILENCED,200);
	SetPlayerSkillLevel(playerid,WEAPONSKILL_DESERT_EAGLE,200);
	SetPlayerSkillLevel(playerid,WEAPONSKILL_SHOTGUN,200);
	SetPlayerSkillLevel(playerid,WEAPONSKILL_SAWNOFF_SHOTGUN,200);
	SetPlayerSkillLevel(playerid,WEAPONSKILL_SPAS12_SHOTGUN,200);
	SetPlayerSkillLevel(playerid,WEAPONSKILL_MICRO_UZI,200);
	SetPlayerSkillLevel(playerid,WEAPONSKILL_MP5,200);
	SetPlayerSkillLevel(playerid,WEAPONSKILL_AK47,200);
	SetPlayerSkillLevel(playerid,WEAPONSKILL_M4,200);
	SetPlayerSkillLevel(playerid,WEAPONSKILL_SNIPERRIFLE,200);
	SetPlayerSkin(playerid, GetPlayerSkin(playerid));
	if(uData[playerid][E_USER_DATA_LOTTOWON] == 1)
	{
		format(string, sizeof(string), "kk", RPN(playerid), uData[playerid][E_USER_DATA_LOTTOWONAMOUNT]);
		SendClientMessage(playerid, COLOR_GREEN, "kk");
		SendClientMessageToAll(COLOR_YELLOW, string);
	}
	if(uData[playerid][E_USER_DATA_WANTED] > 0)
	{
   		SetPlayerWantedLevel(playerid, uData[playerid][E_USER_DATA_WANTED]);
   		PlayCrimeReportForPlayer(playerid, playerid, 10);
   		format(string, sizeof(string), "kk", RPN(playerid), uData[playerid][E_USER_DATA_CRIMINALS]);
   		SendClientMessage(playerid, COLOR_RED, "kk
   		SendClientMessageToAll(COLOR_WHITE, string);
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)