Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define PRESSED(%0) \
- (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
- #define HOLDING(%0) \
- ((newkeys & (%0)) == (%0))
- #define USE_MY_PRETTY_TEXTDRAWS 0
- #define CHOOSE_YOUR_OWN_KEY KEY_SUBMISSION
- new
- Text:TwoKNOSLabel,
- Text:TwoKNOSON,
- Text:TwoKNOSOFF
- ;
- new
- p_UsingNos[MAX_PLAYERS] = 0
- ;
- public OnFilterScriptInit()
- {
- for(new u = 0; u < MAX_PLAYERS; u++) { //You can now safely load/reload the filterscript while the gamemode is already running.
- p_UsingNos[u] = -1;
- }
- print("[2K-NOS] : Build 1 - Loaded");
- TwoKNOSLabel = TextDrawCreate(488.000000, 102.000000, "~b~~h~~h~(2KNOS)~n~~n~");
- TextDrawBackgroundColor(TwoKNOSLabel, 255);
- TextDrawFont(TwoKNOSLabel, 2);
- TextDrawLetterSize(TwoKNOSLabel, 0.270000, 1.300000);
- TextDrawColor(TwoKNOSLabel, -1);
- TextDrawSetOutline(TwoKNOSLabel, 1);
- TextDrawSetProportional(TwoKNOSLabel, 1);
- TextDrawUseBox(TwoKNOSLabel, 1);
- TextDrawBoxColor(TwoKNOSLabel, 70);
- TextDrawTextSize(TwoKNOSLabel, 620.000000, 0.000000);
- TwoKNOSON = TextDrawCreate(492.000000, 117.000000, "~b~~h~~h~NOS ~w~has been toggled ~g~ON!");
- TextDrawBackgroundColor(TwoKNOSON, 255);
- TextDrawFont(TwoKNOSON, 3);
- TextDrawLetterSize(TwoKNOSON, 0.270000, 1.300000);
- TextDrawColor(TwoKNOSON, -1);
- TextDrawSetOutline(TwoKNOSON, 1);
- TextDrawSetProportional(TwoKNOSON, 1);
- TwoKNOSOFF = TextDrawCreate(492.000000, 117.000000, "~b~~h~~h~NOS ~w~has been toggled ~r~OFF!");
- TextDrawBackgroundColor(TwoKNOSOFF, 255);
- TextDrawFont(TwoKNOSOFF, 3);
- TextDrawLetterSize(TwoKNOSOFF, 0.270000, 1.300000);
- TextDrawColor(TwoKNOSOFF, -1);
- TextDrawSetOutline(TwoKNOSOFF, 1);
- TextDrawSetProportional(TwoKNOSOFF, 1);
- return 1;
- }
- public OnFilterScriptExit()
- {
- for(new u = 0; u < MAX_PLAYERS; u++)
- {
- p_UsingNos[u] = -1;
- print("[2K-NOS] - Unloaded.");
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- p_UsingNos[playerid] = -1;
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/nos", cmdtext, true, 4) == 0)
- {
- #if defined USE_MY_PRETTY_TEXTDRAWS
- if(p_UsingNos[playerid] == -1) {
- p_UsingNos[playerid] = 1;
- TextDrawShowForPlayer(playerid, Text:TwoKNOSLabel);
- TextDrawShowForPlayer(playerid, Text:TwoKNOSON);
- return SetTimerEx("HideTD", 3000, 0, "i", playerid);
- }
- else if(p_UsingNos[playerid] == 1) {
- p_UsingNos[playerid] = -1;
- TextDrawShowForPlayer(playerid, Text:TwoKNOSLabel);
- TextDrawShowForPlayer(playerid, Text:TwoKNOSOFF);
- return SetTimerEx("HideTD", 3000, 0, "i", playerid);
- }
- #else
- if(p_UsingNos[playerid] == -1) {
- new
- kstring[128] //I didn't count this; you could gain extra efficiency by counting the amount of characters!
- ;
- p_UsingNos[playerid] = 1;
- SendClientMessage(playerid, -1, "{0CA4F0}[2KNOS] NOS {FFFFFF}has been turned {138C03}on!");
- format(kstring, sizeof(kstring), "{0CA4F0}HINT: {FFFFFF}Press ~k~~CHOOSE_YOUR_OWN_KEY~ to stock/restock your NOS!");
- SendClientMessage(playerid, -1, kstring);
- return SendClientMessage(playerid, -1, "{FFFFFF}Type {0CA4F0}/nos {FFFFFF}again to turn it {BF0808}off!");
- }
- else {
- p_UsingNos[playerid] = -1;
- SendClientMessage(playerid, -1, "{0CA4F0}[2KNOS] NOS {FFFFFF}has been turned {BF0808}off!");
- return SendClientMessage(playerid, -1, "{FFFFFF}Type {0CA4F0}/nos {FFFFFF}again to turn it {138C03}on!");
- }
- #endif
- return 1;
- }
- return 0;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(PRESSED(CHOOSE_YOUR_OWN_KEY)) //Press RMB
- {
- if(IsPlayerInAnyVehicle(playerid)) {
- if(p_UsingNos[playerid] == 1) { //If they have 2KNOS toggled on..
- if(IsACar(GetPlayerVehicleID(playerid))) {
- AddVehicleComponent(GetPlayerVehicleID(playerid), 1010); //10x NOS
- }
- else return 0; //This vehicle would spam exceptions and crash players!
- }
- }
- }
- return 1;
- }
- stock IsACar( vehicleid ) //SmiT
- {
- new
- _vmodel = GetVehicleModel( vehicleid )
- ;
- switch ( _vmodel )
- {
- case 401, 402, 404 .. 409, 410 .. 412, 415, 416, 418 .. 421, 423, 426 .. 429, 431 .. 434, 436 .. 439, 442, 445, 449, 451: return true;
- case 457 .. 459, 466, 467, 474 .. 477, 479, 480, 483, 485, 486, 488, 490 .. 492, 494, 496, 504, 506 .. 508, 514 .. 518: return true;
- case 525 .. 530, 532 .. 542, 544 .. 547, 549 .. 551, 55, 558 .. 562, 565 .. 567, 571, 572, 574 .. 576, 583, 585: return true;
- case 587 .. 589, 596 .. 599, 601, 602, 603, 604: return true;
- }
- return false;
- }
- forward HideTD(playerid);
- public HideTD(playerid)
- {
- if(p_UsingNos[playerid] == 1) { //If it's already on..
- TextDrawHideForPlayer(playerid, Text:TwoKNOSLabel);
- return TextDrawHideForPlayer(playerid, Text:TwoKNOSON);
- }
- else if(p_UsingNos[playerid] == -1) {
- TextDrawHideForPlayer(playerid, Text:TwoKNOSLabel);
- return TextDrawHideForPlayer(playerid, Text:TwoKNOSOFF);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement