Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #include <sdkhooks>
- #include <cstrike>
- #tryinclude <shop>
- public Plugin:myinfo =
- {
- name = "[CS:GO] Vanoce na http://popfrag.eu",
- author = "Despi",
- description = "Vánoce jsou svátek",
- version = "1.0 beta",
- url = "https://www.popfrag.eu"
- }
- static const String: sDownloadTable[][] =
- {
- "models/logandougall/cel/cel_xmas_snowball_16.dx80.vtx",
- "models/logandougall/cel/cel_xmas_snowball_16.dx90.vtx",
- "models/logandougall/cel/cel_xmas_snowball_16.mdl",
- "models/logandougall/cel/cel_xmas_snowball_16.phy",
- "models/logandougall/cel/cel_xmas_snowball_16.sw.vtx",
- "models/logandougall/cel/cel_xmas_snowball_16.vvd",
- "materials/models/logandougall/cel/snow.vmt",
- "materials/models/logandougall/cel/snow.vtf",
- "models/models_kit/xmas/xmastree.dx80.vtx",
- "models/models_kit/xmas/xmastree.dx90.vtx",
- "models/models_kit/xmas/xmastree.mdl",
- "models/models_kit/xmas/xmastree.phy",
- "models/models_kit/xmas/xmastree.sw.vtx",
- "models/models_kit/xmas/xmastree.vvd",
- "models/models_kit/xmas/xmastree.xbox.vtx",
- "models/logandougall/cel/cel_xmas_snowman.dx80.vtx",
- "models/logandougall/cel/cel_xmas_snowman.dx90.vtx",
- "models/logandougall/cel/cel_xmas_snowman.mdl",
- "models/logandougall/cel/cel_xmas_snowman.phy",
- "models/logandougall/cel/cel_xmas_snowman.sw.vtx",
- "models/logandougall/cel/cel_xmas_snowman.vvd",
- "materials/models/logandougall/cel/carrot.vtf",
- "materials/models/logandougall/cel/carrot.vmt",
- "materials/models/logandougall/cel/toolsblack.vmt",
- "materials/models/logandougall/cel/bark.vmt",
- "materials/models/logandougall/cel/bark.vtf",
- "materials/models/logandougall/cel/snow.vmt",
- "materials/models/logandougall/cel/snow.vtf",
- "models/models_kit/xmas/giftbox_mini_quad.dx80.vtx",
- "models/models_kit/xmas/giftbox_mini_quad.dx90.vtx",
- "models/models_kit/xmas/giftbox_mini_quad.mdl",
- "models/models_kit/xmas/giftbox_mini_quad.phy",
- "models/models_kit/xmas/giftbox_mini_quad.sw.vtx",
- "models/models_kit/xmas/giftbox_mini_quad.vvd",
- "models/models_kit/xmas/giftbox_mini_quad.xbox.vtx",
- "materials/models/models_kit/xmas/giftbox.vmt",
- "materials/models/models_kit/xmas/giftbox.vtf",
- "models/models_kit/xmas/xmastree_mini.dx80.vtx",
- "models/models_kit/xmas/xmastree_mini.dx90.vtx",
- "models/models_kit/xmas/xmastree_mini.mdl",
- "models/models_kit/xmas/xmastree_mini.phy",
- "models/models_kit/xmas/xmastree_mini.sw.vtx",
- "models/models_kit/xmas/xmastree_mini.vvd",
- "models/models_kit/xmas/xmastree_mini.xbox.vtx",
- "materials/models/models_kit/xmas/xmastree_miscA.vmt",
- "materials/models/models_kit/xmas/xmastree_miscA.vtf",
- "materials/models/models_kit/xmas/xmastree_miscA_skin2.vmt",
- "materials/models/models_kit/xmas/xmastree_miscA_skin2.vtf",
- "materials/models/models_kit/xmas/xmastree_miscB.vmt",
- "materials/models/models_kit/xmas/xmastree_miscB.vtf",
- "materials/models/models_kit/xmas/xmastree_miscB_skin2.vmt",
- "materials/models/models_kit/xmas/xmastree_miscB_skin2.vtf",
- "materials/models/models_kit/xmas/xmastree_miscB_spec.vtf"
- }
- static const String: g_sGrens[][] =
- {
- "weapon_hegrenade",
- "weapon_flashbang",
- "weapon_smokegrenade"
- };
- static const String: g_sGrens_text[][] =
- {
- "výbušný granát",
- "oslepující granát",
- "smoke granát"
- };
- static const String: sApt_text[][] =
- {
- "malou lékarníčku",
- "lékárnička",
- "velká lékárnička"
- };
- static const sAptMin[] = { 5, 10, 25};
- static const sAptMax[] = {10, 20, 50};
- new m_iHealth;
- new m_fSpeed;
- new m_iAccount;
- new bool:g_bActive, g_iAnswer, String:g_sFile[64], g_iAvailableSnow[64];
- public OnPluginStart()
- {
- HookEvent("player_death", Event_PlayerDeath);
- HookEvent("round_start", Event_RoundStart);
- m_iAccount = UTIL_FindSendPropOffs("CCSPlayer", "m_iAccount");
- m_iHealth = UTIL_FindSendPropOffs("CCSPlayer", "m_iHealth");
- m_fSpeed = UTIL_FindSendPropOffs("CCSPlayer", "m_flLaggedMovementValue");
- RegAdminCmd("sm_gift", GiftMe, ADMFLAG_ROOT);
- RegAdminCmd("sm_tree", CreateTree, ADMFLAG_ROOT);
- RegAdminCmd("sm_del", DeleteTree, ADMFLAG_ROOT);
- RegAdminCmd("sm_snowman", CreateSnowman, ADMFLAG_ROOT);
- RegAdminCmd("sm_large", CreateLarge, ADMFLAG_ROOT);
- RegConsoleCmd("sm_snow", Snow);
- CreateTimer(60.0, Question, _, TIMER_REPEAT);
- }
- public OnMapStart()
- {
- for(new i; i < sizeof(sDownloadTable); i++)
- {
- AddFileToDownloadsTable(sDownloadTable[i]);
- }
- PrecacheModel("sprites/glow01.spr", true);
- PrecacheModel("models/models_kit/xmas/giftbox_mini_quad.mdl", true);
- PrecacheModel("models/models_kit/xmas/xmastree_mini.mdl", true);
- PrecacheModel("models/logandougall/cel/cel_xmas_snowman.mdl", true);
- PrecacheModel("models/models_kit/xmas/xmas_teddybear.mdl", true);
- PrecacheModel("models/models_kit/xmas/xmastree.mdl", true);
- PrecacheModel("models/logandougall/cel/cel_xmas_snowball_16.mdl", true);
- decl String: g_sCurrentMap[32];
- GetCurrentMap(g_sCurrentMap, sizeof(g_sCurrentMap));
- if(!DirExists("addons/sourcemod/configs/newyear/"))
- {
- CreateDirectory("addons/sourcemod/configs/newyear/", 511);
- }
- FormatEx(g_sFile, sizeof(g_sFile), "addons/sourcemod/configs/newyear/%s.cfg", g_sCurrentMap);
- }
- public OnClientSayCommand_Post(client, const String:command[], const String:sArgs[])
- {
- if(g_bActive && StringToInt(sArgs) == g_iAnswer)
- {
- CreateTimer(1.0, Gift, GetClientUserId(client));
- PrintToChat(client, "\x04Jako první jsi odpověděl na příklad správně! Dáreček byl vytvořen ve tvém blízkém okolí!");
- g_bActive = false;
- }
- }
- public Action:Question(Handle:timer)
- {
- CreateTimer(15.0, Timer_QuestionTimeLeft);
- new a = GetRandomInt(50, 250);
- new b = GetRandomInt(1, 50);
- new op = GetRandomInt(0,1);
- g_bActive = true;
- if (op)
- {
- g_iAnswer = a + b;
- PrintToChatAll("\x04Ježíšek píše\x01: Jaký je výsledek příkladu \x04%i\x01 + \x04%i\x01?", a , b);
- }
- else
- {
- g_iAnswer = a - b;
- PrintToChatAll("\x04Ježíšek píše \x01: Jaký je výsledek příkladu \x04%i\x01 - \x04%i\x01?", a , b);
- }
- return Plugin_Continue;
- }
- public Action:Timer_QuestionTimeLeft(Handle:timer)
- {
- g_bActive = false;
- }
- public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
- {
- new client = GetClientOfUserId(GetEventInt(event, "userid"));
- if (IsClientInGame(client))
- {
- CreateTimer(2.0, Gift, GetClientUserId(client));
- }
- }
- public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
- {
- new Handle:kv = CreateKeyValues("tree");
- if (FileToKeyValues(kv, g_sFile) && KvGotoFirstSubKey(kv))
- {
- decl String:KeyName[50];
- do
- {
- if (KvGetSectionName(kv, KeyName, 50))
- {
- decl Float:g_fOrigin[3], Float:g_fAngles[3], String:type[20];
- KvGetVector(kv, "1", g_fOrigin);
- KvGetVector(kv, "2", g_fAngles);
- KvGetString(kv, "type", type, sizeof(type));
- if (StrEqual(type, "tree") || StrEqual(type, ""))
- {
- SpawnTree(g_fOrigin, g_fAngles);
- new w_color[4] = { 0, 0, 0, 255 };
- decl String: color[20], Float: Ori[3];
- g_fOrigin[2] += 10;
- for (new i = 1; i<= 10; i++)
- {
- for (new q = 0; q < 3; q++) w_color[q] = GetRandomInt(10, 255);
- for (new a = 0; a < 3; a++) Ori[a] = g_fOrigin[a]
- FormatEx(color, sizeof(color), "%i %i %i", w_color[0], w_color[1], w_color[2]);
- new index = CreateEntityByName("env_sprite");
- DispatchKeyValue(index, "rendermode", "5");
- DispatchKeyValue(index, "rendercolor", color);
- DispatchKeyValue(index, "renderamt", "255");
- DispatchKeyValue(index, "scale", "0.6");
- DispatchKeyValue(index, "model", "sprites/glow01.spr");
- DispatchSpawn(index);
- AcceptEntityInput(index, "ShowSprite");
- new Float:crd;
- switch(i)
- {
- case 1: crd = 27.0;
- case 2: crd = -27.0;
- case 3: crd = 22.0;
- case 4: crd = -22.0;
- case 5: crd = 17.0;
- case 6: crd = -17.0;
- case 7: crd = 12.0;
- case 8: crd = -12.0;
- case 9: crd = 7.0;
- case 10: crd = -7.0;
- }
- Ori[2] += 10*i;
- Ori[0] += crd;
- Ori[1] += crd;
- TeleportEntity(index, Ori, g_fAngles, NULL_VECTOR);
- }
- }
- if (StrEqual(type, "snowman"))
- {
- SpawnSnowMan(g_fOrigin, g_fAngles);
- }
- if (StrEqual(type, "large"))
- {
- SpawnLarge(g_fOrigin, g_fAngles);
- }
- }
- }
- while (KvGotoNextKey(kv));
- }
- CloseHandle(kv);
- }
- public Action:Gift(Handle:timer, any:userid)
- {
- new i = GetClientOfUserId(userid);
- if (i && IsClientInGame(i))
- {
- new iEntity = CreateEntityByName("prop_dynamic");
- if (iEntity)
- {
- decl Float:fPos[3], String:clr[20];
- new String:sTargetName[32],
- String:sBufer[70],
- Float:fTime = 30.0;
- GetClientAbsOrigin(i, fPos);
- fPos[0] += 50.0;
- if (!IsPlayerAlive(i))
- {
- fPos[2] -= 40.0;
- }
- Format(sTargetName, sizeof(sTargetName), "xmasgift_%i", iEntity);
- DispatchKeyValueVector(iEntity, "origin", fPos);
- DispatchKeyValue(iEntity, "solid", "6");
- DispatchKeyValue(iEntity, "model", "models/models_kit/xmas/giftbox_mini_quad.mdl");
- DispatchKeyValue(iEntity, "targetname", sTargetName);
- SetVariantString(sTargetName);
- DispatchSpawn(iEntity);
- SetEntProp(iEntity, Prop_Send, "m_usSolidFlags", 8);
- SetEntProp(iEntity, Prop_Send, "m_CollisionGroup", 1);
- Format(sBufer, sizeof(sBufer), "OnUser1 !self:kill::%0.2f:-1", fTime);
- SetVariantString(sBufer);
- AcceptEntityInput(iEntity, "AddOutput");
- AcceptEntityInput(iEntity, "FireUser1");
- new iRotating = CreateEntityByName("func_rotating", -1);
- DispatchKeyValueVector(iRotating, "origin", fPos);
- DispatchKeyValue(iRotating, "targetname", sTargetName);
- DispatchKeyValue(iRotating, "maxspeed", "180");
- DispatchKeyValue(iRotating, "friction", "0");
- DispatchKeyValue(iRotating, "dmg", "0");
- DispatchKeyValue(iRotating, "solid", "0");
- DispatchKeyValue(iRotating, "spawnflags", "64");
- DispatchSpawn(iRotating);
- SetVariantString("!activator");
- AcceptEntityInput(iEntity, "SetParent", iRotating, iRotating);
- AcceptEntityInput(iRotating, "Start", -1, -1);
- SetEntProp(iRotating, Prop_Send, "m_CollisionGroup", 1);
- Format(sBufer, sizeof(sBufer), "OnUser1 !self:kill::%0.2f:-1", fTime);
- SetVariantString(sBufer);
- AcceptEntityInput(iRotating, "AddOutput");
- AcceptEntityInput(iRotating, "FireUser1");
- SetEntPropEnt(iEntity, Prop_Send, "m_hEffectEntity", iRotating);
- Format(clr, sizeof(clr), "%i %i %i", GetRandomInt(0,255),GetRandomInt(0,255),GetRandomInt(0,255));
- new index5 = CreateEntityByName("env_sprite");
- DispatchKeyValue(index5, "rendermode", "5");
- DispatchKeyValue(index5, "rendercolor", String:clr);
- DispatchKeyValue(index5, "renderamt", "255");
- DispatchKeyValue(index5, "scale", "1");
- DispatchKeyValue(index5, "model", "sprites/glow01.spr");
- DispatchKeyValueVector(index5, "origin", fPos);
- DispatchSpawn(index5);
- SetVariantString("!activator");
- AcceptEntityInput(index5, "SetParent", iEntity);
- SDKHook(iEntity, SDKHook_StartTouch, Hook_GiftStartTouch);
- }
- }
- return Plugin_Stop;
- }
- public Hook_GiftStartTouch(iEntity, activator)
- {
- if (activator > 0 && activator <= MaxClients)
- {
- switch (GetRandomInt(1,9))
- {
- case 1:
- {
- new iMoney;
- if(GetRandomInt(0,1))
- {
- new randommoney = GetRandomInt(0, 5000);
- iMoney = GetEntData(activator, m_iAccount) + randommoney;
- SetEntData(activator, m_iAccount, iMoney);
- PrintToChat(activator,"\x04[Vánoce]\x01 Z dárečku jsi obdržel: \x03%i$", randommoney);
- }
- else
- {
- new randommoney = GetRandomInt(0, 500);
- iMoney = GetEntData(activator, m_iAccount) - randommoney;
- PrintToChat(activator,"\x04[Vánoce]\x01 Z dárečku jsi obdržel: \x03%i$", randommoney);
- }
- SetEntData(activator, m_iAccount, iMoney);
- }
- case 2:
- {
- if(GetRandomInt(0,1))
- {
- SetEntProp(activator, Prop_Data, "m_iFrags", GetClientFrags(activator) + 2);
- PrintToChat(activator,"\x04[Vánoce]\x01 K účtu byl přidán dárek \x032\x01.");
- }
- else
- {
- SetEntProp(activator, Prop_Data, "m_iDeaths", GetClientDeaths(activator) - 2);
- PrintToChat(activator,"\x04[Vánoce]\x01 Dárek byl z účtu odebrán \x032\x01 za smrt.");
- }
- }
- case 3:
- {
- new r = GetRandomInt(0,2);
- SetEntData(activator, m_iHealth, GetEntData(activator, m_iHealth) + GetRandomInt(sAptMin[r], sAptMax[r]));
- PrintToChat(activator,"\x04[Vánoce]\x01 V dárečku se nachází \x03%s", sApt_text[r]);
- }
- case 4:
- {
- new r = GetRandomInt(0,2);
- GivePlayerItem(activator, g_sGrens[r]);
- PrintToChat(activator,"\x04[Vánoce]\x01 V dárku se nachází \x03%s", g_sGrens_text[r]);
- }
- case 5:
- {
- new Float:randomspeed = GetRandomFloat(0.9, 1.2);
- SetEntDataFloat(activator, m_fSpeed, GetEntDataFloat(activator, m_fSpeed) * randomspeed);
- PrintToChat(activator, "\x04[Vánoce]\x01 V dárečku byl Vánoční drink, který změnil tvoji rychlost na: \x03%.2f%%", 100.0*randomspeed);
- }
- #if defined _shop_included
- case 6:
- {
- new shopwin = GetRandomInt(0,100);
- if (shopwin <= 10)
- PrintToChat(activator,"\x04[Vánoce]\x01 Dárek má roztrženou loterii s výhrou\x03%i\x01!",;Shop_GiveClientCredits(activator, GetRandomInt(1,5), CREDITS_BY_NATIVE));
- else if (shopwin <= 50)
- PrintToChat(activator,"\x04[Vánoce]\x01
- Současnost se ukázala jako levná loterijní jízdenka s výhrou \x03%i\x01 body! ", Shop_GiveClientCredits(activator, GetRandomInt(5,25), CREDITS_BY_NATIVE));
- else if (shopwin <= 70)
- PrintToChat(activator,"\x04[Vánoce]\x01 Současnost se ukázala jako loterijní výhra s výhrou \x03%i\x01 body! ", Shop_GiveClientCredits(activator, GetRandomInt(25,75), CREDITS_BY_NATIVE));
- else if (shopwin <= 85)
- PrintToChat(activator,"\x04[Vánoce]\x01 Současnost se ukázala jako drahá loterie s výhrou \x03%i\x01 body! ", Shop_GiveClientCredits(activator, GetRandomInt(75,150), CREDITS_BY_NATIVE));
- else if (shopwin <= 99)
- PrintToChat(activator,"\x04[Vánoce]\x01 V dárku se ukázalo být \x03VIP\x01 loteirní hráč - \x03%i\x01 body! ", Shop_GiveClientCredits(activator, GetRandomInt(150,250), CREDITS_BY_NATIVE));
- else
- {
- switch (GetRandomInt(0,3))
- {
- case 1: {PrintToChat(activator,"\x04[Vánoce]\x01 V Dárku byla loterijní karta s \x03JACKPOTEM\x01 velikosti s \x03%i\x01 body! ", Shop_GiveClientCredits(activator, 250, CREDITS_BY_NATIVE));}
- case 2: {PrintToChat(activator,"\x04[Vánoce]\x01 V Dárku byla loterijní karta s \x03JACKPOTEM\x01 velikosti s \x03%i\x01 body! ", Shop_GiveClientCredits(activator, 500, CREDITS_BY_NATIVE));}
- case 3: {PrintToChat(activator,"\x04[Vánoce]\x01 V Dárku byla loterijní karta s \x03JACKPOTEM\x01 velikosti s \x03%i\x01 body! ", Shop_GiveClientCredits(activator, 1000, CREDITS_BY_NATIVE));}
- default: PrintToChat(activator,"\x04[Vánoce]\x01 Přítomnost se ukázala být zkaženou loterií s \x03ДЖЕКПОТОМ\x01.");
- }
- }
- }
- #endif
- default: {PrintToChat(activator,"\x04[Vánoce]\x01 Omlouváme se, ale dárek byl prázdný..");}
- }
- }
- if(IsValidEdict(iEntity))
- {
- new iRotating = GetEntPropEnt(iEntity, Prop_Send, "m_hEffectEntity");
- if(iRotating && IsValidEdict(iRotating))
- {
- AcceptEntityInput(iRotating, "Kill");
- }
- AcceptEntityInput(iEntity, "Kill");
- }
- }
- public Action:GiftMe(client, args)
- {
- CreateTimer(0.1, Gift, GetClientUserId(client));
- return Plugin_Handled;
- }
- public Action:CreateTree(client, args)
- {
- CreateSomethink(client, "tree");
- return Plugin_Handled;
- }
- public Action:CreateLarge(client, args)
- {
- CreateSomethink(client, "large");
- return Plugin_Handled;
- }
- public Action:CreateSnowman(client, args)
- {
- CreateSomethink(client, "snowman");
- return Plugin_Handled;
- }
- public bool:Trace_FilterPlayers(entity, contentsMask, any:data){
- if(entity != data && entity > MaxClients)
- return true;
- return false;
- }
- CreateSomethink(client, const String: sType[])
- {
- decl Float:g_fOrigin[3], Float:g_fAngles[3];
- GetClientEyePosition(client, g_fOrigin);
- GetClientEyeAngles(client, g_fAngles);
- TR_TraceRayFilter(g_fOrigin, g_fAngles, MASK_SOLID, RayType_Infinite, Trace_FilterPlayers, client);
- if(TR_DidHit(INVALID_HANDLE))
- {
- TR_GetEndPosition(g_fOrigin, INVALID_HANDLE);
- TR_GetPlaneNormal(INVALID_HANDLE, g_fAngles);
- GetVectorAngles(g_fAngles, g_fAngles);
- g_fAngles[0] += 90.0;
- switch(sType[0])
- {
- case 't': SpawnTree(g_fOrigin, g_fAngles);
- case 'l': SpawnLarge(g_fOrigin, g_fAngles);
- case 's': SpawnSnowMan(g_fOrigin, g_fAngles);
- }
- new Handle:kv = CreateKeyValues("tree");
- FileToKeyValues(kv, g_sFile);
- decl String:info[60];
- FormatEx(info, sizeof(info), "%f,%f",g_fOrigin[0], g_fOrigin[1]);
- KvJumpToKey(kv, info, true);
- KvSetVector(kv, "1", g_fOrigin);
- KvSetVector(kv, "2", g_fAngles);
- KvSetString(kv, "type", sType);
- KvRewind(kv);
- KeyValuesToFile(kv, g_sFile);
- CloseHandle(kv);
- }
- }
- SpawnTree(const Float:g_fOrigin[3], const Float:g_fAngles[3])
- {
- new index = CreateEntityByName("prop_dynamic");
- DispatchKeyValue(index, "model", "models/models_kit/xmas/xmastree_mini.mdl");
- DispatchKeyValue(index, "Solid", "6");
- DispatchSpawn(index);
- TeleportEntity(index, g_fOrigin, g_fAngles, NULL_VECTOR);
- SetEntityMoveType(index, MOVETYPE_VPHYSICS);
- }
- SpawnLarge(const Float:g_fOrigin[3], const Float:g_fAngles[3])
- {
- new index = CreateEntityByName("prop_dynamic_override");
- if (index == -1) return;
- DispatchKeyValue(index, "model", "models/models_kit/xmas/xmastree.mdl");
- DispatchKeyValue(index, "Solid", "6");
- DispatchSpawn(index);
- TeleportEntity(index, g_fOrigin, g_fAngles, NULL_VECTOR);
- SetEntityMoveType(index, MOVETYPE_VPHYSICS);
- }
- SpawnSnowMan(const Float:g_fOrigin[3], const Float:g_fAngles[3])
- {
- new index = CreateEntityByName("prop_dynamic");
- DispatchKeyValue(index, "model", "models/logandougall/cel/cel_xmas_snowman.mdl");
- DispatchKeyValue(index, "Solid", "6");
- DispatchSpawn(index);
- TeleportEntity(index, g_fOrigin, g_fAngles, NULL_VECTOR);
- SetEntityMoveType(index, MOVETYPE_VPHYSICS);
- }
- public Action:DeleteTree(client, args)
- {
- new index = GetClientAimTarget(client, false);
- if (index == -1) return Plugin_Handled;
- decl Float:vec[3]; decl String:coord[15]; decl String:coord1[15], String:buf3[2][25], String:buf4[2][25];
- GetEntPropVector(index, Prop_Data, "m_vecAbsOrigin", vec);
- FloatToString(vec[0], coord, sizeof(coord));
- FloatToString(vec[1], coord1, sizeof(coord1));
- ExplodeString(coord, ".", buf3, 2, 25);
- ExplodeString(coord1, ".", buf4, 2, 25);
- new Handle:kv = CreateKeyValues("tree");
- if (FileToKeyValues(kv, g_sFile) && KvGotoFirstSubKey(kv))
- {
- decl String:KeyName[35];
- do
- {
- if (KvGetSectionName(kv, KeyName, 35))
- {
- decl String:buf[2][25],String:buf1[2][25],String:buf2[2][25];
- ExplodeString(String:KeyName, ",", String:buf, 2, 25);
- ExplodeString(String:buf[0], ".", String:buf1, 2, 25);
- ExplodeString(String:buf[1], ".", String:buf2, 2, 25);
- if (StrEqual(buf1[0], buf3[0]) && StrEqual(buf2[0], buf4[0]))
- {
- AcceptEntityInput(index, "Kill");
- KvDeleteThis(kv);
- KvRewind(kv);
- KeyValuesToFile(kv, g_sFile);
- }
- }
- }
- while (KvGotoNextKey(kv));
- }
- CloseHandle(kv);
- return Plugin_Handled;
- }
- public Action:Snow(client, args)
- {
- if (GetClientTeam(client) > 1 && IsPlayerAlive(client))
- {
- new time = GetTime();
- if (time > g_iAvailableSnow[client])
- {
- g_iAvailableSnow[client] = time + 10;
- decl Float:clienteyeangle[3], Float:anglevector[3], Float:clienteyeposition[3], Float:resultposition[3];
- GetClientEyeAngles(client, clienteyeangle);
- GetClientEyePosition(client, clienteyeposition);
- GetAngleVectors(clienteyeangle, anglevector, NULL_VECTOR, NULL_VECTOR);
- NormalizeVector(anglevector, anglevector);
- AddVectors(clienteyeposition, anglevector, resultposition);
- NormalizeVector(anglevector, anglevector);
- ScaleVector(anglevector, 800.0);
- new entity = CreateEntityByName("hegrenade_projectile");
- SetEntityMoveType(entity, MOVETYPE_FLY);
- DispatchSpawn(entity);
- SetEntityModel(entity, "models/logandougall/cel/cel_xmas_snowball_16.mdl");
- TeleportEntity(entity, resultposition, clienteyeangle, anglevector);
- CreateTimer(3.0, Go, entity);
- }
- else
- {
- PrintToChat(client, "Házet sněhovou kouli bude k dispozici za: %i sekund.", g_iAvailableSnow[client] - time);
- }
- }
- else PrintToChat(client, "Musíš být naživu! (Ve spectu nejde pužívat Vánoční event!)");
- return Plugin_Handled;
- }
- public Action:Go(Handle:timer, any:val)
- {
- if (IsValidEntity(val))
- {
- AcceptEntityInput(val, "Kill");
- }
- }
- UTIL_FindSendPropOffs(const String:sNetClass[], const String:sPropertyName[])
- {
- new iOffset = FindSendPropInfo(sNetClass, sPropertyName);
- if (iOffset == -1) SetFailState("Na tomto serveru nefunguje: \"%s::%s\"", sNetClass, sPropertyName);
- return iOffset;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement