[FilterScript] OnPlayerPressEnter,OnPlayerPressCAPSLOCK etc...
#1

Код:
#include <a_samp>
forward OnPlayerPressMOUSE1(playerid);
forward OnPlayerPressMOUSE2(playerid);
forward OnPlayerPressMOUSE3(playerid);
forward OnPlayerPressLCTRL(playerid);
forward OnPlayerPressRCTRL(playerid);
forward OnPlayerPressSHIFT(playerid);
forward OnPlayerPressCAPSLOCK(playerid);
forward OnPlayerPressENTER(playerid);
forward OnPlayerPressDELETE(playerid);
forward OnPlayerPressEND(playerid);
forward OnPlayerPressC(playerid);
forward OnPlayerPressQ(playerid);
forward OnPlayerPressW(playerid);
forward OnPlayerPressE(playerid);
forward OnPlayerPressS(playerid);
forward OnPlayerPressH(playerid);
forward OnPlayerPressTAB(playerid);
forward OnPlayerPressALT(playerid);
forward OnPlayerPressSPACE(playerid);
forward OnPlayerPressNUMPAD4(playerid);
forward OnPlayerPressNUMPAD6(playerid);
forward OnPlayerPressNUMPAD8(playerid);
forward OnPlayerPressNUMPADADD(playerid);
new KeysNum[15][1]={
{1},//Tab,LCTRLinveh
{2},//C,Hinveh
{4},//LCTRL,MOUSE1,ALTinveh
{8},//SPACE,Winveh
{16},//ENTER
{32},//SHIFT,RCTRL,Sinveh
{64},//Einveh
{128},//CAPSLOCK,DELETE,MOUSE2,SPACEinveh
{256},//Qinveh
{512},//NUMPAD 1,MOUSE3,NUMPAD +inveh,2inveh
{1024},//ALT
{2048},//NUMPAD 8inveh
{4096},//ENDinveh
{8192},//NUMPAD 4
{16384}//NUMPAD 6
};
forward GetPlayerPressKeys(playerid,id);
forward PlayerKeysNumtoKeys(playerid,id);
public PlayerKeysNumtoKeys(playerid,id)
{
	switch(id)
	{
		case 1:
		{
			if(IsPlayerInAnyVehicle(playerid)){CallRemoteFunction("OnPlayerPressLCTRL","d",playerid);}
			else
			{
                CallRemoteFunction("OnPlayerPressTAB","d",playerid);
			}
		}
		case 2:
		{
			if(IsPlayerInAnyVehicle(playerid)){CallRemoteFunction("OnPlayerPressH","d",playerid);}
            else
			{
                CallRemoteFunction("OnPlayerPressC","d",playerid);
			}
		}
		case 4:
		{
			if(IsPlayerInAnyVehicle(playerid)){CallRemoteFunction("OnPlayerPressALT","d",playerid);}
			else
			{
                CallRemoteFunction("OnPlayerPressLCTRL","d",playerid);
                CallRemoteFunction("OnPlayerPressMOUSE1","d",playerid);
			}
		}
		case 8:
		{
			if(IsPlayerInAnyVehicle(playerid)){CallRemoteFunction("OnPlayerPressW","d",playerid);}
            else
			{
                CallRemoteFunction("OnPlayerPressSPACE","d",playerid);
			}
		}
		case 16:
		{
			CallRemoteFunction("OnPlayerPressENTER","d",playerid);
		}
		case 32:
		{
			if(IsPlayerInAnyVehicle(playerid)){CallRemoteFunction("OnPlayerPressS","d",playerid);}
            else
			{
                CallRemoteFunction("OnPlayerPressSHIFT","d",playerid);
                CallRemoteFunction("OnPlayerPressRCTRL","d",playerid);
			}
		}
		case 64:
		{
			if(IsPlayerInAnyVehicle(playerid)){CallRemoteFunction("OnPlayerPressE","d",playerid);}
		}
		case 128:
		{
			if(IsPlayerInAnyVehicle(playerid)){CallRemoteFunction("OnPlayerPressSPACE","d",playerid);}
            else
			{
                CallRemoteFunction("OnPlayerPressCAPSLOCK","d",playerid);
                CallRemoteFunction("OnPlayerPressDELETE","d",playerid);
                CallRemoteFunction("OnPlayerPressMOUSE2","d",playerid);
			}
		}
		case 256:
		{
			if(IsPlayerInAnyVehicle(playerid)){CallRemoteFunction("OnPlayerPressQ","d",playerid);}
		}
		case 512:
		{
			if(IsPlayerInAnyVehicle(playerid)){CallRemoteFunction("OnPlayerPressNUMPADADD","d",playerid);CallRemoteFunction("OnPlayerPress2","d",playerid);}
            else
			{
                CallRemoteFunction("OnPlayerPressNUMPAD1","d",playerid);
                CallRemoteFunction("OnPlayerPressMOUSE3","d",playerid);
			}
		}
		case 1024:
		{
            CallRemoteFunction("OnPlayerPressALT","d",playerid);
		}
		case 2048:
		{
            if(IsPlayerInAnyVehicle(playerid)){CallRemoteFunction("OnPlayerPressNUMPAD8","d",playerid);}
		}
		case 4096:
		{
            if(IsPlayerInAnyVehicle(playerid)){CallRemoteFunction("OnPlayerPressEND","d",playerid);}
		}
		case 8192:
		{
		    CallRemoteFunction("OnPlayerPressNUMPAD4","d",playerid);
		}
		case 16384:
		{
		    CallRemoteFunction("OnPlayerPressNUMPAD6","d",playerid);
		}
	}
}
public GetPlayerPressKeys(playerid,id)
{
	for(new a=0;a<15;a++)
	{
	    if(id>=KeysNum[a][0]&&KeysNum[a][0]>0)
	    {
	        if(id==KeysNum[a][0]){PlayerKeysNumtoKeys(playerid,KeysNum[a][0]);}
			for(new b=0;b<15;b++)
			{
			    if(id>=KeysNum[a][0]+KeysNum[b][0]&&KeysNum[b][0]>0)
	    		{
	    		    if(a!=b&&id==KeysNum[a][0]+KeysNum[b][0]&&KeysNum[a][0]>KeysNum[b][0]){PlayerKeysNumtoKeys(playerid,KeysNum[a][0]);PlayerKeysNumtoKeys(playerid,KeysNum[b][0]);}
		    		for(new c=0;c<15;c++)
					{
						if(id>=KeysNum[a][0]+KeysNum[b][0]+KeysNum[c][0]&&KeysNum[c][0]>0)
	    				{
	    				    if(a!=b&&b!=c&&id==KeysNum[a][0]+KeysNum[b][0]+KeysNum[c][0]&&KeysNum[a][0]>KeysNum[b][0]&&KeysNum[b][0]>KeysNum[c][0]){PlayerKeysNumtoKeys(playerid,KeysNum[a][0]);PlayerKeysNumtoKeys(playerid,KeysNum[b][0]);PlayerKeysNumtoKeys(playerid,KeysNum[c][0]);}
	    				    for(new d=0;d<15;d++)
							{
							    if(id>=KeysNum[a][0]+KeysNum[b][0]+KeysNum[c][0]+KeysNum[d][0]&&KeysNum[c][0]>0)
	    						{
									if(a!=b&&b!=c&&c!=d&&id==KeysNum[a][0]+KeysNum[b][0]+KeysNum[c][0]+KeysNum[d][0]&&KeysNum[a][0]>KeysNum[b][0]&&KeysNum[b][0]>KeysNum[c][0]&&KeysNum[c][0]>KeysNum[d][0]){PlayerKeysNumtoKeys(playerid,KeysNum[a][0]);PlayerKeysNumtoKeys(playerid,KeysNum[b][0]);PlayerKeysNumtoKeys(playerid,KeysNum[c][0]);PlayerKeysNumtoKeys(playerid,KeysNum[d][0]);}
	    				    		for(new e=0;e<15;e++)
									{
									    if(id>=KeysNum[a][0]+KeysNum[b][0]+KeysNum[c][0]+KeysNum[d][0]+KeysNum[e][0]&&KeysNum[c][0]>0)
	    								{
                                            if(a!=b&&b!=c&&c!=d&&d!=e&&id==KeysNum[a][0]+KeysNum[b][0]+KeysNum[c][0]+KeysNum[d][0]+KeysNum[e][0]&&KeysNum[a][0]>KeysNum[b][0]&&KeysNum[b][0]>KeysNum[c][0]&&KeysNum[c][0]>KeysNum[d][0]&&KeysNum[d][0]>KeysNum[e][0]){PlayerKeysNumtoKeys(playerid,KeysNum[a][0]);PlayerKeysNumtoKeys(playerid,KeysNum[b][0]);PlayerKeysNumtoKeys(playerid,KeysNum[c][0]);PlayerKeysNumtoKeys(playerid,KeysNum[d][0]);PlayerKeysNumtoKeys(playerid,KeysNum[e][0]);}
										}
									}
								}
							}
						}

					}
				}
			}
		}
	}
}

