AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [L4D2] Model name to Item name (https://forums.alliedmods.net/showthread.php?t=346766)

kahdeg 03-16-2024 06:57

[L4D2] Model name to Item name
 
Hi, i was trying to make a simple pinging plugins.
Here is my code that do the pointing and getting the pointed at Entity:
PHP Code:

    int iEntAtEndPos;
    
iEntAtEndPos GetClientAimTarget(clientfalse);
    if(
iEntAtEndPos != -1){
        
char sEntAtEndPosName2[128];
        
GetEntPropString(iEntAtEndPosProp_Data"m_ModelName"sEntAtEndPosName2128 );
        
PrintToChat(client"test %d %s"iEntAtEndPossEntAtEndPosName2);
    } 

the output is:
Code:

test 3 models/survivors/survivor_mechanic.mdl
test 687 models/w_models/weapons/w_pistol_B.mdl
test 608 models/weapons/melee/w_fireaxe.mdl
test 608 models/weapons/melee/w_fireaxe.mdl
test 2 models/survivors/survivor_producer.mdl
test 3 models/survivors/survivor_mechanic.mdl
test 686 models/w_models/weapons/w_eq_Medkit.mdl
test 608 models/weapons/melee/w_fireaxe.mdl
test 609 models/weapons/melee/w_fireaxe.mdl
test 687 models/w_models/weapons/w_pistol_B.mdl
test 781 models/weapons/melee/w_crowbar.mdl
test 4 models/survivors/survivor_coach.mdl
test 415 models/props_urban/plastic_chair001.mdl

I want to map and filter only stuff like weapon and medkit, pill, ... things that player can pickup.
Is there a list of model or some standard function that do that?

little_froy 03-16-2024 08:24

Re: [L4D2] Model name to Item name
 
why don't you use classname? https://sm.alliedmods.net/new-api/en...ntityClassname

Marttt 03-17-2024 09:09

Re: [L4D2] Model name to Item name
 
Check plugin and CreateStringMap https://github.com/fbef0102/L4D2-Plu...2_item_hint.sp


All times are GMT -4. The time now is 23:25.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.