Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Global variables
- new bool:projectiletype[2048];
- // Will hold the custom weapon's model path passed from the weapon's configuration file.
- new String:projectilename[2048][250];
- public Action:CustomWeaponsTF_OnAddAttribute(iWeapon, iClient, const String:attrib[], const String:plugin[], const String:value[])
- {
- if(!StrEqual(plugin, "bill")) return Plugin_Continue;
- new Action:action;
- ... // Other attributes
- ... // Other attributes
- else if(StrEqual(attrib, "projectile test"))
- {
- projectiletype[iClient] = true;
- Format(projectilename[iClient], 250, value);
- action = Plugin_Handled;
- }
- ... // Other attributes
- ... // Other attributes
- if(!HasAttribute[iWeapon]) HasAttribute[iWeapon] = bool:action;
- return action;
- }
- public OnEntityCreated(iEntity, const String:strClassname[])
- {
- if (!IsValidEntity(iEntity)) return;
- if(IsValidEntity(iEntity) && StrEqual(strClassname, "tf_projectile_pipe"))
- {
- SDKHook(iEntity, SDKHook_SpawnPost, TF_PROJECTILE_PIPE);
- }
- }
- public TF_PROJECTILE_PIPE(entity)
- {
- // Checks if the player has the attribute
- if(projectiletype[GetOwnerPipe(entity)])
- {
- // "here" is just for debug
- PrintToChatAll("here");
- SetEntityModel(entity,projectilename[GetOwnerPipe(entity)]);
- }
- }
- // Retrieves the owner of the projectile
- stock GetOwnerPipe(iEntity){
- if(projectiletype[GetEntPropEnt(iEntity, Prop_Data, "m_hOwnerEntity")]){
- return GetEntPropEnt(iEntity, Prop_Data, "m_hOwnerEntity");
- }
- return false;
- }
- public OnEntityDestroyed(Ent)
- {
- if(Ent <= 0 || Ent > 2048) return;
- projectiletype[Ent] = false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement