04.09.2009, 14:48
[size=32px]Useful Functions, Defines, Macros...[/size]
[size=20px]For SA:MP 0.3[/size]
Please Sticky the Topic! Collection of useful functions. Please write here usefull functions.
And plase use PAWN tag.
Код:
pawn Код:code
pawn Код:
#define MAX_NPC_NAME_LEN (64)
//------------------------------------------------------------------------------
// Name: DisconnectNPC
// Prototype: DisconnectNPC( npc name );
// Author: Gamestar ©
//------------------------------------------------------------------------------
stock DisconnectNPC( npcname[ ] )
{
for( new i = 0; i < GetMaxPlayers( ); i++ )
{
if( IsPlayerNPC( i ))
{
new name[ MAX_NPC_NAME_LEN ];
GetPlayerName( i, name, MAX_NPC_NAME_LEN );
if( !strcmp( name, "npcname", true ) )
{
return Kick( i );
}
}
}
return INVALID_PLAYER_ID;
}
//------------------------------------------------------------------------------
// Name: DisconnectNPCEx
// Prototype: DisconnectNPCEx( npc id );
// Author: Gamestar ©
//------------------------------------------------------------------------------
stock DisconnectNPCEx( npcid )
{
if( IsPlayerNPC( npcid ) )
{
return Kick( npcid );
}
return INVALID_PLAYER_ID;
}
//------------------------------------------------------------------------------
// Name: DisconnectAllNPC
// Prototype: DisconnectAllNPC( No parameters );
// Author: Gamestar ©
//------------------------------------------------------------------------------
stock DisconnectAllNPC( )
{
for( new i = 0; i < GetMaxPlayers( ); i++ )
{
if( IsPlayerNPC( i ))
{
return Kick( i );
}
}
return INVALID_PLAYER_ID;
}