-
Notifications
You must be signed in to change notification settings - Fork 42
/
PTaH.inc
1138 lines (1011 loc) · 33 KB
/
PTaH.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#if defined _PTaH_included
#endinput
#endif
#define _PTaH_included
#define PTaH_AVATAR_SIZE 64 * 64 * 3 // Height * Width * Pixel cell
enum PTaH_HookType
{
UnHook = 0,
Hook
};
enum PTaH_HookEvent
{
PTaH_GiveNamedItemPre = 10,
PTaH_GiveNamedItemPost,
PTaH_WeaponCanUsePre,
PTaH_WeaponCanUsePost,
PTaH_SetPlayerModelPre,
PTaH_SetPlayerModelPost,
PTaH_ClientVoiceToPre,
PTaH_ClientVoiceToPost,
PTaH_ConsolePrintPre,
PTaH_ConsolePrintPost,
PTaH_ExecuteStringCommandPre,
PTaH_ExecuteStringCommandPost,
PTaH_ClientConnectPre,
PTaH_ClientConnectPost,
PTaH_InventoryUpdatePost = 25
};
enum PTaH_ModelType
{
ViewModel = 0,
WorldModel,
DroppedModel
};
enum EStickerAttributeType
{
EStickerAttribute_ID = 0, // int
EStickerAttribute_Wear, // float
EStickerAttribute_Scale, // float
EStickerAttribute_Rotation // float
};
enum ESchemaAttributeType
{
ESchemaAttribute_Unknown = -1,
ESchemaAttribute_Uint32,
ESchemaAttribute_Float,
ESchemaAttribute_String,
ESchemaAttribute_Vector
};
enum EEconItemQuality
{
AE_UNDEFINED = -1,
AE_NORMAL = 0,
AE_GENUINE = 1,
AE_VINTAGE,
AE_UNUSUAL,
AE_UNIQUE,
AE_COMMUNITY,
AE_DEVELOPER,
AE_SELFMADE,
AE_CUSTOMIZED,
AE_STRANGE,
AE_COMPLETED,
AE_HAUNTED,
AE_TOURNAMENT,
AE_FAVORED,
AE_MAX_TYPES,
};
enum eEconItemFlags
{
kEconItemFlag_CannotTrade = 1 << 0,
kEconItemFlag_CannotBeUsedInCrafting = 1 << 1,
kEconItemFlag_CanBeTradedByFreeAccounts = 1 << 2,
kEconItemFlag_NonEconomy = 1 << 3, // Used for items that are meant to not interact in the economy -- these can't be traded, gift-wrapped, crafted, etc.
// Combination of the above flags used in code.
kEconItemFlags_CheckFlags_CannotTrade = kEconItemFlag_CannotTrade,
kEconItemFlags_CheckFlags_NotUsableInCrafting = kEconItemFlag_CannotBeUsedInCrafting,
kEconItemFlags_CheckFlags_AllGCFlags = kEconItemFlags_CheckFlags_CannotTrade | kEconItemFlags_CheckFlags_NotUsableInCrafting,
};
enum eEconItemRarity
{
kEconItemRarity_Default = 0,
kEconItemRarity_Common,
kEconItemRarity_Uncommon,
kEconItemRarity_Rare,
kEconItemRarity_Mythical,
kEconItemRarity_Legendary,
kEconItemRarity_Ancient,
kEconItemRarity_Immortal
};
enum eEconItemOrigin
{
kEconItemOrigin_Invalid = -1,
kEconItemOrigin_Drop = 0,
kEconItemOrigin_Achievement,
kEconItemOrigin_Purchased,
kEconItemOrigin_Traded,
kEconItemOrigin_Crafted,
kEconItemOrigin_StorePromotion,
kEconItemOrigin_Gifted,
kEconItemOrigin_SupportGranted,
kEconItemOrigin_FoundInCrate,
kEconItemOrigin_Earned,
kEconItemOrigin_ThirdPartyPromotion,
kEconItemOrigin_GiftWrapped,
kEconItemOrigin_HalloweenDrop,
kEconItemOrigin_PackageItem,
kEconItemOrigin_Foreign,
kEconItemOrigin_CDKey,
kEconItemOrigin_CollectionReward,
kEconItemOrigin_PreviewItem,
kEconItemOrigin_SteamWorkshopContribution,
kEconItemOrigin_PeriodicScoreReward,
kEconItemOrigin_Recycling,
kEconItemOrigin_TournamentDrop,
kEconItemOrigin_StockItem,
kEconItemOrigin_QuestReward,
kEconItemOrigin_LevelUpReward,
kEconItemOrigin_Max,
};
enum CEconItemDefinition
{
CEconItemDefinition_NULL = 0
};
enum CEconItemAttributeDefinition
{
CEconItemAttributeDefinition_NULL = 0
};
enum CEconItemAttribute
{
CEconItemAttribute_NULL = 0
};
enum CAttributeList
{
CAttributeList_NULL = 0
};
enum CEconItemView
{
CEconItemView_NULL = 0
};
enum CCSPlayerInventory
{
CCSPlayerInventory_NULL = 0
};
methodmap CEconItemDefinition // < Address
{
// CEconItemDefinition is not Handle, CloseHandle() - NOT NEEDED !!!!!!!!!!!!!!!!!!!!!
// Always check, if not wounded CEconItemDefinition - NULL ( if(pItemDefinition) ) !!!!!!!!!!!!!!!!!!!!!
/**
* Gets the definition index.
*
* @return Returns definition index.
*
* @error CEconItemDefinition == NULL.
*/
public native int GetDefinitionIndex();
/**
* Gets the item definition name.
*
* @param sBuffer Destination string buffer.
* @param iLen Maximum length of output string buffer.
*
* @return Returns length or 0 if failed.
*
* @error CEconItemDefinition == NULL.
*/
public native int GetDefinitionName(char[] sBuffer, int iLen);
/**
* Gets LoadoutSlot.
*
* @param iTeam Team index or 0 if independently.
*
* @return Returns loadout slot index.
*
* @error CEconItemDefinition == NULL.
*/
public native int GetLoadoutSlot(int iTeam = 0);
/**
* Gets the used by team.
*
* @return Returns team index or 0 if both team.
*/
public native int GetUsedByTeam();
/**
* Gets the amount slot for stickers.
* @note On agents, places are counted according
* to patch locations on the model.
*
* @return Returns sticker slot count.
*
* @error CEconItemDefinition == NULL.
*/
public native int GetNumSupportedStickerSlots();
/**
* Gets the item econ image path in resource/flash/.
* Example: "econ/weapons/base_weapons/weapon_knife"
*
* @note Add ".png" in the end of string for full formatting.
*
* @param sBuffer Destination string buffer.
* @param iLen Maximum length of output string buffer.
*
* @return Returns length or 0 if failed.
*
* @error CEconItemDefinition == NULL.
*/
public native int GetEconImage(char[] sBuffer, int iLen);
/**
* Gets the item model path.
*
* @param iModelType Model type.
* @param sBuffer Destination string buffer.
* @param iLen Maximum length of output string buffer.
* Max size PLATFORM_MAX_PATH.
*
* @return Returns length or 0 if failed.
*
* @error CEconItemDefinition == NULL or model type invalid.
*/
public native int GetModel(PTaH_ModelType iModelType, char[] sBuffer, int iLen);
/**
* @deprecated Use CEconItemDefinition::GetDefinitionName() for get the definition name. Will be removed.
*/
#pragma deprecated Use CEconItemDefinition::GetDefinitionName() instead
public native int GetClassName(char[] sBuffer, int iLen);
};
methodmap CEconItemAttributeDefinition
{
// CEconItemAttributeDefinition is not Handle, CloseHandle() - NOT NEEDED !!!!!!!!!!!!!!!!!!!!!
// Always check, if not wounded CEconItemAttributeDefinition - NULL ( if(pItemAttributeDefinition) ) !!!!!!!!!!!!!!!!!!!!!
/**
* Gets the definition index.
*
* @return Returns definition index.
*
* @error CEconItemAttributeDefinition == NULL.
*/
public native int GetDefinitionIndex();
/**
* Gets the definition attribute name.
*
* @param sBuffer Destination string buffer.
* @param iLen Maximum length of output string buffer.
*
* @return Returns definition index.
*
* @error CEconItemAttributeDefinition == NULL.
*/
public native int GetDefinitionName(char[] sBuffer, int iLen);
/**
* Gets the attribute type.
*
* @return Returns attribute type index.
*
* @error CEconItemAttributeDefinition == NULL.
*/
public native ESchemaAttributeType GetAttributeType();
};
methodmap CEconItemAttribute
{
// CEconItemAttribute is not Handle, CloseHandle() - NOT NEEDED !!!!!!!!!!!!!!!!!!!!!
// Always check, if not wounded CEconItemAttribute - NULL ( if(pItemAttribute) ) !!!!!!!!!!!!!!!!!!!!!
// Returns the definition index.
property int DefinitionIndex
{
public native get();
}
// Returns or sets attribute current value.
property any Value
{
public native set(any Value);
public native get();
}
// Returns the attribute initial value.
property any InitialValue
{
public native get();
}
// None.
property int RefundableCurrency
{
public native set(int RefundableCurrency);
public native get();
}
// Returns or sets the setbonus flag.
property bool SetBonus
{
public native set(bool SetBonus);
public native get();
}
};
methodmap CAttributeList // < Address
{
// CAttributeList is not Handle, CloseHandle() - NOT NEEDED !!!!!!!!!!!!!!!!!!!!!
// Always check, if not wounded CAttributeList - NULL ( if(pAttributeList) ) !!!!!!!!!!!!!!!!!!!!!
/**
* Removes all attributes from the list.
*
* @noreturn
*
* @error CAttributeList == NULL.
*/
public native void DestroyAllAttributes();
/**
* Gets the attributes count in the list.
*
* @return Returns the attributes count.
*
* @error CAttributeList == NULL.
*/
public native int GetAttributesCount();
/**
* Gets the attribute by index.
*
* @return Returns the pointer in CEconItemAttribute.
*
* @error CAttributeList == NULL.
*/
public native CEconItemAttribute GetAttribute(int iIndex);
/**
* Gets the attribute by definition index.
*
* @param iDefIndex Attribute definition index.
*
* @return Returns the pointer in CEconItemAttribute.
*
* @error CAttributeList == NULL.
*/
public native CEconItemAttribute GetAttributeByDefIndex(int iDefIndex);
/**
* Removes the attribute by index.
*
* @param Attribute index in list.
*
* @noreturn
*
* @error CAttributeList == NULL.
*/
public native void RemoveAttribute(int iIndex);
/**
* Removes the attribute by definition index.
*
* @param iDefIndex Attribute definition index.
*
* @noreturn
*
* @error CAttributeList == NULL.
*/
public native void RemoveAttributeByDefIndex(int iDefIndex);
/**
* Sets ot adds the attribute value by definition index.
*
* @param iDefIndex Attribute definition index.
* @param Value Attribute value.
*
* @noreturn
*
* @error CAttributeList == NULL.
*/
public native void SetOrAddAttributeValue(int iDefIndex, any Value);
};
methodmap CEconItemView // < Address
{
// CEconItemView is not Handle, CloseHandle() - NOT NEEDED !!!!!!!!!!!!!!!!!!!!!
// Always check, if not wounded CEconItemView - NULL ( if(pItemView) ) !!!!!!!!!!!!!!!!!!!!!
// If a player will left from a server after function call to obtain CEconItemView (PTaH_GetEconItemViewFromEconEntity this applies if iEntity will be destroyed). You get crash server!!!!!!!!!!!!!!!!!!!!!
/**
* Gets the index of skin.
*
* @return Returns PaintKit index.
*
* @error CEconItemView == NULL.
*/
public native int GetCustomPaintKitIndex();
/**
* Gets the displacement of skin.
*
* @return Returns PaintKit seed.
*
* @error CEconItemView == NULL.
*/
public native int GetCustomPaintKitSeed();
/**
* Gets the quality of skins.
*
* @param fDef Default value if PaintKit is not found.
*
* @return Returns PaintKit wear.
*
* @error CEconItemView == NULL.
*/
public native float GetCustomPaintKitWear(float flDef = -1.0);
/**
* Gets the sticker index by slot.
*
* @param iSlot Sticker slot index.
* @param ESAT Sticker attribute type.
* @param Def Default value if sticker is not found.
*
* @return Returns the attribute value.
*
* @error CEconItemView == NULL.
*/
public native any GetStickerAttributeBySlotIndex(int iSlot, EStickerAttributeType ESAT, any Def = 0);
/**
* Gets is it possible to exchange weapons.
*
* @return Returns is tradable.
*
* @error CEconItemView == NULL.
*/
public native bool IsTradable();
/**
* Gets is it possible to sell weapons on http://steamcommunity.com/market/.
*
* @return Returns Marketable.
*
* @error CEconItemView == NULL.
*/
public native bool IsMarketable();
/**
* Gets CEconItemDefinition.
*
* @return Returns the pointer in CEconItemDefinition.
*
* @error CEconItemView == NULL.
*/
public native CEconItemDefinition GetItemDefinition();
/**
* Gets AccountID owner of ItemView.
*
* @return Returns AccountID.
*
* @error CEconItemView == NULL.
*/
public native int GetAccountID();
/**
* Gets ItemID of ItemView.
*
* @param iItemID Where will it be recorded ItemID.
*
* @noreturn
*
* @error CEconItemView == NULL.
*/
public native void GetItemID(int iItemID[2]);
/**
* Gets the owner of ItemView.
*
* @return Returns the client index or -1 is not found.
*
* @error CEconItemView == NULL.
*/
public int GetClientIndex()
{
int iAccountID = this.GetAccountID();
for(int i = MaxClients + 1; --i;)
{
if(IsClientAuthorized(i) && iAccountID == GetSteamAccountID(i))
{
return i;
}
}
return -1;
}
/**
* Gets is custom of ItemView.
*
* @return Returns is custom.
*
* @error CEconItemView == NULL.
*/
public bool IsCustomItemView()
{
int iAccountID = this.GetAccountID();
return iAccountID != 0 && iAccountID != -1;
}
/**
* Gets EconItem quality.
*
* @return Returns the quality.
*
* @error CEconItemView == NULL.
*/
public native EEconItemQuality GetQuality();
/**
* Gets EconItem rarity.
*
* @return Returns the rarity.
*
* @error CEconItemView == NULL.
*/
public native eEconItemRarity GetRarity();
/**
* Gets EconItem flags.
*
* @return Returns the flags.
*
* @error CEconItemView == NULL.
*/
public native eEconItemFlags GetFlags();
/**
* Gets EconItem origin.
*
* @return Returns the origin.
*
* @error CEconItemView == NULL.
*/
public native eEconItemOrigin GetOrigin();
/**
* Gets the nametag on skin.
*
* @param sBuffer Destination string buffer.
* @param iLen Maximum length of output string buffer.
*
* @return Returns the nametag length.
*
* @error CEconItemView == NULL.
*/
public native int GetCustomName(char[] sBuffer, int iLen);
/**
* Gets the amount StatTrak.
*
* @return Returns the amount StatTrak.
* If -1, StatTrak attribute is not found.
*
* @error CEconItemView == NULL.
*/
public native int GetStatTrakKill();
/**
* Gets the attribute value by index.
*
* @param iAttribIndex Attribute definition index.
* @param Value Variable to store value.
*
* @return Returns is attribute exist.
*
* @error CEconItemView == NULL or iAttribIndex invalid.
*/
public native bool GetAttributeValueByIndex(int iAttribIndex, any &Value);
// Returns the attribute list with static attributes.
property CAttributeList AttributeList
{
public native get();
}
// Returns the attribute list with dynamic attributes.
property CAttributeList NetworkedDynamicAttributesForDemos
{
public native get();
}
};
methodmap CCSPlayerInventory // < Address
{
// CCSPlayerInventory is not Handle, CloseHandle() - NOT NEEDED !!!!!!!!!!!!!!!!!!!!!
// Always check, if not wounded CCSPlayerInventory - NULL ( if(pPlayerInventory) ) !!!!!!!!!!!!!!!!!!!!!
/**
* Gets CEconItemView in LoadoutSlot.
*
* @param iTeamIndex Team index.
* @param iLoadoutSlot Loadout slot index.
*
* @return Returns the pointer in CEconItemView.
*
* @error CCSPlayerInventory == NULL or team index is invalid.
*/
public native CEconItemView GetItemInLoadout(int iTeam, int iLoadoutSlot);
/**
* Gets the custom items count in inventory.
*
* @return Returns the items count.
*
* @error CCSPlayerInventory == NULL.
*/
public native int GetItemsCount();
/**
* Gets CEconItemView in inventory by index.
*
* @param iPos Item position in inventory.
*
* @return Returns the pointer in CEconItemView.
*
* @error CCSPlayerInventory == NULL.
*/
public native CEconItemView GetItem(int iPos);
};
typeset PTaHCB
{
/** GiveNamedItemPre
*
* Called before the issuance of the item.
*
* @param iClient Client index.
* @param sClassname Weapon classname.
* @param pItemView Customization item.
* @param bIgnoredView Is ignores CEconItemView the item.
* @param bOriginNULL Origin is unspecified.
* @param vecOrigin Coordinates where the item was created.
* You cannot compare vecOrigin == NULL_VECTOR, use bOriginNULL param for it.
*
* @return Return Plugin_Stop or Plugin_Handled for stop granting item.
* Return Plugin_Continue for allow issuance item without changes.
* Return Plugin_Changed for allow issuance item with changes.
*/
function Action (int iClient, char sClassname[64], CEconItemView &pItemView, bool &bIgnoredView, bool &bOriginNULL, float vecOrigin[3]);
/** GiveNamedItemPost
*
* It called when a player receives a item.
*
* @param iClient Client index.
* @param sClassname Weapon classname.
* @param pItemView Customization item.
* @param iEntity Entity index. -1 if invalid item.
* @param bOriginNULL Origin is unspecified.
* @param vecOrigin Coordinates where the item was created.
*
* @noreturn
*/
function void (int iClient, const char[] sClassname, const CEconItemView pItemView, int iEntity, bool bOriginNULL, const float vecOrigin[3]);
/** WeaponCanUsePre
*
* Called when a player is trying to pickup the item.
*
* @param iClient Client index.
* @param iEntity Entity index.
* @param bCanUs Is can be picked up.
*
* @return Return Plugin_Stop or Plugin_Handled to forbid lifting.
* Return Plugin_Continue to leave unchanged.
* Return Plugin_Changed to apply the changes specified in bCanUse.
*/
function Action (int iClient, int iEntity, bool &bCanUse);
/** WeaponCanUsePost
*
* Called when a player attempted to pick up an item.
*
* @param iClient Client index.
* @param iEntity Entity index.
* @param bCanUs Is can be picked up.
*
* @noreturn
*/
function void (int iClient, int iEntity, bool bCanUse);
/** SetPlayerModelPre
*
* Called before changing the player model.
*
* @param iClient Client index.
* @param sModel Path to the player model.
* @param sNewModel Path to a new model for change.
*
* @return Return Plugin_Stop or Plugin_Handled stop changing models.
* Return Plugin_Continue for allow change model without changes.
* Return Plugin_Changed for allow the change to the modified model.
*/
function Action (int iClient, const char[] sModel, char sNewModel[256]);
/** SetPlayerModelPost
*
* Called after the change of the player model.
*
* @param iClient Client index.
* @param sModel Path to the player model.
*
* @noreturn
*/
function void (int iClient, const char[] sModel);
/** ClientVoiceToPre
*
* Called when a player tries to speak.
*
* @param iClient Client index.
* @param iTarget Player target Index.
* @param bListen Can iTarget hear iClient.
*
* @return Return Plugin_Stop or Plugin_Handled so that iTarget does not hear iClient.
* Return Plugin_Continue to leave unchanged. Return Plugin_Changed to apply the changes specified in bListen.
*/
function Action (int iClient, int iTarget, bool &bListen);
/** ClientVoiceToPost
*
* Called after the player tried to speak.
*
* @param iClient Client index.
* @param iTarget Player target Index.
* @param bListen Can iTarget hear iClient.
*
* @noreturn
*/
function void (int iClient, int iTarget, bool bListen);
/** ConsolePrintPre
*
* Called before displaying messages to the player console.
*
* @param iClient Client index.
* @param sMessage Text message.
*
* @return Return Plugin_Stop or Plugin_Handled for restrict display message.
* Return Plugin_Continue for allow the display message without changes.
* Return Plugin_Changed for allow display changed message.
*
*/
function Action (int iClient, char sMessage[1024]);
/** ConsolePrintPost
*
* Called after displaying messages to the player console.
*
* @param iClient Client index.
* @param sMessage Message text.
*
* @noreturn
*/
function void (int iClient, const char[] sMessage);
/** ExecuteStringCommandPre
*
* Called before executing the player command of the team on the server.
*
* @param iClient Client index.
* @param sCommand Execute command.
*
* @return Return Plugin_Stop or Plugin_Handled for restrict execution.
* Return Plugin_Continue for allow execution without changes.
* Return Plugin_Changed for allow execution with changes.
*/
function Action (int iClient, char sCommand[512]);
/** ExecuteStringCommandPost
*
* Called after executing the player command of the server.
*
* @param iClient Client index.
* @param sCommand Execute command.
*
* @noreturn
*/
function void (int iClient, const char[] sCommand);
/** ClientConnectPre
*
* Called before the authorization of the client to the server.
*
* @param iAccountID Client Steam account ID.
* @param sIP Client IP address.
* @param sName Client nickname.
* @param sPassword Password witch he introduced.
* @param sRejectReason The reason is not authorized.
*
* @return Return Plugin_Stop or Plugin_Handled for restrict autherization client.
* Return Plugin_Continue for allow autherization without changes.
* Return Plugin_Changed for allow autherization with changes.
*/
function Action (int iAccountID, const char[] sIP, const char[] sName, char sPassword[128], char sRejectReason[255]);
/** ClientConnectPost
*
* Called after the authorization of the client to the server.
*
* @param iClient Client index.
* @param iAccountID Client Steam account ID.
* @param sIP Client IP address.
* @param sName Client nickname.
*
* @noreturn
*/
function void (int iClient, int iAccountID, const char[] sIP, const char[] sName);
/** InventoryUpdatePost
*
* Called after action in the player inventory.
*
* @param iClient Client index.
* @param pInventory Pointer in CCSPlayerInventory.
*
* @noreturn
*/
function void (int iClient, CCSPlayerInventory pInventory);
};
/**
* Gets PTaH Version.
*
* @param sBuffer Destination string buffer.
* @param iLen Maximum length of output string buffer..
*
* @return Return PTaH int Version. Example: 108 if sBuffer = "1.0.8".
*/
native int PTaH_Version(char[] sBuffer = NULL_STRING, int iLen = 0);
/**
* Enables Hook.
*
* @param EventType Event type.
* @param HookType Hook/Unhook.
* @param Callback Callback.
*
* @return Is hook successful.
*
* @error Invalid PTaH_HookEvent type.
*/
native bool PTaH(PTaH_HookEvent EventType, PTaH_HookType HookType, PTaHCB Callback);
/**
* Gets CEconItemDefinition by definition name.
*
* @param sDefName Item definition name.
*
* @return Returns pointer in CEconItemDefinition.
*/
native CEconItemDefinition PTaH_GetItemDefinitionByName(const char[] sDefName);
/**
* Gets CEconItemDefinition by definition index.
*
* @param iDefIndex Definition index.
*
* @return Returns CEconItemDefinition.
*/
native CEconItemDefinition PTaH_GetItemDefinitionByDefIndex(int iDefIndex);
/**
* Gets CEconItemAttributeDefinition by definition name.
*
* @param sDefName Attribute definition name.
*
* @return Returns CEconItemAttributeDefinition.
*/
native CEconItemAttributeDefinition PTaH_GetAttributeDefinitionByName(const char[] sDefName);
/**
* Gets CEconItemAttributeDefinition by definition index.
*
* @param iDefIndex Attribute definition index.
*
* @return Returns CEconItemAttributeDefinition.
*/
native CEconItemAttributeDefinition PTaH_GetAttributeDefinitionByDefIndex(int iDefIndex);
/**
* Gets CEconItemView from entity with type DT_EconEntity.
*
* @param iEntity Entity index.
*
* @return Returns pointer in CEconItemView.
*
* @error Invalid entity or entity type DT_EconEntity is not found.
*/
native CEconItemView PTaH_GetEconItemViewFromEconEntity(int iEntity);
/**
* Gets CCSPlayerInventory of Player.
*
* @note Use event hook "player_spawn" for get an early
* stage of loading Shared Data in the inventory
*
* @param iClient Client index.
*
* @return Returns pointer in CCSPlayerInventory.
*
* @error Invalid client index.
*/
native CCSPlayerInventory PTaH_GetPlayerInventory(int iClient);
/**
* It gives the player item with the specified CEconItemView.
*
* @param iClient Client index.
* @param sClassname Item classname.
* @param pItemView Customization item.
* @param vecOrigin Coordinates the item will be created at, or NULL_VECTOR.
*
* @return Return entity index.
*
* @error Invalid client index.
*/
native int PTaH_GivePlayerItem(int iClient, const char[] sClassname, CEconItemView pItemView = CEconItemView_NULL, const float vecOrigin[3] = NULL_VECTOR);
/**
* Sends to player a full update packet.
*
* @param iClient Client index.
*
* @noreturn
*
* @error Invalid client index, or client is fake.
*/
native void PTaH_ForceFullUpdate(int iClient);
/**
* Spawn item by a definition index at the coordionates.
*
* @param iDefIndex Definition index.
* @param vecOrigin Coordinates the item will be created at.
* @param flAngles Angles the item will be created at.
*
* @return Return index item.
*
* @error vecOrigin == NULL_VECTOR or invalid definition index.
*/
native int PTaH_SpawnItemFromDefIndex(int iDefIndex, const float vecOrigin[3], const float flAngles[3] = {0.0, 0.0, 0.0});
/**
* Emulate bullet shot on the server and does the damage calculations.
*
* @param iClient Client index.
* @param pItemView Customization item.