Quote:
Originally Posted by rekcah
Spitter can throw a tank rock every 5 seconds by scratching(m2).
I'm not sure why but it doesn't always work properly if there are multiple spitters, however in my testing works fine for 1 spitter.
|
At first glance i can't see why all spitters shouldn't be throwing rocks...however you can try this to see if it resolves the issue...this should work.
Code:
iThrower[MAXPLAYERS+1];
new Float:NextUseRock[MAXPLAYERS+1];
public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
if (!IsClientInGame(client) || !IsPlayerAlive(client))
return Plugin_Continue;
if(IsSpitter(client) && !IsGhost(client) && GetClientTeam(client) == 3)
{
if ((buttons & IN_ATTACK2) && GetGameTime() > NextUseRock[client])
{
NextUseRock[client] = GetGameTime() + 5.0;
//PrintToChat(client,"rock thrown");
iThrower[client] = CreateEntityByName("env_rock_launcher");
DispatchKeyValue(iThrower[client],"Rock Damage Override", "10");
DispatchSpawn(iThrower[client]);
decl Float:pos[3];
decl Float:ang[3];
decl Float:npos[3];
GetClientAbsOrigin(client,pos);
GetClientEyeAngles(client,ang);
npos[0] = (pos[0] + 50 * Cosine(DegToRad(ang[1])));
npos[1] = (pos[1] + 50 * Sine(DegToRad(ang[1])));
npos[2] = (pos[2] + 150);
TeleportEntity(iThrower[client],npos,ang,NULL_VECTOR);
AcceptEntityInput(iThrower[client], "LaunchRock");
AcceptEntityInput(iThrower[client], "Kill");
}
}
}