Problem with NPC, help please
#1

Hey guys!
I have a problem with npc. Well, everything works with him but i have some online text draw and in this text draw include my npc, but he is just a bot, not a player. So is it possible to not include npc in online players? I hope you understand me. Sorry for my bad english, im Lithuanian
Reply
#2

Add something like this in your code: if( IsPlayerConnected(i) && !IsPlayerNPC(i) )....
Reply
#3

Could you give me an example?
Reply
#4

I hope you already made a textdraw showing how many connected players are there..

pawn Код:
//On top of your script (Global Var)
new g_ConnectedPlayers;

//Default functions:
public OnPlayerConnect(playerid)
{
    if(!IsPlayerNPC(playerid)) g_ConnectedPlayers++;
    UpdatePlayersTextDraw();
    return 1;
}
public OnPlayerDisconnect(playerid)
{
    if(!IsPlayerNPC(playerid)) g_ConnectedPlayers--;
    UpdatePlayersTextDraw();
    return 1;
}

//new stock function, put it anywhere outside other functions
stock UpdatePlayersTextDraw()
{
    new players[32];
    format(players, sizeof players, "Players: %i/100", g_ConnectedPlayers);
    TextDrawSetString(/* TextDraw Name */, players);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)