Code: Select all
// Globaliai aprašytas kintamasis new Float: g_fSwingPoint[32][3]; static iEnt, body; get_user_aiming(id, iEnt, body); pev(iEnt, pev_origin, g_fSwingPoint[id-1]);
Code: Select all
public PreThink(id){ static buttons, oldButtons; buttons = pev(id, pev_button); oldButtons = pev(id, pev_oldbuttons); if ((buttons & IN_USE) && !(oldButtons & IN_USE)){ static iEnt, body; get_user_aiming(id, iEnt, body);//<-----here static sClassName[30], sPevClass[30], sTarget[30], sPevTarget[30]; get_pcvar_string(pClassName, sClassName, 29); pev(iEnt, pev_classname, sPevClass, 29); if (equali(sPevClass, sClassName)){ pev(iEnt, pev_targetname, sPevTarget, 29); get_pcvar_string(pTargetName, sTarget, 29); client_print(id, print_chat, "%d ID %s CLASS %s NAME", iEnt, sClassName, sTarget);//<-----no problems here if (equali(sTarget,"") || equali(sTarget, sPevTarget)){ pev(iEnt, pev_origin, g_fSwingPoint[id-1]);//<-----problem GlobalCalculations(id); SetVelocity(id); set_task(g_fTaskTime, "SetVelocity", id, _, _, "b"); } } } else if (!(buttons & IN_USE) && (oldButtons & IN_USE)){ if (task_exists(id)){ remove_task(id); // cool down } }}