@@ -39,37 +39,6 @@ void API_SetupForwards()
3939 g_hGlobalForward_OnRemoveGroup = CreateGlobalForward (" VIP_OnRemoveGroup" , ET_Ignore , Param_String );
4040}
4141
42- void CallForward_OnConfigsLoaded ()
43- {
44- Call_StartForward (g_hGlobalForward_OnConfigsLoaded );
45- Call_Finish ();
46- }
47-
48- void CallForward_OnAddGroup (char [] sGroup )
49- {
50- Call_StartForward (g_hGlobalForward_OnAddGroup );
51- Call_PushString (sGroup );
52- Call_Finish ();
53- }
54-
55- void CallForward_OnRemoveGroup (char [] sGroup )
56- {
57- Call_StartForward (g_hGlobalForward_OnRemoveGroup );
58- Call_PushString (sGroup );
59- Call_Finish ();
60- }
61-
62-
63- bool CallForward_OnClientPreLoad (int iClient )
64- {
65- bool bResult = true ;
66- Call_StartForward (g_hGlobalForward_OnClientPreLoad );
67- Call_PushCell (iClient );
68- Call_Finish (bResult );
69-
70- return bResult ;
71- }
72-
7342public APLRes AskPluginLoad2 (Handle myself , bool bLate , char [] szError , int err_max )
7443{
7544 g_eServerData .Engine = GetEngineVersion ();
@@ -103,8 +72,9 @@ public APLRes AskPluginLoad2(Handle myself, bool bLate, char[] szError, int err_
10372
10473
10574 // Clients
106- //RegNative(CheckClient);
10775 RegNative (IsClientVIP );
76+ RegNative (GetClientID );
77+ RegNative (CheckClient );
10878
10979 RegNative (GetClientGroupName );
11080 RegNative (GetClientGroupExpire );
@@ -134,19 +104,50 @@ public APLRes AskPluginLoad2(Handle myself, bool bLate, char[] szError, int err_
134104 RegNative (GetClientStorageValue );
135105
136106 // Helpers
137- RegNative (GetTimeFromStamp );
138107 RegNative (LogMessage );
139- // RegNative(PrintToChatClient);
140- // RegNative(PrintToChatAll);
108+ RegNative (PrintToChatClient );
109+ RegNative (PrintToChatAll );
141110 //RegNative(AddStringToggleStatus);
142- //RegNative(TimeToSeconds);
143- //RegNative(SecondsToTime);
111+ RegNative (GetTimeFromStamp );
112+ RegNative (TimeToSeconds );
113+ RegNative (SecondsToTime );
144114
145115 RegPluginLibrary (" vip_core" );
146116
147117 return APLRes_Success ;
148118}
149119
120+ void CallForward_OnConfigsLoaded ()
121+ {
122+ Call_StartForward (g_hGlobalForward_OnConfigsLoaded );
123+ Call_Finish ();
124+ }
125+
126+ void CallForward_OnAddGroup (char [] sGroup )
127+ {
128+ Call_StartForward (g_hGlobalForward_OnAddGroup );
129+ Call_PushString (sGroup );
130+ Call_Finish ();
131+ }
132+
133+ void CallForward_OnRemoveGroup (char [] sGroup )
134+ {
135+ Call_StartForward (g_hGlobalForward_OnRemoveGroup );
136+ Call_PushString (sGroup );
137+ Call_Finish ();
138+ }
139+
140+
141+ bool CallForward_OnClientPreLoad (int iClient )
142+ {
143+ bool bResult = true ;
144+ Call_StartForward (g_hGlobalForward_OnClientPreLoad );
145+ Call_PushCell (iClient );
146+ Call_Finish (bResult );
147+
148+ return bResult ;
149+ }
150+
150151void CallForward_OnClientLoaded (int iClient )
151152{
152153 Call_StartForward (g_hGlobalForward_OnClientLoaded );
@@ -291,6 +292,26 @@ bool Function_OnItemSelect(Handle hPlugin, Function FuncSelect, int iClient, con
291292 return bResult ;
292293}
293294
295+ public int Native_GetClientID (Handle hPlugin , int iNumParams )
296+ {
297+ int iClient = GetNativeCell (1 );
298+ if (CheckValidClient (iClient , false ))
299+ {
300+ return g_ePlayerData [iClient ].AccountID ;
301+ }
302+
303+ return 0 ;
304+ }
305+
306+ public int Native_CheckClient (Handle hPlugin , int iNumParams )
307+ {
308+ int iClient = GetNativeCell (1 );
309+
310+ g_ePlayerData [iClient ].RebuildFeatureList ();
311+
312+ return 1 ;
313+ }
314+
294315public int Native_FillArrayByGroups (Handle hPlugin , int iNumParams )
295316{
296317 ArrayList hArray = view_as <ArrayList >(GetNativeCell (1 ));
@@ -372,6 +393,8 @@ public int Native_GroupAddFeature(Handle hPlugin, int iNumParams)
372393 hGroup .AddFeature (sFeature , sValue );
373394
374395 g_hGroups .SetArray (iIndex , hGroup , sizeof (hGroup ));
396+
397+ RebuildFeatureList ();
375398
376399 return 1 ;
377400}
@@ -395,6 +418,8 @@ public int Native_GroupRemoveFeature(Handle hPlugin, int iNumParams)
395418 hGroup .DelFeature (sFeature );
396419
397420 g_hGroups .SetArray (iIndex , hGroup , sizeof (hGroup ));
421+
422+ RebuildFeatureList ();
398423
399424 return 1 ;
400425}
@@ -1032,6 +1057,49 @@ public int Native_LogMessage(Handle hPlugin, int iNumParams)
10321057 return 0 ;
10331058}
10341059
1060+ public int Native_PrintToChatClient (Handle hPlugin , int iNumParams )
1061+ {
1062+ int iClient = GetNativeCell (1 );
1063+
1064+ if (CheckValidClient (iClient , false ))
1065+ {
1066+ char szMessage [PLATFORM_MAX_PATH ];
1067+ SetGlobalTransTarget (iClient );
1068+ FormatNativeString (0 , 2 , 3 , sizeof (szMessage ), _ , szMessage );
1069+
1070+ Colors_Print (iClient , szMessage );
1071+ }
1072+
1073+ return 0 ;
1074+ }
1075+
1076+ public int Native_PrintToChatAll (Handle hPlugin , int iNumParams )
1077+ {
1078+ char szMessage [PLATFORM_MAX_PATH ];
1079+
1080+ for (int i = 1 ; i <= MaxClients ; ++ i )
1081+ {
1082+ if (IsClientInGame (i ) && ! IsFakeClient (i ))
1083+ {
1084+ SetGlobalTransTarget (i );
1085+ FormatNativeString (0 , 1 , 2 , sizeof (szMessage ), _ , szMessage );
1086+ Colors_Print (i , szMessage );
1087+ }
1088+ }
1089+
1090+ return 0 ;
1091+ }
1092+
1093+ public int Native_TimeToSeconds (Handle hPlugin , int iNumParams )
1094+ {
1095+ return UTIL_TimeToSeconds (GetNativeCell (1 ));
1096+ }
1097+
1098+ public int Native_SecondsToTime (Handle hPlugin , int iNumParams )
1099+ {
1100+ return UTIL_SecondsToTime (GetNativeCell (1 ));
1101+ }
1102+
10351103bool CheckValidClient (const int &iClient , bool bCheckVIP = true )
10361104{
10371105 if (iClient < 1 || iClient > MaxClients )
0 commit comments