rokfestr
Участник
- Сообщения
- 340
- Реакции
- 63
@rokfestr, покажите итоговый код.
И вообще, ошибка начинается со слов Exception reported, а не заканчивается ими.
C-подобный:
public Action:GrabSearch(Handle:timer, any:client)
{
PrintCenterText(client, "%t", "Searching"); // Tell client the plugin is searching for a target
if( client > 0 &&
IsClientInGame(client) &&
IsPlayerAlive(client) &&
g_Status[client][Grab] &&
!g_Grabbed[client])
{
// Init variables
new Float:clientloc[3], Float:clientang[3];
GetClientEyePosition(client, clientloc);
GetClientEyeAngles(client, clientang);
// Grab search traceray
TR_TraceRayFilter(clientloc, clientang, MASK_ALL, RayType_Infinite, TraceRayGrabEnt); // Create a ray that tells where the player is looking
g_Targetindex[client][Grab] = TR_GetEntityIndex(); // Set the seekers targetindex to the person he picked up
// Found a player or object
if(g_Targetindex[client][Grab] > 0 && IsValidEntity(g_Targetindex[client][Grab]))
{
// Init variables
new Float:targetloc[3];
GetEntityOrigin(g_Targetindex[client][Grab], targetloc); // Find the target's xyz coordinate
g_Distance[client][1] = GetVectorDistance(targetloc, clientloc); // Tell plugin the distance between the two to maintain
if( g_Targetindex[client][Grab] > 0 &&
g_Targetindex[client][Grab] <= MaxClients &&
IsClientInGame(g_Targetindex[client][Grab]) &&
CanUserTarget(GetUserAdmin(client), GetUserAdmin(g_Targetindex[client][Grab])))
{
g_MaxSpeed[client] = GetEntPropFloat(client, Prop_Send, "m_flMaxspeed");
g_Grabbed[g_Targetindex[client][Grab]] = true; // If target is a player, tell plugin player is being grabbed
SetEntPropFloat(g_Targetindex[client][Grab], Prop_Send, "m_flMaxspeed", 0.01); // Slow grab target
}
// Call grab forward
new ret;
Call_StartForward(FwdClientGrab);
Call_PushCell(client);
Call_Finish(ret);
if(ret)
{
Action_Drop(client);
return Plugin_Stop;
}
// Finish grabbing
EmitSoundFromOrigin(g_cvarSound[Grab], targetloc); // Emit sound from the entity being grabbed
CreateTimer(0.05, Grabbing, client, TIMER_REPEAT); // Start a repeating timer that will reposition the target in the grabber's crosshairs
return Plugin_Stop; // Stop the search timer
}
}
else
{
Action_Drop(client);
return Plugin_Stop; // Stop the timer
}
return Plugin_Continue;
}