Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #include <dini>
- //mielőtt berakod a scriptet, vedd ki az összes bindet, pl num2 - jármű javítása stb...
- /*
- Created by:
- ###################################################################
- # #
- # /$$$$$$ #
- # |_ $$_/ #
- # | $$ /$$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ #
- # | $$ | $$__ $$ /$$_____/ |____ $$| $$__ $$ /$$__ $$ #
- # | $$ | $$ \ $$| $$$$$$ /$$$$$$$| $$ \ $$| $$$$$$$$ #
- # | $$ | $$ | $$ \____ $$ /$$__ $$| $$ | $$| $$_____/ #
- # /$$$$$$| $$ | $$ /$$$$$$$/| $$$$$$$| $$ | $$| $$$$$$$ #
- # |______/|__/ |__/|_______/ \_______/|__/ |__/ \_______/ #
- # #
- ###################################################################
- ,---,
- ,---. ,`--.' |
- /__./| / / :
- ,---.; ; |: |.' '
- /___/ \ | |`----': |
- \ ; \ ' | ' ' ;
- \ \ \: | | | |
- ; \ ' . ' : ;
- \ \ ' | | '
- \ ` ; ' : |
- : \ | ; |.'
- '---" '---'
- */
- new bindfile[128];
- new hasznalomabindet[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- for(new i =0; i < MAX_PLAYERS;i++)
- {
- if(IsPlayerConnected(i))
- {
- hasznalomabindet[i] = 0;
- format(bindfile,sizeof(bindfile),"/binds/%s.txt",pname(i));
- if(!fexist(bindfile))
- {
- dini_Create(bindfile);
- dini_Set(bindfile,"keyn","empty");
- dini_Set(bindfile,"key2","empty");
- dini_Set(bindfile,"keynum8","empty");
- dini_Set(bindfile,"keynum6","empty");
- dini_Set(bindfile,"keynum4","empty");
- dini_Set(bindfile,"keynum2","empty");
- }
- }
- }
- print("***********KEY BIND BY INSANE***********");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- hasznalomabindet[playerid] = 0;
- format(bindfile,sizeof(bindfile),"/binds/%s.txt",pname(playerid));
- if(!fexist(bindfile))
- {
- dini_Create(bindfile);
- dini_Set(bindfile,"keyn","empty");
- dini_Set(bindfile,"key2","empty");
- dini_Set(bindfile,"keynum8","empty");
- dini_Set(bindfile,"keynum6","empty");
- dini_Set(bindfile,"keynum4","empty");
- dini_Set(bindfile,"keynum2","empty");
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(hasznalomabindet[playerid] == 1)
- {
- format(bindfile,sizeof(bindfile),"/binds/%s.txt",pname(playerid));
- if(fexist(bindfile))
- {
- if(newkeys & KEY_SUBMISSION) //2
- {
- if(strfind(dini_Get(bindfile,"key2"),"empty",true) != -1) return SendClientMessage(playerid,-1,"{FF0000}Erre a billentyűre nincs rakva bind! /bind");
- // ha üres stringet kap a CallRemoteFunction, crashel a szerver!
- CallRemoteFunction("OnPlayerCommandText","is",playerid,dini_Get(bindfile,"key2"));
- }
- if(newkeys & KEY_NO) //n
- {
- if(strfind(dini_Get(bindfile,"keyn"),"empty",true) != -1) return SendClientMessage(playerid,-1,"{FF0000}Erre a billentyűre nincs rakva bind! /bind");
- CallRemoteFunction("OnPlayerCommandText","is",playerid,dini_Get(bindfile,"keyn"));
- }
- if(newkeys & KEY_ANALOG_UP) // num8
- {
- if(strfind(dini_Get(bindfile,"keynum8"),"empty",true) != -1) return SendClientMessage(playerid,-1,"{FF0000}Erre a billentyűre nincs rakva bind! /bind");
- CallRemoteFunction("OnPlayerCommandText","is",playerid,dini_Get(bindfile,"keynum8"));
- }
- if(newkeys & KEY_ANALOG_DOWN) // num2
- {
- if(strfind(dini_Get(bindfile,"keynum2"),"empty",true) != -1) return SendClientMessage(playerid,-1,"{FF0000}Erre a billentyűre nincs rakva bind! /bind");
- CallRemoteFunction("OnPlayerCommandText","is",playerid,dini_Get(bindfile,"keynum2"));
- }
- if(newkeys & KEY_ANALOG_LEFT) // num4
- {
- if(strfind(dini_Get(bindfile,"keynum4"),"empty",true) != -1) return SendClientMessage(playerid,-1,"{FF0000}Erre a billentyűre nincs rakva bind! /bind");
- CallRemoteFunction("OnPlayerCommandText","is",playerid,dini_Get(bindfile,"keynum4"));
- }
- if(newkeys & KEY_ANALOG_RIGHT) // num6
- {
- if(strfind(dini_Get(bindfile,"keynum6"),"empty",true) != -1) return SendClientMessage(playerid,-1,"{FF0000}Erre a billentyűre nincs rakva bind! /bind");
- CallRemoteFunction("OnPlayerCommandText","is",playerid,dini_Get(bindfile,"keynum6"));
- }
- }
- }
- return 1;
- }
- CMD:bind(playerid,params[])
- {
- if(hasznalomabindet[playerid] == 0) return SendClientMessage(playerid,-1,"{00FF00}A bindelés neked ki van kapcsolva! bekapcsoláshoz /bindon");
- new billentyu[6],bindeles[64];
- format(bindfile,sizeof(bindfile),"/binds/%s.txt",pname(playerid));
- if(!fexist(bindfile)) dini_Create(bindfile);
- if(sscanf(params,"s[6]s[64]",billentyu,bindeles))
- {
- SendClientMessage(playerid,-1,"{FF0000}Használat: /bind billentyűzet /parancs");
- SendClientMessage(playerid,-1,"{FF0000}Használható billentyűk: subm, keyno, num2,num4,num6,num8");
- }else
- if(strfind(billentyu,"keyno",true) != -1)
- {
- dini_Set(bindfile,"keyn",bindeles);
- SendClientMessage(playerid,-1,"{00FF00}Bind beállítva, használathoz \"N\" billentyű!");
- }
- else
- if(strfind(billentyu,"subm",true) != -1)
- {
- dini_Set(bindfile,"key2",bindeles);
- SendClientMessage(playerid,-1,"{00FF00}Bind beállítva, használathoz (gyalog num1 vagy görgő) kocsiban \"2 vagy +\" billentyű!");
- }
- else
- if(strfind(billentyu,"num2",true) != -1)
- {
- dini_Set(bindfile,"keynum2",bindeles);
- SendClientMessage(playerid,-1,"{00FF00}Bind beállítva, használathoz \"num2\" billentyű!");
- SendClientMessage(playerid,-1,"{00FF00}Ezt csak kocsiban tudod használni!");
- }
- else
- if(strfind(billentyu,"num4",true) != -1)
- {
- dini_Set(bindfile,"keynum4",bindeles);
- SendClientMessage(playerid,-1,"{00FF00}Bind beállítva, használathoz \"num4\" billentyű!");
- }
- else
- if(strfind(billentyu,"num6",true) != -1)
- {
- dini_Set(bindfile,"keynum6",bindeles);
- SendClientMessage(playerid,-1,"{00FF00}Bind beállítva, használathoz \"num6\" billentyű!");
- }
- else
- if(strfind(billentyu,"num8",true) != -1)
- {
- dini_Set(bindfile,"keynum8",bindeles);
- SendClientMessage(playerid,-1,"{00FF00}Bind beállítva, használathoz \"num8\" billentyű!");
- SendClientMessage(playerid,-1,"{00FF00}Ezt csak kocsiban tudod használni!");
- }
- else
- {
- SendClientMessage(playerid,-1,"{FF0000}Használható billentyűk: subm, keyno, num2,num4,num6,num8");
- }
- return 1;
- }
- CMD:unbindall(playerid)
- {
- format(bindfile,sizeof(bindfile),"/binds/%s.txt",pname(playerid));
- dini_Remove(bindfile);
- dini_Create(bindfile);
- dini_Set(bindfile,"keyn","empty");
- dini_Set(bindfile,"key2","empty");
- dini_Set(bindfile,"keynum8","empty");
- dini_Set(bindfile,"keynum6","empty");
- dini_Set(bindfile,"keynum4","empty");
- dini_Set(bindfile,"keynum2","empty");
- SendClientMessage(playerid,-1,"{00FF00}Összes bind törölve!");
- return 1;
- }
- CMD:bindon(playerid)
- {
- hasznalomabindet[playerid] = 1;
- SendClientMessage(playerid,-1,"{00FF00}Bind használat bekapcsolva! /bind");
- return 1;
- }
- CMD:bindoff(playerid)
- {
- hasznalomabindet[playerid] = 0;
- SendClientMessage(playerid,-1,"{00FF00}Bind használat kikapcsolva!");
- return 1;
- }
- stock pname(playerid)
- {
- new tmp[MAX_PLAYER_NAME];
- GetPlayerName(playerid,tmp,sizeof(tmp));
- return tmp;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement