Itt van egy, a koordinátákat majd írd át.
[pawn]#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;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(\"/nyit\", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 299.4105,1820.4812,7.8205))
{
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;
}
}
return 0;
}[/pawn]
(Nem biztos, hogy jó)