Quote:
Originally Posted by eyal282
Wait, isn't Call_PushCellRef used for copyback and Call_PushCell used for regular?
Or use Call_PushCell with &? If yes, what is Call_PushCellRef?
|
Call_PushCellRef is to push a reference.
Here's a working example:
Code:
forward Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float vel[3], float angles[3], TimerStatus status, int track, int style, any stylesettings[STYLESETTINGS_SIZE]);
Code:
Action result = Plugin_Continue;
Call_StartForward(gH_Forwards_OnUserCmdPre);
Call_PushCell(client);
Call_PushCellRef(buttons);
Call_PushCellRef(impulse);
Call_PushArrayEx(vel, 3, SM_PARAM_COPYBACK);
Call_PushArrayEx(angles, 3, SM_PARAM_COPYBACK);
Call_PushCell(GetTimerStatus(client));
Call_PushCell(gI_Track[client]);
Call_PushCell(gBS_Style[client]);
Call_PushArray(gA_StyleSettings[gBS_Style[client]], STYLESETTINGS_SIZE);
Call_Finish(result);
if(result != Plugin_Continue && result != Plugin_Changed)
{
return result;
}
The cells that will get 'copybacked' are
buttons,
impulse,
vel[3], and
angles[3].
Now, if I use the
Shavit_OnUserCmdPre, I can modify the variables and they will be copied back to the referenced ones.
__________________