public OnPlayerUpdate(playerid)
{
    new Keys,ud,lr;
    GetPlayerKeys(playerid,Keys,ud,lr);
    if(!IsPlayerNPC(playerid)&&Keys!=ud&&Keys!=lr)
    {
    	//printf("%d) keys : %d ud : %d lr : %d",playerid,Keys,ud,lr);
    	GetPlayerPressKeys(playerid,Keys);
    }
	return 1;
}
public OnPlayerPressMOUSE1(playerid){return 1;}
public OnPlayerPressMOUSE2(playerid){return 1;}
public OnPlayerPressMOUSE3(playerid){return 1;}
public OnPlayerPressLCTRL(playerid){return 1;}
public OnPlayerPressRCTRL(playerid){return 1;}
public OnPlayerPressSHIFT(playerid){return 1;}
public OnPlayerPressCAPSLOCK(playerid){return 1;}
public OnPlayerPressENTER(playerid){return 1;}
public OnPlayerPressDELETE(playerid){return 1;}
public OnPlayerPressEND(playerid){return 1;}
public OnPlayerPressC(playerid){return 1;}
public OnPlayerPressQ(playerid){return 1;}
public OnPlayerPressW(playerid){return 1;}
public OnPlayerPressE(playerid){return 1;}
public OnPlayerPressS(playerid){return 1;}
public OnPlayerPressH(playerid){return 1;}
public OnPlayerPressTAB(playerid){return 1;}
public OnPlayerPressALT(playerid){return 1;}
public OnPlayerPressSPACE(playerid){return 1;}
public OnPlayerPressNUMPAD4(playerid){return 1;}
public OnPlayerPressNUMPAD6(playerid){return 1;}
public OnPlayerPressNUMPAD8(playerid){return 1;}
public OnPlayerPressNUMPADADD(playerid){return 1;}
the CallRemoteFunction can call your GAMEMODE functions.
you can put only forward and public in your gamemode with this filtersciprt.
by me(gameid:MO_HATE)
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)