Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #pragma newdecls required
- #include <sourcemod>
- #include <sdktools>
- static float vPos[3];
- bool iSee = false;
- public void OnPluginStart()
- {
- RegConsoleCmd("sm_spawn_spit", sm_test);
- RegConsoleCmd("sm_setcoordinates", smCoordinates);
- }
- public Action sm_test(int client, int args)
- {
- if(!IsValid(client)) return Plugin_Handled;
- int spawnflags = GetCommandFlags("z_spawn");
- SetCommandFlags("z_spawn", spawnflags & ~FCVAR_CHEAT);
- iSee = true;
- FakeClientCommand(client, "z_spawn spitter");
- iSee = false;
- SetCommandFlags("z_spawn", spawnflags);
- return Plugin_Handled;
- }
- public void OnClientPutInServer(int client)
- {
- if(iSee)
- {
- CreateTimer(0.1, CreateSpitter, client);
- }
- }
- public Action CreateSpitter(Handle timer, int client)
- {
- TeleportEntity(client, vPos, NULL_VECTOR, NULL_VECTOR);
- }
- public Action smCoordinates(int client, int args)
- {
- DisplaySetCoordinates(client);
- return Plugin_Handled;
- }
- void DisplaySetCoordinates(int client)
- {
- Handle SetPos = CreateMenu(Callback);
- SetMenuTitle(SetPos, "Тип:");
- AddMenuItem(SetPos, "0", "На прицел");
- AddMenuItem(SetPos, "1", "На своё местоположение");
- DisplayMenu(SetPos, client, MENU_TIME_FOREVER);
- }
- public int Callback(Handle CallbackMoney, MenuAction action, int client, int symbol)
- {
- if (action == MenuAction_End)
- {
- CloseHandle(CallbackMoney);
- return;
- }
- if (action != MenuAction_Select) return;
- switch(symbol)
- {
- case 0:
- {
- GetLookPos(client, vPos);
- PrintToChat(client, "Координаты успешно поставлены(%.03f, %.03f, %.03f)", vPos[0], vPos[1], vPos[2]);
- }
- default:
- {
- GetClientAbsOrigin(client, vPos);
- PrintToChat(client, "Координаты успешно поставлены(%.03f, %.03f, %.03f)", vPos[0], vPos[1], vPos[2]);
- }
- }
- }
- stock void GetLookPos(int client, float v[3])
- {
- float EyePosition[3], EyeAngles[3];
- Handle h_trace;
- GetClientEyePosition(client, EyePosition);
- GetClientEyeAngles(client, EyeAngles);
- h_trace = TR_TraceRayFilterEx(EyePosition, EyeAngles, MASK_SOLID, RayType_Infinite, GetLookPos_Filter, client);
- TR_GetEndPosition(v, h_trace);
- CloseHandle(h_trace);
- }
- public bool GetLookPos_Filter(int ent, int mask, any client)
- {
- return client != ent;
- }
- stock bool IsValid(int client)
- {
- return client > 0 && client <= MaxClients && IsClientInGame(client) && !IsClientInKickQueue(client) && IsPlayerAlive(client);
- }
Advertisement
Add Comment
Please, Sign In to add comment