Szerző Téma: Re:Interactive Textdraw Keypad - Avagy a textdrawos kapunyitó  (Megtekintve 366 alkalommal)

Nem elérhető Cappsy

  • Adminisztrátor
  • 2754
    • Profil megtekintése
Re:Interactive Textdraw Keypad - Avagy a textdrawos kapunyitó
« Dátum: 2013. február 12. - 18:09:45 »
0 Show voters
-
« Utoljára szerkesztve: 2013. február 12. - 18:31:09 írta cappsy »

Re:Interactive Textdraw Keypad - Avagy a textdrawos kapunyitó
« Válasz #1 Dátum: 2013. szeptember 10. - 18:24:38 »
0 Show voters
nekem a pawn kidobott pár hibat de itt van javitva csak a \";\" hoanyzott pár helyröl
 
#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;
}

 ha további hibakat csinal valakinél akkor hianyozhat a \";\" ahogy emlitettem nalam hianyolta a fent ki rakott inculde nal helyesirasi hibakert bocsi angol windowsom van mert igy jobb

Nem elérhető Gh0st

  • 917
    • Profil megtekintése
Re:Interactive Textdraw Keypad - Avagy a textdrawos kapunyitó
« Válasz #2 Dátum: 2013. szeptember 10. - 18:45:04 »
0 Show voters
Idézetet írta: drakhen date=1378830278\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"42584\" data-ipsquote-contentclass=\"forums_Topic
nekem a pawn kidobott pár hibat de itt van javitva csak a \";\" hoanyzott pár helyröl
 
#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;
}

 ha további hibakat csinal valakinél akkor hianyozhat a \";\" ahogy emlitettem nalam hianyolta a fent ki rakott inculde nal helyesirasi hibakert bocsi angol windowsom van mert igy jobb
 
Az,hogy angol windowsod van,hogy függ össze a helyesírásoddal? :facepalm:

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal