SA-MP Forums Archive
[HELP] Check if NPC is Online - 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)
+--- Thread: [HELP] Check if NPC is Online (/showthread.php?tid=597302)



[HELP] Check if NPC is Online - PRoleplay - 29.12.2015

how to check if NPC is online base on NPC Name

I'm tryi'n to make a command to show all npc status maybe its online/offline


Re: [HELP] Check if NPC is Online - Tamy - 29.12.2015

Код:
new name[32], npcname[32], f=-1;
for(new i=0; i<MAX_PLAYERS; i++)
{
    GetPlayerName(i, name, 32);
    if(!strcmp(name, npcname, false) && strlen(name))
    {
        print("NPC IS ONLINE");
        f=1;
     }
}
if(f==-1) print("NPC IS OFFLINE");
Fill the "npcname" variable with your NPC name.