hali
pár dolog javítva
!!!nem volt netem!!!
telefonon wifizni meg szar ki irkálni ilyen forumra mert jelszo hegyén jelszó van meg minden egyébb nem tölti be nomálisan stb mindegy
nem én csinaltam csak kerestem nem találtam e még megvolt egy pendrivon azon belül egy poros helyen
elör elnézést hogy ha rossz helyre irom le nem találtam máshol új téma nyittást
eredeti két link
egyik
http://sampforum.hu/index.php?topic=38228.0Cappsy nek kicsit be szolnék
csak annyit hogy törölve lett
nekem meg megvolt ezért bocs
na mindegy
Cappsynél videó
www.youtube.com/watch?feature=player_embedded&v=PetpqU0TFCcés angol forum os oldal hiv forum
http://forum.sa-mp.com/showthread.php?t=329097Script gyors le írása
egy texdrawos
numpad hoz hasonló (billenytyűzet numpad jár a hasonló) kapu jelszavas kapu nyitó
ott van a forrás oldal
magyar forum
http://sampforum.hu/index.php?topic=38228.0angol forum
http://forum.sa-mp.com/showthread.php?t=329097letöltés:
http://www.solidfiles.com/d/6cfc16f048/keypad.rarkeypad.inc
/*
INTERACTIVE TEXTDRAW KEYPAD SCRIPT BY MIKE (MP2)
*/
/* = CHANGELOG = */
/*
1.0 (27th of March 2011)
- Initial release
### TO-DO ###
- Add \'retry\' parameter to CreateKeypad to allow multiple attempts
*/
/* ===[CONFIG]=== */
#define MAX_KEYPAD_KEY_LENGTH 10 // Max length for keypad key
#define KEYPAD_STAY_TIME 1000 // Time in miliseconds the keypad should stay on screen for after input (to show green/red light)
// Input types (for OnPlayerKeypadInput)
#define KEYPAD_INPUT_BAD 0 // Failed authorization
#define KEYPAD_INPUT_GOOD 1 // Successful authorization
#define KEYPAD_INPUT_CANCEL 2 // Called when ESC press to cancel keypad
// Macros
#define GetPlayerKeypad(%0) pKeypad[%0]
/* ===[VARIABLES, ARRAYS ETC.]=== */
new pKeypad[MAX_PLAYERS]; // Store the ID of the keypad that is open for a player
new pKeypadState[MAX_PLAYERS]; // 0=none 1=input 2=result
new pKeypadString[MAX_PLAYERS][MAX_KEYPAD_KEY_LENGTH+1]; // The string they have entered so far
new pKeypadKey[MAX_PLAYERS][MAX_KEYPAD_KEY_LENGTH+1]; // The key that is required for authorization
new Text:keypad_numbers[MAX_PLAYERS][10]; // Textdraws for the numbers
new Text:keypad_boxes[MAX_PLAYERS][12]; // + green and red box
new Text:keypad_background[MAX_PLAYERS]; // The grey background box
// Return codes for CreateKeypad
#define CREATEKEYPAD_RETURN_INVALID_ID 0 // ID must be 1+
#define CREATEKEYPAD_RETURN_NUM -1 // String is not a number sequence
#define CREATEKEYPAD_RETURN_INVALID_PLAYER -2 // \'playerid\' not connected
/*
native CreateKeypad(playerid, keypadID, key[]);
native DestroyKeypad(playerid);
*/
// Forwards
forward OnPlayerKeypadInput(playerid, keypadID, type, key);
stock CreateKeypad(playerid, keypadID, key[])
{
if(!IsPlayerConnected(playerid)) return CREATEKEYPAD_RETURN_INVALID_PLAYER;
if(keypadID < 1) return CREATEKEYPAD_RETURN_INVALID_ID; // Returns -1 if invalid keypad ID. Must be 1+
if(!keypad_IsNumeric(key)) return CREATEKEYPAD_RETURN_NUM; // Returns -2 if invalid key. Must be numbers only
format(pKeypadKey[playerid], MAX_KEYPAD_KEY_LENGTH, \"%s\", key);
pKeypad[playerid] = keypadID;
printf(\"Keypad létrehozva! Jelszó: %s\",key);
if(!pKeypadState[playerid]) // No keypad already open, create the textdraws
{
keypad_background[playerid] = TextDrawCreate(570.000000, 280.000000, \"_\");
TextDrawAlignment(keypad_background[playerid], 2);
TextDrawBackgroundColor(keypad_background[playerid], 255);
TextDrawFont(keypad_background[playerid], 2);
TextDrawLetterSize(keypad_background[playerid], 0.319999, 14.799995);
TextDrawColor(keypad_background[playerid], -1);
TextDrawSetOutline(keypad_background[playerid], 0);
TextDrawSetProportional(keypad_background[playerid], 1);
TextDrawSetShadow(keypad_background[playerid], 0);
TextDrawUseBox(keypad_background[playerid], 1);
TextDrawBoxColor(keypad_background[playerid], -1852730422);
TextDrawTextSize(keypad_background[playerid], 0.000000, 113.000000);
new keypad_box_coords[][] = {
{540, 290},
{570, 320},
{570, 290},
{600, 290},
{540, 320},
{600, 320},
{600, 350},
{570, 350},
{540, 350},
{570, 380}
};
for(new i=0; i<10; i++)
{
keypad_boxes[playerid] = TextDrawCreate(keypad_box_coords[0], keypad_box_coords[1], \"~N~~N~~N~\");
TextDrawAlignment(keypad_boxes[playerid], 2);
TextDrawBackgroundColor(keypad_boxes[playerid], 255);
TextDrawFont(keypad_boxes[playerid], 2);
TextDrawLetterSize(keypad_boxes[playerid], 0.319999, 0.899999);
TextDrawColor(keypad_boxes[playerid], -1);
TextDrawSetOutline(keypad_boxes[playerid], 0);
TextDrawSetProportional(keypad_boxes[playerid], 1);
TextDrawSetShadow(keypad_boxes[playerid], 0);
TextDrawUseBox(keypad_boxes[playerid], 1);
TextDrawBoxColor(keypad_boxes[playerid], 255);
TextDrawTextSize(keypad_boxes[playerid], 100.000000, 23.000000);
TextDrawShowForPlayer(playerid, keypad_boxes[playerid]);
}
new keypad_num_coords[][] = {
{570, 379},
{540, 289},
{570, 289},
{600, 289},
{540, 319},
{570, 319},
{600, 319},
{540, 349},
{570, 349},
{600, 349}
};
for(new i=0; i<10; i++)
{
new numstr[2];
format(numstr, 2, \"%i\", i);
keypad_numbers[playerid] = TextDrawCreate(keypad_num_coords[0], keypad_num_coords[1], numstr);
TextDrawAlignment(keypad_numbers[playerid], 2);
TextDrawBackgroundColor(keypad_numbers[playerid], 255);
TextDrawFont(keypad_numbers[playerid], 2);
TextDrawLetterSize(keypad_numbers[playerid], 0.550000, 2.599998);
TextDrawColor(keypad_numbers[playerid], -1);
TextDrawSetOutline(keypad_numbers[playerid], 0);
TextDrawSetProportional(keypad_numbers[playerid], 1);
TextDrawSetShadow(keypad_numbers[playerid], 0);
TextDrawTextSize(keypad_numbers[playerid], 23.000000, 23.000000);
TextDrawSetSelectable(keypad_numbers[playerid], 1);
TextDrawShowForPlayer(playerid, keypad_numbers[playerid]);
}
// Green and red boxes
keypad_boxes[playerid][10] = TextDrawCreate(540.000000, 380.000000, \"~N~~N~~N~\");
TextDrawAlignment(keypad_boxes[playerid][10], 2);
TextDrawBackgroundColor(keypad_boxes[playerid][10], 255);
TextDrawFont(keypad_boxes[playerid][10], 2);
TextDrawLetterSize(keypad_boxes[playerid][10], 0.319999, 0.899999);
TextDrawColor(keypad_boxes[playerid][10], -1);
TextDrawSetOutline(keypad_boxes[playerid][10], 0);
TextDrawSetProportional(keypad_boxes[playerid][10], 1);
TextDrawSetShadow(keypad_boxes[playerid][10], 0);
TextDrawUseBox(keypad_boxes[playerid][10], 1);
TextDrawBoxColor(keypad_boxes[playerid][10], 1375731967);
TextDrawTextSize(keypad_boxes[playerid][10], 0.000000, 23.000000);
// Pressable green key
keypad_boxes[playerid][11] = TextDrawCreate(600.000000, 380.000000, \"~N~~N~~N~\");
TextDrawAlignment(keypad_boxes[playerid][11], 2);
TextDrawBackgroundColor(keypad_boxes[playerid][11], 255);
TextDrawFont(keypad_boxes[playerid][11], 2);
TextDrawLetterSize(keypad_boxes[playerid][11], 0.319999, 0.899999);
TextDrawColor(keypad_boxes[playerid][11], -1);
TextDrawSetOutline(keypad_boxes[playerid][11], 0);
TextDrawSetProportional(keypad_boxes[playerid][11], 1);
TextDrawSetShadow(keypad_boxes[playerid][11], 0);
TextDrawUseBox(keypad_boxes[playerid][11], 1);
TextDrawBoxColor(keypad_boxes[playerid][11], 5374207);
TextDrawTextSize(keypad_boxes[playerid][11], 23.000000, 23.000000);
TextDrawShowForPlayer(playerid, keypad_boxes[playerid][10]);
TextDrawShowForPlayer(playerid, keypad_boxes[playerid][11]);
TextDrawShowForPlayer(playerid, keypad_background[playerid]);
SelectTextDraw(playerid, 0x00FF00FF);
pKeypadState[playerid] = 1;
}
pKeypadString[playerid] = \"\";
return 1;
}
stock DestroyKeypad(playerid)
{
if(!IsPlayerConnected(playerid)) return CREATEKEYPAD_RETURN_INVALID_PLAYER;
TextDrawDestroy(keypad_background[playerid]);
for(new e=0; e<10; e++) TextDrawDestroy(keypad_numbers[playerid][e]);
for(new e=0; e<12; e++) TextDrawDestroy(keypad_boxes[playerid][e]);
pKeypadState[playerid] = 0;
CancelSelectTextDraw(playerid);
return 1;
}
public OnPlayerConnect(playerid)
{
pKeypadState[playerid] = 0;
return CallLocalFunction(\"keypad_OnPlayerConnect\", \"i\", playerid);
}
#if defined _ALS_OnPlayerConnect
#undef OnPlayerConnect
#else
#define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect keypad_OnPlayerConnect
forward keypad_OnPlayerConnect(playerid);
public OnPlayerDisconnect(playerid, reason)
{
if(pKeypadState[playerid]) DestroyKeypad(playerid);
return CallLocalFunction(\"keypad_OnPlayerDisconnect\", \"ii\", playerid, reason);
}
#if defined _ALS_OnPlayerDisconnect
#undef OnPlayerDisconnect
#else
#define _ALS_OnPlayerDisconnect
#endif
#define OnPlayerDisconnect keypad_OnPlayerDisconnect
forward keypad_OnPlayerDisconnect(playerid, reason);
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
if(pKeypadState[playerid] == 1)
{
if(clickedid == Text:INVALID_TEXT_DRAW)
{
PlayerPlaySound(playerid, 21001, 0, 0, 0);
CallLocalFunction(\"OnPlayerKeypadInput\", \"iiii\", playerid, pKeypad[playerid], KEYPAD_INPUT_CANCEL, strval(pKeypadKey[playerid]));
return DestroyKeypad(playerid);
}
for(new i=0; i<10; i++)
{
if(clickedid == keypad_numbers[playerid])
{
new numstr[2];
format(numstr, 2, \"%i\", i);
strins(pKeypadString[playerid], numstr, strlen(pKeypadString[playerid]));
if(strlen(pKeypadString[playerid]) == strlen(pKeypadKey[playerid])) // Reached check point
{
if(strcmp(pKeypadString[playerid], pKeypadKey[playerid]) != 0) // Not the correct key
{
PlayerPlaySound(playerid, 21001, 0, 0, 0);
new keypad_memory = pKeypad[playerid];
pKeypad[playerid] = 0;
// Highlight red box
TextDrawBoxColor(keypad_boxes[playerid][10], 0xFF0000FF);
TextDrawHideForPlayer(playerid, keypad_boxes[playerid][10]);
TextDrawShowForPlayer(playerid, keypad_boxes[playerid][10]);
pKeypadState[playerid] = 2; // Still got keypad open, but don\'t allow more input
CancelSelectTextDraw(playerid);
CallLocalFunction(\"OnPlayerKeypadInput\", \"iiii\", playerid, keypad_memory, KEYPAD_INPUT_BAD, strval(pKeypadString[playerid]));
SetTimerEx(\"keypad_destroy\", KEYPAD_STAY_TIME, false, \"i\", playerid);
return 1;
}
else // Success!
{
PlayerPlaySound(playerid, 21002, 0, 0, 0);
TextDrawBoxColor(keypad_boxes[playerid][11], 0x00FF00FF);
TextDrawHideForPlayer(playerid, keypad_boxes[playerid][11]);
TextDrawShowForPlayer(playerid, keypad_boxes[playerid][11]);
pKeypadState[playerid] = 2; // Still got keypad open, but don\'t allow more input
CancelSelectTextDraw(playerid);
new keypad_memory = pKeypad[playerid];
pKeypad[playerid] = 0;
SetTimerEx(\"keypad_destroy\", KEYPAD_STAY_TIME, false, \"i\", playerid);
CallLocalFunction(\"OnPlayerKeypadInput\", \"iiii\", playerid, keypad_memory, KEYPAD_INPUT_GOOD, strval(pKeypadString[playerid]));
return 1;
}
}
PlayerPlaySound(playerid, 21000, 0, 0, 0);
return 1;
}
}
}
return CallLocalFunction(\"myinc_OnPlayerClickTextDraw\", \"ii\", playerid, _:clickedid);
}
#if defined _ALS_OnPlayerClickTextDraw
#undef OnPlayerClickTextDraw
#else
#define _ALS_OnPlayerClickTextDraw
#endif
#define OnPlayerClickTextDraw myinc_OnPlayerClickTextDraw
forward myinc_OnPlayerClickTextDraw(playerid, Text:clickedid);
forward keypad_destroy(playerid);
public keypad_destroy(playerid)
{
DestroyKeypad(playerid);
return 1;
}
stock keypad_IsNumeric(const isthisnumeric[])
{
if(!strlen(isthisnumeric)) return 0;
for(new i = 0; i < strlen(isthisnumeric); i++)
{
if(isthisnumeric > \'9\' || isthisnumeric < \'0\') return 0;
}
return 1;
}
pawncode
#include <a_samp>
#include <keypad>
#define KEYPAD_BLASTDOOR 1 // The ID for the keypad we will use
#define COLOR_RED 0xFF0000FF
new blast_door_obj; // The blast door object
new blast_door_open; // 0=closed 1=open
new failed_attempts;
main() {}
public OnGameModeInit()
{
AddPlayerClass(287,269.0947,1816.5649,4.7031,270,WEAPON_M4,99999,WEAPON_DEAGLE,99999,WEAPON_ROCKETLAUNCHER,99999);
blast_door_obj = CreateObject(2951, 297.750427, 1821.698852, 6.818514, 0.000000, 0.000000, 0.000000);
CreateObject(2922, 300.285827, 1820.455688, 8.420514, 0.000000, 0.000000, 90.000000);
CreateObject(2951, 277.450408, 1821.668823, 6.818513, 0.000000, 0.000000, 0.000000);
CreateObject(2951, 264.481964, 1816.567749, 6.566123, 0.000000, 90.000000, 90.000000);
CreateObject(2951, 264.481964, 1816.582397, 6.566123, 0.000000, 90.000000, 270.000000);
// Invisible walls to prevent escape
CreateObject(19382, 259.803558, 1818.141113, 3.653130, 0.000000, 90.000000, 0.000000);
CreateObject(19382, 259.803558, 1820.141113, 3.653130, 0.000000, 90.000000, 0.000000);
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetTimerEx(\"auto_spawn\", 123, 0, \"i\", playerid);
return 1;
}
forward auto_spawn(playerid);
public auto_spawn(playerid)
{
SpawnPlayer(playerid); // Skip class selection
return 1;
}
public OnPlayerSpawn(playerid)
{
if(!blast_door_open) SetPlayerCheckpoint(playerid, 299.4105,1820.4812,7.8205, 1);
SendClientMessage(playerid, -1, \"Welcome to the example gamemode for {FFFF82}Mike (MP2)\'s{FFFFFF} keypad include.\");
SendClientMessage(playerid, -1, \"Enter the {B3191F}checkpoint{FFFFFF} to access the keypad.\");
SendClientMessage(playerid, -1, \"The code is {FFFF82}1337{FFFFFF}.\");
SendClientMessage(playerid, 0x00FF00FF, \"Enjoy!\");
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
// Create a keypad for \'playerid\' with the defined ID of \'KEYPAD_BLASTDOOR\' (see top of script) with the key \'1337\'
new result = ShowPlayerKeypad(playerid, KEYPAD_BLASTDOOR, \"1337\");
if(result == CREATEKEYPAD_RETURN_INVALID_ID) return SendClientMessage(playerid, COLOR_RED, \"Invalid keypad ID passed to CreateKeypad().\");
if(result == CREATEKEYPAD_RETURN_NUM) return SendClientMessage(playerid, COLOR_RED, \"Invalid keypad string (non-numerical) passed to CreateKeypad().\");
return 1;
}
public OnPlayerKeypadInput(playerid, keypadID, type, key) // \'key\' contains the number that has already been entered in it\'s entirety
{
if(keypadID == KEYPAD_BLASTDOOR && type == KEYPAD_INPUT_GOOD)
{
OpenBlastDoor(); // Open the blast door!
for(new i=0; i<MAX_PLAYERS; i++)
{
DisablePlayerCheckpoint(i);
if(GetPlayerKeypad(i) == KEYPAD_BLASTDOOR) HideKeypad(i); // If any other players have the blast door keypad open, close it
}
GameTextForPlayer(playerid, \"~G~access granted\", 3000, 3);
failed_attempts = 0; // Reset failed attempts
}
else if(keypadID == KEYPAD_BLASTDOOR && type == KEYPAD_INPUT_BAD)
{
GameTextForPlayer(playerid, \"~R~access denied\", 3000, 3);
failed_attempts++;
if(failed_attempts == 3)
{
for(new i=0; i<MAX_PLAYERS; i++) DisablePlayerCheckpoint(i);
PlaySoundForAll(13610);
SetTimer(\"sound_alarm\", 4000, false);
SetTimer(\"alarm_off\", 20000, false);
failed_attempts = 0; // Reset the counter
}
}
return 1;
}
forward sound_alarm();
public sound_alarm()
{
PlaySoundForAll(6001);
return 1;
}
forward alarm_off();
public alarm_off()
{
PlaySoundForAll(13606);
for(new i=0; i<MAX_PLAYERS; i++)
{
SetPlayerCheckpoint(i, 299.4105,1820.4812,7.8205, 1);
}
return 1;
}
stock OpenBlastDoor()
{
MoveObject(blast_door_obj, 297.750427, 1821.698852, 6.818514 + 3.5, 0.5);
blast_door_open = 1;
PlaySoundForAll(1153, 297.750427, 1821.698852, 6.818514);
SetTimer(\"close_blast_door\", 10000, 0);
return 1;
}
forward close_blast_door();
public close_blast_door()
{
MoveObject(blast_door_obj, 297.750427, 1821.698852, 6.818514, 0.5);
blast_door_open = 0;
for(new i=0; i<MAX_PLAYERS; i++)
{
SetPlayerCheckpoint(i, 299.4105,1820.4812,7.8205, 1);
}
PlaySoundForAll(1153, 297.750427, 1821.698852, 6.818514);
return 1;
}
public OnObjectMoved(objectid)
{
if(objectid == blast_door_obj)
{
PlaySoundForAll(1154, 297.750427, 1821.698852, 6.818514);
}
return 1;
}
stock PlaySoundForAll(soundid, Float:x=0.0, Float:y=0.0, Float:z=0.0)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
PlayerPlaySound(i, soundid, x, y, z);
}
return 1;
}
nincs modositás
ha vlamit rosszul csináltam szivböl elnézést kérek
forum szabályzatot nmnagyjábol átolvastam