All pastes #266999 Raw Edit

Basic Hotkeys

public cpp v1 · immutable
·published 2006-12-04 16:06 UTC
rendered paste body
/*Hotkey codeAllows you to bind a single letter command to a longer commandParameters are passed automatically*/if (cmdtext[2] == ' ' || cmdtext[2] == 0) // Single letter entry{	new num = cmdtext[1];	if (num > 0x5A) num -= 0x20;	if (num > 'Q') num--;	num -= 0x41;	if (num >= 0 && num < 25) // Valid index	{		if (gPlayerHotkey[playerid][num][0]) // Set hotkey		{			new str[256];			format(str, sizeof (str), "/%s%s", gPlayerHotkey[playerid][num], cmdtext[2]			return CallRemoteFunction("OnPlayerCommandText", "is", playerid, str);		}	}}dcmd_reghotkey(playerid, text[], help){	if (help)	{		TEXT(MAIN_REGH_HELP);	}	else	{	}	return 1;}