Kewn
Дата: Среда, 20.02.2019, 11:30:33 | Сообщение # 1
Сообщений: 2
Репутация: 0 [ +/- ]
Всем привет) Ребят помогите решить проблему) Визуально работает а на деле нет Line 284, C:\Zombie Reloaded\cstrike\addons\sourcemod\scripting\smoke.sp::Timer_CheckDamage() L 02/20/2019 - 12:16:27: [SM] Native "SDKHooks_TakeDamage" reported: SDKHooks_TakeDamage is not supported on this engine. вот скрипт
#pragma semicolon 1 #include <sourcemod> #include <sdktools> #include <sdkhooks> #include <zombiereloaded> #define SLOW_SMOKE_EFFECT "models/props/slow/smoke_effect/slow_smoke_effect.mdl" public Plugin:myinfo = { name = "ZR Poison Nade", author = "POMKA", description = "Poison Nade for Zombie mod", version = "1.0", url = "http://IbizaGaming.ru/" }; new Handle:g_hSmokeGrenades; new Handle:g_hCVSeconds, Handle:g_hCVDamage, Handle:g_hCVSmokeTime, Handle:g_hCVEnable, Handle:g_hCVDistance; new bool:g_bEnable; public OnPluginStart() { g_hCVEnable = CreateConVar("sm_poisonnade_enable", "1", "1 - enable, 0 - disable plugin", _, true, 0.0, true, 1.0); g_hCVDamage = CreateConVar("sm_poisonnade_damage", "1", "How much damage should we deal to the players in the smoke?", FCVAR_PLUGIN, true, 0.0); g_hCVSeconds = CreateConVar("sm_poisonname_seconds", "1", "Deal damage every x seconds.", FCVAR_PLUGIN, true, 1.0); g_hCVSmokeTime = CreateConVar("sm_poisonnade_smoketime", "25", "Smoke time in seconds"); g_hCVDistance = CreateConVar("sm_poisonname_distance", "220", "Distance of take damage"); g_bEnable = GetConVarBool(g_hCVEnable); HookConVarChange(g_hCVEnable, OnConVarChange); g_hSmokeGrenades = CreateArray(); HookEvent("player_death", Event_PlayerDeath, EventHookMode_Pre); HookEvent("round_start", Event_RoundStart); AutoExecConfig(true, "zr_poison_nade"); } public OnMapStart() { AddFileToDownloadsTable(SLOW_SMOKE_EFFECT); AddFileToDownloadsTable("models/props/slow/smoke_effect/slow_smoke_effect.vvd"); AddFileToDownloadsTable("models/props/slow/smoke_effect/slow_smoke_effect.dx80.vtx"); AddFileToDownloadsTable("models/props/slow/smoke_effect/slow_smoke_effect.dx90.vtx"); AddFileToDownloadsTable("models/props/slow/smoke_effect/slow_smoke_effect.sw.vtx"); AddFileToDownloadsTable("models/props/slow/smoke_effect/slow_smoke_effect.xbox.vtx"); AddFileToDownloadsTable("materials/models/props/slow/smoke_effect/slow_smoke_effect.vmt"); AddFileToDownloadsTable("materials/models/props/slow/smoke_effect/slow_smoke_effect.vtf"); AddFileToDownloadsTable("materials/models/props/slow/smoke_effect/slow_smoke_effect_2.vmt"); AddFileToDownloadsTable("materials/models/props/slow/smoke_effect/slow_smoke_effect_2.vtf"); PrecacheModel(SLOW_SMOKE_EFFECT, false); } public OnMapEnd() { if(!g_bEnable) return; new iSize = GetArraySize(g_hSmokeGrenades); new Handle:hGrenade, Handle:hTimer; for(new i=0; i<iSize; i++) { hGrenade = GetArrayCell(g_hSmokeGrenades, i); if(GetArraySize(hGrenade) > 3) { hTimer = GetArrayCell(hGrenade, 3); KillTimer(hTimer); hTimer = GetArrayCell(hGrenade, 4); if(hTimer != INVALID_HANDLE) KillTimer(hTimer); } CloseHandle(hGrenade); } ClearArray(g_hSmokeGrenades); } public OnConVarChange(Handle:convar, const String:oldValue[], const String:newValue[]) { if(convar == g_hCVEnable) g_bEnable = GetConVarBool(g_hCVEnable); } public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast) { if(!g_bEnable) return; new iSize = GetArraySize(g_hSmokeGrenades); new Handle:hGrenade, Handle:hTimer; for(new i=0; i<iSize; i++) { hGrenade = GetArrayCell(g_hSmokeGrenades, i); if(GetArraySize(hGrenade) > 3) { hTimer = GetArrayCell(hGrenade, 3); KillTimer(hTimer); hTimer = GetArrayCell(hGrenade, 4); if(hTimer != INVALID_HANDLE) KillTimer(hTimer); } CloseHandle(hGrenade); } ClearArray(g_hSmokeGrenades); } public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) { if(!g_bEnable) return Plugin_Continue; decl String:sWeapon[64]; GetEventString(event, "weapon", sWeapon, sizeof(sWeapon)); if(StrEqual(sWeapon, "env_smokestack")) { SetEventString(event, "weapon", "flashbang"); } return Plugin_Continue; } public OnEntityCreated(entity, const String:classname[]) { if(StrEqual(classname, "smokegrenade_projectile", false)) SDKHook(entity, SDKHook_Spawn, Hook_OnSpawnProjectile); if(StrEqual(classname, "env_particlesmokegrenade", false)) SDKHook(entity, SDKHook_Spawn, Hook_OnSpawnParticles); } public Hook_OnSpawnProjectile(entity) { if(!g_bEnable) return; new client = GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity"); if(!IsClientInGame(client)) return; new Handle:hGrenade = CreateArray(); PushArrayCell(hGrenade, client); PushArrayCell(hGrenade, entity); PushArrayCell(g_hSmokeGrenades, hGrenade); } public Hook_OnSpawnParticles(entity) { if(!g_bEnable) return; new Float:fOrigin[3], Float:fOriginSmoke[3]; GetEntPropVector(entity, Prop_Send, "m_vecOrigin", fOrigin); new iSize = GetArraySize(g_hSmokeGrenades); new Handle:hGrenade, iGrenade; for(new i = 0; i < iSize; i++) { hGrenade = GetArrayCell(g_hSmokeGrenades, i); iGrenade = GetArrayCell(hGrenade, 1); GetEntPropVector(iGrenade, Prop_Send, "m_vecOrigin", fOriginSmoke); if(fOrigin[0] == fOriginSmoke[0] && fOrigin[1] == fOriginSmoke[1] && fOrigin[2] == fOriginSmoke[2]) { AcceptEntityInput(entity, "Kill"); new SmokeEntity = CreateEntityByName("env_smokestack"); DispatchKeyValue(SmokeEntity, "SmokeMaterial", "particle/particle_smokegrenade.vmt"); DispatchKeyValue(SmokeEntity, "basespread", "30"); DispatchKeyValue(SmokeEntity, "spreadspeed", "5"); DispatchKeyValue(SmokeEntity, "speed", "5"); DispatchKeyValue(SmokeEntity, "startsize", "100"); DispatchKeyValue(SmokeEntity, "endsize", "100"); DispatchKeyValue(SmokeEntity, "rate", "5"); DispatchKeyValue(SmokeEntity, "jetlength", "30"); DispatchKeyValue(SmokeEntity, "renderamt", "200"); DispatchKeyValue(SmokeEntity, "Translucency", "150"); DispatchKeyValue(SmokeEntity, "rendercolor", "124 252 0"); DispatchSpawn(SmokeEntity); TeleportEntity(SmokeEntity, fOrigin, NULL_VECTOR, NULL_VECTOR); AcceptEntityInput(SmokeEntity, "TurnOn"); PushArrayCell(hGrenade, SmokeEntity); new Handle:hTimer = CreateTimer(GetConVarFloat(g_hCVSmokeTime), Timer_RemoveSmoke, SmokeEntity, TIMER_FLAG_NO_MAPCHANGE); PushArrayCell(hGrenade, hTimer); new Handle:hTimer2 = INVALID_HANDLE; hTimer2 = CreateTimer(GetConVarFloat(g_hCVSeconds), Timer_CheckDamage, EntIndexToEntRef(SmokeEntity), TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT); PushArrayCell(hGrenade, hTimer2); new slow_smoke_effect_ent = CreateEntityByName("prop_dynamic"); DispatchKeyValueVector(slow_smoke_effect_ent, "origin", fOrigin); DispatchKeyValue(slow_smoke_effect_ent, "model", SLOW_SMOKE_EFFECT); AcceptEntityInput(slow_smoke_effect_ent, "DisableCollision"); DispatchSpawn(slow_smoke_effect_ent); SetEntityMoveType(slow_smoke_effect_ent, MOVETYPE_NONE); TeleportEntity(slow_smoke_effect_ent, fOrigin, NULL_VECTOR, NULL_VECTOR); PushArrayCell(hGrenade, slow_smoke_effect_ent); break; } } } public Action:Timer_RemoveSmoke(Handle:timer, any:entity) { new iSize = GetArraySize(g_hSmokeGrenades); new Handle:hGrenade, iGrenade = -1; for(new i=0; i<iSize; i++) { hGrenade = GetArrayCell(g_hSmokeGrenades, i); if(GetArraySize(hGrenade) > 3) { iGrenade = GetArrayCell(hGrenade, 2); if(iGrenade == entity) { AcceptEntityInput(entity, "TurnOff"); AcceptEntityInput(entity, "Kill"); new Handle:hTimer = GetArrayCell(hGrenade, 4); if(hTimer != INVALID_HANDLE) KillTimer(hTimer); new slow_smoke_effect_ent = GetArrayCell(hGrenade, 5); if(IsValidEdict(slow_smoke_effect_ent)) AcceptEntityInput(slow_smoke_effect_ent, "Kill"); RemoveFromArray(g_hSmokeGrenades, i); break; } } } return Plugin_Stop; } public Action:Timer_CheckDamage(Handle:timer, any:entityref) { new entity = EntRefToEntIndex(entityref); if(entity == INVALID_ENT_REFERENCE) return Plugin_Continue; new iSize = GetArraySize(g_hSmokeGrenades); new Handle:hGrenade, iGrenade = -1; for(new i=0; i<iSize; i++) { hGrenade = GetArrayCell(g_hSmokeGrenades, i); if(GetArraySize(hGrenade) > 3) { iGrenade = GetArrayCell(hGrenade, 2); if(iGrenade == entity) break; } } if(iGrenade == -1) return Plugin_Continue; new client = GetArrayCell(hGrenade, 0); if(!client || !IsClientInGame(client) || !IsPlayerAlive(client)) return Plugin_Continue; if(ZR_IsClientZombie(client)) { RemoveSmoke(entity); return Plugin_Continue; } new Float:fSmokeOrigin[3], Float:fOrigin[3]; GetEntPropVector(iGrenade, Prop_Send, "m_vecOrigin", fSmokeOrigin); for(new i=1;i<=MaxClients;i++) { if(IsClientInGame(i) && IsPlayerAlive(i) && ZR_IsClientZombie(i)) { GetClientAbsOrigin(i, fOrigin); if(GetVectorDistance(fSmokeOrigin, fOrigin) <= GetConVarInt(g_hCVDistance)) SDKHooks_TakeDamage(i, iGrenade, client, GetConVarFloat(g_hCVDamage), DMG_POISON, -1, NULL_VECTOR, fSmokeOrigin); } } return Plugin_Continue; } RemoveSmoke(entity) { new iSize = GetArraySize(g_hSmokeGrenades); new Handle:hGrenade, iGrenade = -1; for(new i=0; i<iSize; i++) { hGrenade = GetArrayCell(g_hSmokeGrenades, i); if(GetArraySize(hGrenade) > 3) { iGrenade = GetArrayCell(hGrenade, 2); if(iGrenade == entity) { AcceptEntityInput(entity, "TurnOff"); AcceptEntityInput(entity, "Kill"); new Handle:hTimer = GetArrayCell(hGrenade, 4); if(hTimer != INVALID_HANDLE) KillTimer(hTimer); new slow_smoke_effect_ent = GetArrayCell(hGrenade, 5); if(IsValidEdict(slow_smoke_effect_ent)) AcceptEntityInput(slow_smoke_effect_ent, "Kill"); RemoveFromArray(g_hSmokeGrenades, i); break; } } } }