You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
307 lines
8.4 KiB
307 lines
8.4 KiB
#include <sourcemod>
|
|
#include <sdktools>
|
|
#include <tf2_stocks>
|
|
|
|
bool piss_on_only_client = true;
|
|
bool piss_disable_move = false;
|
|
int piss_tick_counter = 1; //default 4
|
|
float piss_time = 9.0;
|
|
float piss_distance = 100.0;
|
|
|
|
int piss_check_count = 4;
|
|
int piss_check_need_count = 2;
|
|
|
|
|
|
int g_TickCounter = 0;
|
|
bool g_bPiss[MAXPLAYERS + 1] = { false, ... };
|
|
bool g_bCanPiss[MAXPLAYERS + 1] = { true, ... };
|
|
|
|
int g_PissTarget[MAXPLAYERS + 1] = {0, ...};
|
|
int g_PissCount[MAXPLAYERS + 1] = {0, ...};
|
|
int g_PissStart[MAXPLAYERS + 1] = {0, ...};
|
|
|
|
int BeamSprite;
|
|
int HaloSprite;
|
|
|
|
Handle g_PEnabled = INVALID_HANDLE;
|
|
//int gVelocityOffset;
|
|
|
|
public Plugin:myinfo =
|
|
{
|
|
name = "Piss Mod",
|
|
author = "gsd",
|
|
description = "Original code https://forums.alliedmods.net/showthread.php?t=295055",
|
|
version = "1.1",
|
|
url = ""
|
|
}
|
|
|
|
public OnPluginStart(){
|
|
RegConsoleCmd("piss", Piss_In);
|
|
g_PEnabled = CreateConVar("sm_piss_enabled", "1");
|
|
AddFileToDownloadsTable("materials/sprites/xbeam2.vmt");
|
|
AddFileToDownloadsTable("materials/sprites/halo01.vmt");
|
|
HookEvent("player_death", Event_PlayerDeath);
|
|
//gVelocityOffset = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]");
|
|
}
|
|
|
|
public OnPluginEnd(){
|
|
for(int client = 1; client <= MaxClients; client++){
|
|
Piss_Out_Handler(client, true);
|
|
}
|
|
}
|
|
|
|
public OnMapStart(){
|
|
BeamSprite = PrecacheModel("materials/sprites/xbeam2.vmt");
|
|
HaloSprite = PrecacheModel("materials/sprites/halo01.vmt");
|
|
}
|
|
|
|
public OnClientConnected(int client){
|
|
g_bCanPiss[client] = true;
|
|
g_bPiss[client] = false;
|
|
g_PissTarget[client] = 0;
|
|
g_PissCount[client] = 0;
|
|
g_PissStart[client] = 0;
|
|
}
|
|
|
|
public OnClientDisconnect(int client){
|
|
Piss_Out_Handler(client, true);
|
|
}
|
|
|
|
public OnGameFrame()
|
|
{
|
|
if(g_TickCounter == piss_tick_counter)
|
|
{
|
|
for(int client = 1; client <=MaxClients; ++client)
|
|
{
|
|
if(IsClientInGame(client) && IsPlayerAlive(client))
|
|
{
|
|
if(g_bPiss[client])
|
|
{
|
|
PissBeam(client);
|
|
}
|
|
}
|
|
}
|
|
g_TickCounter=0;
|
|
}
|
|
else
|
|
{
|
|
g_TickCounter++;
|
|
}
|
|
}
|
|
|
|
public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast){
|
|
int client = GetClientOfUserId(GetEventInt(event, "userid"));
|
|
if(g_bPiss[client]) Piss_Out_Handler(client, true);
|
|
}
|
|
|
|
stock bool CheckPissDistance(int client, int target){
|
|
new Float:rposition[3];
|
|
new Float:cposition[3];
|
|
GetEntPropVector(target, Prop_Send, "m_vecOrigin", rposition);
|
|
|
|
GetClientAbsOrigin(client, cposition);
|
|
decl Float:DistanceG;
|
|
DistanceG = GetVectorDistance(rposition,cposition);
|
|
|
|
if(DistanceG <= piss_distance) return true;
|
|
else return false;
|
|
}
|
|
|
|
public Action:Piss_In(client, args)
|
|
{
|
|
//PrintToServer("%N:%i", client, g_bCanPiss[client]);
|
|
if(!GetConVarBool(g_PEnabled)){
|
|
PrintCenterText(client, "У тебя простатит...");
|
|
return Plugin_Continue;
|
|
}
|
|
|
|
if(!g_bCanPiss[client]){
|
|
return Plugin_Continue;
|
|
}
|
|
/*
|
|
if ((g_AdmFlag > 0) && !CheckCommandAccess(client, "sm_piss", g_AdmFlag, true))
|
|
{
|
|
PrintToChat(client, "\x04You do not have access");
|
|
return Plugin_Handled;
|
|
}
|
|
*/
|
|
/*
|
|
if(veces[client] > GetConVarInt(g_veces))
|
|
{
|
|
PrintToChat(client, "\x04Times for round excedded");
|
|
return Plugin_Handled;
|
|
}
|
|
*/
|
|
//for(new i=1;i<=MaxClients;++i)
|
|
if(true)
|
|
{
|
|
//if(g_PKiller[i] == client)
|
|
if(true)
|
|
{
|
|
int ent = GetClientAimTarget(client, piss_on_only_client);
|
|
//PrintToServer("%N|%i|%i", client, ent, IsValidEdict(ent));
|
|
if(IsValidEdict(ent))
|
|
{
|
|
g_PissTarget[client] = ent;
|
|
/*if ((g_AdmFlag2 > 0) && !CheckCommandAccess(client, "sm_piss2", g_AdmFlag2, true))
|
|
{
|
|
PrintToChat(client, "\x04You do not have access");
|
|
return Plugin_Handled;
|
|
}*/
|
|
|
|
//if(DistanceG <= piss_distance)
|
|
if(CheckPissDistance(client, GetClientAimTarget(client, piss_on_only_client)))
|
|
{
|
|
/* if(rposition[0] > cposition[0]-50 && rposition[0] < cposition[0]+50)
|
|
{
|
|
if(rposition[1] > cposition[1]-50 && rposition[1] < cposition[1]+50)
|
|
{
|
|
if(rposition[2] > cposition[2]-5 && rposition[2] < cposition[2]+5)
|
|
{ */
|
|
PissBeam(client);
|
|
|
|
g_bPiss[client] = true;
|
|
g_PissStart[client] = GetTime();
|
|
if(piss_disable_move) SetEntityMoveType(client, MOVETYPE_NONE);
|
|
/* DISABLE SOUND
|
|
new String:sound[64];
|
|
GetConVarString(g_PeeSound, sound, sizeof(sound));
|
|
EmitAmbientSound(sound, pos);
|
|
*/
|
|
//CreateTimer(0.8, EmitSoundPee, client, TIMER_REPEAT);
|
|
|
|
float append = piss_time / piss_check_count;
|
|
|
|
for(float start = 0.0; start < piss_time; start++){
|
|
start--;
|
|
start = start + append;
|
|
|
|
CreateTimer(start, Piss_Effect, client);
|
|
//PrintToServer("Create Timer: %i", start);
|
|
}
|
|
|
|
if(ent >= 1 && ent <= MaxClients) PrintCenterText(client, "Ты начал ссать на %N...", ent);
|
|
CreateTimer(piss_time, Piss_Out, client);
|
|
//veces[client]++;
|
|
g_bCanPiss[client] = false;
|
|
//Quitararmas(client);
|
|
//break;
|
|
/* }
|
|
} */
|
|
}
|
|
} else {
|
|
PrintCenterText(client, "Нет цели для окатывания мочёй!\nЗабиндь кнопку через консоль чтоб удобнее ловить цели!\nbind R piss")
|
|
}
|
|
}
|
|
}
|
|
|
|
return Plugin_Handled;
|
|
}
|
|
|
|
stock PissBeam(int client, int entity = -1, bool logging = false, bool magnet_piss = false){
|
|
float pos[3], end[3], ang[3], ppos[3], aang[3];
|
|
|
|
GetClientEyePosition(client, pos);
|
|
GetClientEyeAngles(client, ang);
|
|
pos[2] -= 23.0;
|
|
ang[0] = 40.0;
|
|
TR_TraceRayFilter(pos, ang, MASK_PLAYERSOLID, RayType_Infinite, DontHitSelf, client);
|
|
|
|
if(magnet_piss){
|
|
float tpos[3];
|
|
GetEntPropVector(g_PissTarget[client], Prop_Send, "m_vecOrigin", tpos);
|
|
GetClientAbsOrigin(client, ppos);
|
|
if(GetVectorDistance(ppos, tpos) <= piss_distance) end = tpos;
|
|
else TR_GetEndPosition(end);
|
|
} else {
|
|
TR_GetEndPosition(end);
|
|
}
|
|
//if(entity == -1) TR_GetEndPosition(end);
|
|
//else GetEntPropVector(entity, Prop_Send, "m_vecOrigin", end);
|
|
|
|
TE_SetupBeamRingPoint(end, 5.0, 10.0, BeamSprite, HaloSprite, 0, 15, 0.5, 5.0, 1.0, {255, 255, 0, 255}, 10, 0);
|
|
TE_SendToAll();
|
|
|
|
GetClientEyePosition(client, ppos);
|
|
|
|
//ppos[0]+=10.0;
|
|
ppos[2]-=30.0;
|
|
|
|
GetClientAbsAngles(client, aang);
|
|
|
|
if(aang[1] > 0)
|
|
{
|
|
ppos[0]+=FloatSub(10.0, FloatMul(FloatDiv(10.0, 90.0), aang[1]));
|
|
ppos[1]+=FloatSub(10.0, FloatMul(FloatDiv(10.0, 90.0), FloatAbs(FloatSub(aang[1], 90.0))));
|
|
}
|
|
else
|
|
{
|
|
ppos[0]+=FloatSub(10.0, FloatMul(FloatDiv(10.0, 90.0), FloatAbs(aang[1])));
|
|
ppos[1]-=FloatSub(10.0, FloatMul(FloatDiv(10.0, 90.0), FloatAbs(FloatSub(FloatAbs(aang[1]), 90.0))));
|
|
}
|
|
|
|
aang[0]=0.0;
|
|
aang[1]+=180.0;
|
|
aang[2]=0.0;
|
|
|
|
TE_SetupBeamPoints(end, ppos, BeamSprite, HaloSprite, 0, 30, 0.1, 1.0, 1.0, 0, 10.0, {255, 255, 0, 255}, 10);
|
|
TE_SendToAll();
|
|
if(logging) PrintCenterText(client, "%f %f %f | %f %f %f\n%f %f %f | %f %f %f",
|
|
pos[0], pos[1], pos[2], end[0], end[1], end[2],
|
|
ppos[0], ppos[1], ppos[2], aang[0], aang[1], aang[2]);
|
|
}
|
|
|
|
public Action:Piss_Effect(Handle:timer, any:client){
|
|
if(g_PissTarget[client] >= 1 && g_PissTarget[client] <= MaxClients){
|
|
if(g_PissTarget[client] == GetClientAimTarget(client, piss_on_only_client)){
|
|
if(CheckPissDistance(client, g_PissTarget[client])){
|
|
g_PissCount[client]++;
|
|
PrintCenterText(client, "%N хлебнул твоей урины...", g_PissTarget[client]);
|
|
PrintCenterText(g_PissTarget[client], "Ты хлебнул урины от %N...", client);
|
|
}
|
|
}
|
|
}
|
|
//PrintToServer("%N count: %i", client, g_PissCount[client]);
|
|
}
|
|
|
|
stock Piss_Out_Handler(int client, bool force = false){
|
|
if (!force) if(!IsClientInGame(client) || !IsPlayerAlive(client)) return;
|
|
|
|
g_bPiss[client] = false;
|
|
g_bCanPiss[client] = false;
|
|
|
|
//PrintToServer("%N %i>=%i", client, g_PissCount[client], piss_check_need_count);
|
|
if(!force && g_PissCount[client] > piss_check_need_count){
|
|
g_PissCount[client] = 0;
|
|
if(g_PissTarget[client] >= 1 && g_PissTarget[client] <= MaxClients){
|
|
if(IsClientInGame(g_PissTarget[client]) && IsPlayerAlive(g_PissTarget[client])){
|
|
TF2_AddCondition(g_PissTarget[client], TFCond_Jarated, 5.0);
|
|
PrintCenterText(g_PissTarget[client], "Тебя обоссал %N", client);
|
|
}
|
|
}
|
|
g_PissTarget[client] = -1;
|
|
}
|
|
|
|
if(!force) if(piss_disable_move) SetEntityMoveType(client, MOVETYPE_ISOMETRIC);
|
|
CreateTimer(1.0, CanPiss, client);
|
|
}
|
|
|
|
public Action:Piss_Out(Handle:timer, any:client)
|
|
{
|
|
Piss_Out_Handler(client);
|
|
return;
|
|
}
|
|
|
|
public bool:DontHitSelf(entity, mask, any:data)
|
|
{
|
|
if(entity == data)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
public Action:CanPiss(Handle:timer, any:client)
|
|
{
|
|
g_bCanPiss[client] = true;
|
|
|
|
return Plugin_Continue;
|
|
}
|