I'm making this shooter where you have limited ammo, so is it possible? If so, how do i do it?
To count a number of mouse clicks declare a global variable at the top of main script and increase it inside the on_mouse_click() function located in that global script:
Counting mouse left button clicks:
//main global script
int mouse_clicks = 0;
function on_mouse_click(int button) {
// called when a mouse button is clicked. button is either LEFT or RIGHT
if (IsGamePaused() == 1) {
// Game is paused, so do nothing (ie. don't allow mouse click)
}
else if (button==LEFT) {
ProcessClick(mouse.x, mouse.y, GetCursorMode() );
mouse_clicks = mouse_clicks + 1; // increasing mouse click counter
}
else { // right-click, so cycle cursor
SetNextCursorMode();
}
}