@@ -105,6 +105,79 @@ int BotCommandHandler_O(edict_t* ent, const String& arg0, const String& arg1, co
105
105
else if (stricmp (arg0, " fillserver" ) == 0 || stricmp (arg0, " fill" ) == 0 )
106
106
g_botManager->FillServer (atoi (arg1), IsNullString (arg2) ? -1 : atoi (arg2), IsNullString (arg3) ? -1 : atoi (arg3), IsNullString (arg4) ? -1 : atoi (arg4));
107
107
108
+ // set entity action with command
109
+ else if (stricmp (arg0, " setentityaction" ) == 0 )
110
+ {
111
+ int index = atoi (arg1);
112
+ int team = atoi (arg2);
113
+ int action = atoi (arg3);
114
+
115
+ int i;
116
+ if (index == -1 )
117
+ {
118
+ for (i = 0 ; i < entityNum; i++)
119
+ SetEntityActionData (i);
120
+
121
+ ServerPrintNoTag (" [E-Bot] Set Entity Action - Delete All - Done" );
122
+ return 1 ;
123
+ }
124
+
125
+ edict_t * entity = INDEXENT (index);
126
+ if (FNullEnt (entity) || !IsAlive (entity))
127
+ {
128
+ ServerPrintNoTag (" [E-Bot] Set Entity Action - Entity is NULL or not alive - Done" );
129
+ return -1 ;
130
+ }
131
+
132
+ if (IsValidPlayer (entity))
133
+ {
134
+ ServerPrintNoTag (" [E-Bot] Set Entity Action - Cannot set the player - Done" );
135
+ return -1 ;
136
+ }
137
+
138
+ for (i = 0 ; i < entityNum; i++)
139
+ {
140
+ if (g_entityId[i] == index)
141
+ {
142
+ if (action != -1 )
143
+ {
144
+ if (team != g_entityTeam[i] || action != g_entityAction[i])
145
+ {
146
+ SetEntityActionData (i, index, team, action);
147
+ ServerPrintNoTag (" [E-Bot] Set Entity Action - Change ID: %d Team: %d Action: %d - Done" , index, team, action);
148
+ }
149
+ else
150
+ ServerPrintNoTag (" [E-Bot] Set Entity Action - Don't Need Change ID: %d - Not Change - Done" , index);
151
+ }
152
+ else
153
+ {
154
+ SetEntityActionData (i);
155
+ ServerPrintNoTag (" [E-Bot] Set Entity Action - Delete ID: %d - Done" , index);
156
+ }
157
+
158
+ return 1 ;
159
+ }
160
+ }
161
+
162
+ if (action == -1 )
163
+ {
164
+ ServerPrintNoTag (" [E-Bot] Set Entity Action - Cannot Delete ID: %d - Not Find - Done" , index);
165
+ return -1 ;
166
+ }
167
+
168
+ for (i = 0 ; i < entityNum; i++)
169
+ {
170
+ if (g_entityId[i] == -1 )
171
+ {
172
+ SetEntityActionData (i, index, team, action);
173
+ return 1 ;
174
+ }
175
+ }
176
+
177
+ ServerPrintNoTag (" [E-Bot] Cannot Add Entity Action - Unknow Error - Done" );
178
+ return -1 ;
179
+ }
180
+
108
181
// swap counter-terrorist and terrorist teams
109
182
else if (stricmp (arg0, " swaptteams" ) == 0 || stricmp (arg0, " swap" ) == 0 )
110
183
{
@@ -288,46 +361,6 @@ int BotCommandHandler_O(edict_t* ent, const String& arg0, const String& arg1, co
288
361
}
289
362
}
290
363
291
- // sets mesh for waypoint
292
- else if (stricmp (arg0, " setmesh" ) == 0 )
293
- {
294
- if (IsNullString (arg1))
295
- ClientPrint (ent, print_withtag, " Please set mesh <number>" );
296
- else if (FNullEnt (g_hostEntity))
297
- ClientPrint (ent, print_withtag, " Please try this in lan game" );
298
- else
299
- {
300
- int index = g_waypoint->FindNearest (GetEntityOrigin (g_hostEntity), 75 .0f );
301
- if (IsValidWaypoint (index))
302
- {
303
- g_waypoint->GetPath (index)->campStartX = fabsf (static_cast <float > (atof (arg1)));
304
- ClientPrint (ent, print_withtag, " Waypoint mesh set to %d" , static_cast <int > (g_waypoint->GetPath (index)->campStartX ));
305
- }
306
- else
307
- ClientPrint (ent, print_withtag, " Waypoint is not valid" );
308
- }
309
- }
310
-
311
- // sets gravity for waypoint
312
- else if (stricmp (arg0, " setgravity" ) == 0 )
313
- {
314
- if (IsNullString (arg1))
315
- ClientPrint (ent, print_withtag, " Please set gravity <number>" );
316
- else if (FNullEnt (g_hostEntity))
317
- ClientPrint (ent, print_withtag, " Please try this in lan game" );
318
- else
319
- {
320
- int index = g_waypoint->FindNearest (GetEntityOrigin (g_hostEntity), 75 .0f );
321
- if (IsValidWaypoint (index))
322
- {
323
- g_waypoint->GetPath (index)->campStartY = fabsf (static_cast <float > (atof (arg1)));
324
- ClientPrint (ent, print_withtag, " Waypoint gravity set to %f" , g_waypoint->GetPath (index)->campStartY );
325
- }
326
- else
327
- ClientPrint (ent, print_withtag, " Waypoint is not valid" );
328
- }
329
- }
330
-
331
364
// displays main bot menu
332
365
else if (stricmp (arg0, " botmenu" ) == 0 || stricmp (arg0, " menu" ) == 0 )
333
366
DisplayMenuToClient (ent, &g_menus[0 ]);
@@ -478,6 +511,42 @@ int BotCommandHandler_O(edict_t* ent, const String& arg0, const String& arg1, co
478
511
DisplayMenuToClient (g_hostEntity, &g_menus[12 ]);
479
512
}
480
513
514
+ // sets mesh for waypoint
515
+ else if (stricmp (arg1, " setmesh" ) == 0 )
516
+ {
517
+ if (IsNullString (arg2))
518
+ ClientPrint (ent, print_withtag, " Please set mesh <number>" );
519
+ else
520
+ {
521
+ int index = g_waypoint->FindNearest (GetEntityOrigin (g_hostEntity), 75 .0f );
522
+ if (IsValidWaypoint (index))
523
+ {
524
+ g_waypoint->GetPath (index)->campStartX = fabsf (static_cast <float > (atof (arg2)));
525
+ ClientPrint (ent, print_withtag, " Waypoint mesh set to %d" , static_cast <int > (g_waypoint->GetPath (index)->campStartX ));
526
+ }
527
+ else
528
+ ClientPrint (ent, print_withtag, " Waypoint is not valid" );
529
+ }
530
+ }
531
+
532
+ // sets gravity for waypoint
533
+ else if (stricmp (arg1, " setgravity" ) == 0 )
534
+ {
535
+ if (IsNullString (arg2))
536
+ ClientPrint (ent, print_withtag, " Please set gravity <number>" );
537
+ else
538
+ {
539
+ int index = g_waypoint->FindNearest (GetEntityOrigin (g_hostEntity), 75 .0f );
540
+ if (IsValidWaypoint (index))
541
+ {
542
+ g_waypoint->GetPath (index)->campStartY = fabsf (static_cast <float > (atof (arg2)));
543
+ ClientPrint (ent, print_withtag, " Waypoint gravity set to %f" , g_waypoint->GetPath (index)->campStartY );
544
+ }
545
+ else
546
+ ClientPrint (ent, print_withtag, " Waypoint is not valid" );
547
+ }
548
+ }
549
+
481
550
// creates basic waypoints on the map (ladder/spawn points/goals)
482
551
else if (stricmp (arg1, " addbasic" ) == 0 )
483
552
{
@@ -2789,7 +2858,7 @@ void JustAStuff(void)
2789
2858
edict_t * player = INDEXENT (i);
2790
2859
2791
2860
// code below is executed only on dedicated server
2792
- if (!FNullEnt (player) && (player->v .flags & FL_CLIENT) && !(player-> v . flags & FL_FAKECLIENT) )
2861
+ if (!FNullEnt (player) && (player->v .flags & FL_CLIENT))
2793
2862
{
2794
2863
const char * password = ebot_password.GetString ();
2795
2864
const char * key = ebot_password_key.GetString ();
@@ -2846,38 +2915,36 @@ void JustAStuff(void)
2846
2915
static float secondTimer = 0.0 ;
2847
2916
void FrameThread (void )
2848
2917
{
2849
- if (g_analyzewaypoints)
2850
- g_waypoint->Analyze ();
2851
-
2852
- if (ebot_lockzbot.GetBool ())
2853
- {
2854
- if (CVAR_GET_FLOAT (" bot_quota" ) > 0 )
2855
- {
2856
- CVAR_SET_FLOAT (" ebot_quota" , CVAR_GET_FLOAT (" bot_quota" ));
2857
- ServerPrint (" ebot_lockzbot is 1, you cannot add Z-Bot" );
2858
- ServerPrint (" You can input ebot_lockzbot unlock add Z-Bot" );
2859
- ServerPrint (" But, If you have use AMXX plug-in or Zombie Mod, I think this is not good choice" );
2860
- CVAR_SET_FLOAT (" bot_quota" , 0 );
2861
- }
2862
- }
2863
-
2864
2918
if (secondTimer < engine->GetTime ())
2865
2919
{
2866
2920
LoadEntityData ();
2867
2921
JustAStuff ();
2868
2922
2869
- float time = 0 .64f ;
2870
- if (g_waypointOn)
2871
- time = 1 .0f ;
2923
+ if (g_bombPlanted)
2924
+ g_waypoint->SetBombPosition ();
2872
2925
2873
- secondTimer = AddTime (time);
2874
- }
2926
+ if (ebot_lockzbot.GetBool ())
2927
+ {
2928
+ if (CVAR_GET_FLOAT (" bot_quota" ) > 0 )
2929
+ {
2930
+ CVAR_SET_FLOAT (" ebot_quota" , CVAR_GET_FLOAT (" bot_quota" ));
2931
+ ServerPrint (" ebot_lockzbot is 1, you cannot add Z-Bot" );
2932
+ ServerPrint (" You can input ebot_lockzbot unlock add Z-Bot" );
2933
+ ServerPrint (" But, If you have use AMXX plug-in or Zombie Mod, I think this is not good choice" );
2934
+ CVAR_SET_FLOAT (" bot_quota" , 0 );
2935
+ }
2936
+ }
2875
2937
2876
- if (g_bombPlanted)
2877
- g_waypoint->SetBombPosition ();
2938
+ secondTimer = AddTime (1 .0f );
2939
+ }
2940
+ else
2941
+ {
2942
+ // keep bot number up to date
2943
+ g_botManager->MaintainBotQuota ();
2878
2944
2879
- // keep bot number up to date
2880
- g_botManager->MaintainBotQuota ();
2945
+ if (g_analyzewaypoints)
2946
+ g_waypoint->Analyze ();
2947
+ }
2881
2948
}
2882
2949
2883
2950
void StartFrame (void )
0 commit comments