SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 01/04/2020, 06:09 PM   #1
Fairuz
Huge Clucker
 
Fairuz's Avatar
 
Join Date: Sep 2015
Location: Indonesia
Posts: 453
Reputation: 64
Default FCNPC created in 0 vw and interior when it shouldn't

I had to update my code after updating to the latest version of FCNPC, it works in 1.8.2 but not in 2.0.7.
Here's the code.

PHP Code:
stock CreateCivilianNpcname[ ], skinId[ ], clerkIdanimlib16 ], animname16 ], const Floatposition], worldid = -1interior = -1boolhostile truenumSkins sizeofskinId ) )
{
    new
        
szBotNameMAX_PLAYER_NAME ];

    
formatszBotNamesizeofszBotName ), "%s"name );
    
strreplacecharszBotName' ''\0' );
    
strreplacecharszBotName'/''\0' );

    new
        
civilianid Iter_Free(CivilianNpc);

    if ( 
civilianid != ITER_NONE )
    {
        new
            
randomSkin randomnumSkins );

        
Iter_Add(CivilianNpccivilianid);

        
formatg_civilianNpcDatacivilianid ] [ E_ANIM_LIB ], 16"%s"animlib );
        
formatg_civilianNpcDatacivilianid ] [ E_ANIM_NAME ], 16"%s"animname );
        
formatg_civilianNpcDatacivilianid ] [ E_NPC_NAME ], MAX_PLAYER_NAME"%s"name );
        
CreateDynamic3DTextLabelsprintf"%s"name ), 0xFFFFFF25position], position], position], 25.0INVALID_PLAYER_IDINVALID_VEHICLE_ID, .testlos 0, .worldid worldid );
        
g_civilianNpcDatacivilianid ] [ E_NPC_ID ] = FCNPC_Createworldid != -sprintf"[BOT]%s%d"szBotNamecivilianid ) : sprintf"[BOT]%s"szBotName ) );
        
//g_civilianNpcData[ civilianid ] [ E_WORLD ] = worldid == -1 ? 0 : worldid;
        //g_civilianNpcData[ civilianid ] [ E_INTERIOR ] = interior == -1 ? 0 : interior;
        
g_civilianNpcDatacivilianid ] [ E_WORLD ] = worldid;
        
g_civilianNpcDatacivilianid ] [ E_INTERIOR ] = interior;
        
g_civilianNpcDatacivilianid ] [ E_CLERK_ID ] = clerkId;
        
g_civilianNpcDatacivilianid ] [ E_HOSTILE ] = hostile;
        
FCNPC_Spawng_civilianNpcDatacivilianid ] [ E_NPC_ID ], skinIdrandomSkin ], position], position], position] );
        
FCNPC_SetAngleg_civilianNpcDatacivilianid ] [ E_NPC_ID ], ( g_civilianNpcDatacivilianid ] [ E_RZ ] = position] ) );
    }
    else print( 
"[ERROR] Civilian cannot be added due to small limit, please raise." );

How I use it:
PHP Code:
CreateCivilianNpc"Triad", { 117118121122123 }, clerkid"INT_HOUSE""wash_up"drugDealerPositions] [ randomsizeofdrugDealerPositions[ ] ) ) ], worldid, .interior ); 
the world id and interior parameters are both 0 instead of -1 and 6
Fairuz is offline   Reply With Quote
Old 01/04/2020, 06:30 PM   #2
YouShootIDodge
Big Clucker
 
Join Date: May 2019
Posts: 63
Reputation: 14
Default Re: FCNPC created in 0 vw and interior when it shouldn't

There will be an error in the logs.
YouShootIDodge is offline   Reply With Quote
Old 01/04/2020, 06:37 PM   #3
Fairuz
Huge Clucker
 
Fairuz's Avatar
 
Join Date: Sep 2015
Location: Indonesia
Posts: 453
Reputation: 64
Default Re: FCNPC created in 0 vw and interior when it shouldn't

There's no error. It spawned just like normal. Forgot to tell that I've set the worldid and interior before:
PHP Code:
            FCNPC_SetVirtualWorldnpcidg_civilianNpcDatacivilianid ] [ E_WORLD ] );
            
FCNPC_SetInteriornpcidg_civilianNpcDatacivilianid ] [ E_INTERIOR ] ); 
Fairuz is offline   Reply With Quote
Old 02/04/2020, 04:46 AM   #4
Fairuz
Huge Clucker
 
Fairuz's Avatar
 
Join Date: Sep 2015
Location: Indonesia
Posts: 453
Reputation: 64
Default Re: FCNPC created in 0 vw and interior when it shouldn't

Anyone?
Fairuz is offline   Reply With Quote
Old 02/04/2020, 10:58 AM   #5
Fairuz
Huge Clucker
 
Fairuz's Avatar
 
Join Date: Sep 2015
Location: Indonesia
Posts: 453
Reputation: 64
Default Re: FCNPC created in 0 vw and interior when it shouldn't

Fixed it. The problem was with the fcnpc plugin itself.
Fairuz is offline   Reply With Quote
Old 02/04/2020, 04:31 PM   #6
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Location: 🇩🇪
Posts: 1,774
Reputation: 619
Default Re: FCNPC created in 0 vw and interior when it shouldn't

Since 2.0 you should move all code related to settings/weapons/v.world etc to FCNPC_OnCreate, it seems more reliable (even though it usually works anywhere, it sometimes crashes or glitches when you don't). Just as a note if you notice anything weird.
NaS is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[MAP] modern Cityhall Interior l created by Risq Risq Screenshots and Videos 0 08/01/2019 08:27 PM
[FCNPC] Error: NPC not created. Adam_Hardy Scripting Help 6 06/03/2018 10:44 PM
[Map] House Interior Created by Acres Acres Maps 11 03/05/2014 08:12 AM
This shouldn't be happening ? Tagathron Scripting Help 5 01/11/2013 09:39 PM
Error when there shouldn't be Joe Staff Help Archive 5 01/08/2009 10:21 AM


All times are GMT. The time now is 07:27 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.