Szerző Téma: Frakció Kapu  (Megtekintve 892 alkalommal)

Frakció Kapu
« Dátum: 2016. Március 18. - 22:55:45 »
0 Show voters
Sziasztok!
Egy IG kezelhető frakció kapu scriptre lenne szükségem hogy IG létrelehessen hozni egy kaput egy adott frakcióhoz kötve és azt csak a frakció tagjai tudják kinyitni/bezárni! És ha lehet mentés is kellene hozzá :)
Előre is köszönöm! :)

Frakció Kapu
« Válasz #1 Dátum: 2016. Március 21. - 09:10:35 »
0 Show voters
Találtam az angol sampfórumon egy olyasmi kapu rendszert amire nekem is szükségem lenne.
Esetleg ebből valaki megtudná nekem azt csinálni hogy a kapu jelszava helyett egy frakció id-t keljen megadni és a kaput csak a megadott frakcióhoz tartozó tagok tudják kinyitni ?
Előre is köszönöm! :)
Forrás: http://samp-scripts.com/post/15729/Dynamic_gate_system_(Moveable,_labels_,_new_features)/SilentSoul/filterscript/systems
Kód:
 
#define FILTERSCRIPT
#include <a_samp>
#include <sscanf2>
#include <YSI\\y_commands>
#include <YSI\\y_ini>
#include <easyDialog>
#define GatePath  \"gates/%d.ini\"
#define MAX_GATES 200//You can edit but not recommended through looping to all gates.
#if defined FILTERSCRIPT
new
        gateedit;
enum ginfo
{
    gID,
    gModel,
    gOpened,
    gClosed,
    Float:gPosx,
    Float:gPosy,
    Float:gPosz,
    Float:gRox,
    Float:gRoy,
    Float:gRoz,
    gText1[20],
    Gatepass[4],
}
new GateInfo[MAX_GATES][ginfo];
public OnFilterScriptInit()
{
        for(new i = 0; i <= MAX_GATES; i++)
        {
               new
                   gFile[35];
                format(gFile, 35, GatePath ,i);
                if(fexist(gFile))
                {
                        INI_ParseFile(gFile, \"LoadGates\", .bExtra = true, .extra = i);
                        Loadgate(i);
                }
        }
        if(!fexist(\"gates\"))
    {
    print(\"  [Gate system] - Warning!!! You haven\'t create folder \'gates\' yet.\");
    }
        if(fexist(\"gates\"))
        {
        print(\"  [Gate system] - has been loaded , Creator : SilentSoul.\");
        }
        return 1;
}
stock Loadgate(i)
{
        GateInfo[gModel] = CreateObject(GateInfo[gModel],GateInfo[gPosx],GateInfo[gPosy],GateInfo[gPosz],GateInfo[gRox],GateInfo[gRoy],GateInfo[gRoz],90.0);
        GateInfo[gText1] = SetObjectMaterialText(GateInfo[gModel], \"{FFFFFF}Press {FF0000}Y{FFFFFF} to open\", 0, OBJECT_MATERIAL_SIZE_256x128,\\\"Arial\", 28, 0, 0xFFFF8200, 0xFF000000, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
}
public OnFilterScriptExit()
{
        return 1;
}
forward LoadGates(id, name[], value[]);
public LoadGates(id, name[], value[])
{
    INI_Int(\"Model\", GateInfo[id][gModel]);
    INI_Int(\"Opened\", GateInfo[id][gOpened]);
    INI_Int(\"Closed\", GateInfo[id][gClosed]);
    INI_String(\"Password\", GateInfo[id][Gatepass],4);
    INI_Float(\"gPosx\", GateInfo[id][gPosx]);
    INI_Float(\"gPosy\", GateInfo[id][gPosy]);
    INI_Float(\"gPosz\", GateInfo[id][gPosz]);
    INI_Float(\"gRox\", GateInfo[id][gRox]);
    INI_Float(\"gRoy\", GateInfo[id][gRoy]);
    INI_Float(\"gRoz\", GateInfo[id][gRoz]);
    INI_String(\"Text1\", GateInfo[id][gText1],20);
    return 1;
}
YCMD:gate(playerid,params[],help)
{
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,\"{FF0000}ERROR: You\'re not authorized to use this command only rcon administrator.\");
       Dialog_Show(playerid, Gate, DIALOG_STYLE_LIST, \"{05A300}Gate menu\", \"{FFFFFF}Create gate\\n{FFFFFF}Edit gate\\n{FFFFFF}Delete gate\\n{FFFFFF}Delete all gates\\n{FFFFFF}Reload all gates\", \"Select\", \"Cancel\");
        return 1;
}
YCMD:gateinfo(playerid, params[], help)
{
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,\"{FF0000}ERROR: You\'re not authorized to use this command only rcon administrator.\");
        for( new i = 0; i != MAX_GATES; i++ )
        {
                if(IsPlayerInRangeOfPoint( playerid, 10.0, GateInfo[gPosx], GateInfo[gPosy], GateInfo[gPosz]))
                {
                        new
                                string[600];
                        format(string,128, \"{FFFFFF}GateID:{FFCC00} %d | {FFFFFF}GateModel:{FFCC00} %d |{FFFFFF} GatePosx:{FFCC00} %.0f |{FFFFFF} GatePosy:{FFCC00} %.0f |{FFFFFF} GatePosz:{FFCC00} %.0f|{FFFFFF} GateText:{FFCC00} %s\",GateInfo[gID],GateInfo[gModel],GateInfo[gPosx],GateInfo[gPosy],GateInfo[gPosz],GateInfo[gText1]);
                        SendClientMessage(playerid, -1, string);
                        return 1;
                }
        }
        return 1;
}
Dialog:Gate(playerid, response, listitem, inputtext[])
{
        if(response)
        {
            if(listitem == 0)
            {
                        Dialog_Show(playerid,gatecreate,DIALOG_STYLE_LIST,\"{05A300}Choose gate\",\"{FFFFFF}Gate 1\\n{FFFFFF}Gate 2\\n{FFFFFF}Gate 3\\n{FFFFFF}Gate 4\",\"Select\",\"Cancel\");
            }
            if(listitem == 1)
            {
                Dialog_Show(playerid,editgate,DIALOG_STYLE_INPUT ,\"{05A300}Edit gate\",\"{FFFFFF}Please insert gate id you want to edit.\\n»{FFCC00}Note{FFFFFF}: Do not exceed the maximum gate id otherwise may cause a crash.\",\"Select\",\"\");
            }
            if(listitem == 2)
            {
                Dialog_Show(playerid,delconfirm2,DIALOG_STYLE_INPUT ,\"{05A300}Delete confirmation\",\"»{FFCC00}Insert {FFFFFF}the gate you wish to delete!\",\"Select\",\"\");
            }
            if(listitem == 3)
            {
                Dialog_Show(playerid, delconfirm, DIALOG_STYLE_MSGBOX, \"{05A300}Delete confirmation\", \"{FFFFFF}Are you sure you want to delete all gates ?\\n»{FFCC00}Note {FFFFFF}: You can\'t restore gates , also all created gates will be deleted.\", \"Select\", \"Cancel\");
            }
            if(listitem == 4)
            {
                        new
                            string[64];
                        format(string,sizeof(string),\"reloadfs Gatesystem\");
                        SendRconCommand(string);
                        for(new i = 0; i < 50; i++) SendClientMessage(playerid,-1,\" \");
                        SendClientMessage(playerid,-1,\"»{FFCC00}Gate -{FFFFFF} All gates has been re-loaded\");
            }
        }
        return 1;
}
Dialog:delconfirm2(playerid, response, listitem, inputtext[])
{
        if(response)
        {
                new string[64];
              format(string, sizeof(string), GatePath, strval(inputtext));
                if(strval(inputtext) >= MAX_GATES) return SendClientMessage(playerid,-1,\"»{FFCC00}Gate {FFFFFF} - You\'ve exceed the maximum limits of gates allowed.\");
              if(!strval(inputtext)) return SendClientMessage( playerid, -1, \"»{FFCC00}Gate {FFFFFF} - Insert numbers only please.\" );
                if(!fexist(string)) return SendClientMessage(playerid, -1, \"»{FFCC00}Gate {FFFFFF} - You\'ve entered wrong gate id (not exists).\");
                new
                    string2[64],string3[126];
                format(string2,sizeof(string2),\"/gates/%d.ini\",strval(inputtext));
              fremove(string2);
              format(string3,sizeof(string3),\"»{FFCC00}Gate -{FFFFFF} You\'ve sucussfully deleted GateID :{FFCC00} %d\",strval(inputtext));
              SendClientMessage(playerid,-1,string3);
        }
        return 1;
}
Dialog:delconfirm(playerid, response, listitem, inputtext[])
{
        if(response)
        {
                for(new i = 0; i <= MAX_GATES; i++)
                {
                      new
                         gFile[35];
                        format(gFile, 35, GatePath ,i);
                        if(fexist(gFile))
                        {
                            fremove(gFile);
                            SendClientMessage(playerid,-1,\"»{FFCC00}Gate - {FFFFFF}All gates has sucussfully removed.\");
                                new
                                   string[64];
                                format(string,sizeof(string),\"reloadfs Gatesystem\");
                                SendRconCommand(string);
                        }
                }
        }
        return 1;
}
Dialog:editgate(playerid, response, listitem, inputtext[])
{
        if(response)
        {
               new
                   string[64];
              format(string, sizeof(string), GatePath, strval(inputtext));
                if(strval(inputtext) >= MAX_GATES) return SendClientMessage(playerid,-1,\"»{FFCC00}Gate {FFFFFF} - You\'ve exceed the maximum limits of gates allowed.\");
              if(!strval(inputtext)) return SendClientMessage( playerid, -1, \"»{FFCC00}Gate {FFFFFF} - Insert numbers only please.\" );
                if(!fexist(string)) return SendClientMessage(playerid, -1, \"»{FFCC00}Gate {FFFFFF} - You\'ve entered wrong gate id (not exists).\");
                new
                    string2[64];
                format(string2,sizeof(string2),\"{FFFFFF}GateID :%d\",strval(inputtext));
                Dialog_Show(playerid,editgate22,DIALOG_STYLE_LIST,string2,\"Move gate\\nDelete gate\",\"Select\",\"\");
                SetPVarInt(playerid,\"gatedeleteid\",strval(inputtext));
        }
        return 1;
}
Dialog:editgate22(playerid, response, listitem, inputtext[])
{
        if(response)
        {
            if(listitem == 0)
            {
            }
                if(listitem == 1)
                {
                        new
                        string2[64],string3[64];
                        format(string2,sizeof(string2),\"/gates/%d.ini\",GetPVarInt(playerid,\"gatedeleteid\"));
                fremove(string2);
                format(string3,sizeof(string3),\"»{FFCC00}Gate - {FFFFFF}You\'ve sucussfully deleted GateID :{FFCC00} %d\",GetPVarInt(playerid,\"gatedeleteid\"));
                SendClientMessage(playerid,-1,string3);
                }
        }
        return 1;
}
Dialog:gatecreate(playerid, response, listitem, inputtext[])
{
        if(response)
        {
            if(listitem == 0)
            {
                        Dialog_Show(playerid,confirm1,DIALOG_STYLE_INPUT,\"{05A300}GateID\",\"{FFFFFF}Please choose new gate id not created before for\\n»{FFCC00}Note {FFFFFF}: Don\'t create id already created in gates path.\\nChoosen GateID :{FFCC00} Gate 1\",\"Select\",\"\");
            }
            if(listitem == 1)
            {
                        Dialog_Show(playerid,confirm2,DIALOG_STYLE_INPUT,\"{05A300}GateID\",\"{FFFFFF}Please choose new gate id not created before\\n»{FFCC00}Note {FFFFFF}: Don\'t create id already created in gates path.\\nChoosen GateID :{FFCC00} Gate 2\",\"Select\",\"\");
            }
            if(listitem == 2)
            {
                        Dialog_Show(playerid,confirm3,DIALOG_STYLE_INPUT,\"{05A300}GateID\",\"{FFFFFF}Please choose new gate id not created before\\n»{FFCC00}Note {FFFFFF}: Don\'t create id already created in gates path.\\nChoosen GateID :{FFCC00} Gate 3\",\"Select\",\"\");
            }
            if(listitem == 3)
            {
                      Dialog_Show(playerid,confirm4,DIALOG_STYLE_INPUT,\"{05A300}GateID\",\"{FFFFFF}Please choose new gate id not created before\\n»{FFCC00}Note {FFFFFF}: Don\'t create id already created in gates path.\\nChoosen GateID :{FFCC00} Gate 3\",\"Select\",\"\");
            }
            return 1;
        }
        return 1;
}
Dialog:confirm1(playerid, response, listitem, inputtext[])
{
        if(response)
        {
                new
                   string[64],string2[64];
                format(string2,sizeof(string2),\"»{FFCC00}Gate {FFFFFF}- Insert number between 1-%d\",MAX_GATES);
              format(string, sizeof(string), GatePath, strval(inputtext));
                if(strval(inputtext) >= MAX_GATES) return SendClientMessage(playerid,-1,string2);
              if(!strval(inputtext)) return SendClientMessage( playerid, -1, \"»{FFCC00}Gate - {FFFFFF}Insert numbers only please.\" );
                if(fexist(string)) return SendClientMessage(playerid, -1, \"»{FFCC00}Gate - {FFFFFF} A gate already created on the same id , choose another one.\");
                new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
        gateedit = CreateObject(988, x, y+2.5, z, 0.0, 0.0, 0.0);
        EditObject(playerid,gateedit);
        SetPVarInt(playerid, \"gatemodel\", 988);
        SetPVarInt(playerid,\"file\",strval(inputtext));
        }
        return 1;
}
Dialog:confirm2(playerid, response, listitem, inputtext[])
{
        if(response)
        {
                new
                   string[64],string2[64];
                format(string2,sizeof(string2),\"Gate - Insert number between 1-%d\",MAX_GATES);
              format(string, sizeof(string), GatePath, strval(inputtext));
                if(strval(inputtext) >= MAX_GATES) return SendClientMessage(playerid,-1,string2);
              if(!strval(inputtext)) return SendClientMessage( playerid, -1, \"Gate - Insert numbers only please.\" );
                if(fexist(string)) return SendClientMessage(playerid, -1, \"»{FFCC00}Gate {FFFFFF} - A gate already created on the same id , choose another one.\");
                new
                   Float:x,Float:y,Float:z;
                GetPlayerPos(playerid,x,y,z);
        gateedit = CreateObject(985, x, y+2.5, z, 0.0, 0.0, 0.0);
        EditObject(playerid,gateedit);
        SetPVarInt(playerid, \"gatemodel\", 985);
        SetPVarInt(playerid,\"file\",strval(inputtext));
        }
        return 1;
}
Dialog:confirm3(playerid, response, listitem, inputtext[])
{
        if(response)
        {
                new
                        string[64],string2[64];
                format(string2,sizeof(string2),\"Gate - Insert number between 1-%d\",MAX_GATES);
              format(string, sizeof(string), GatePath, strval(inputtext));
                if(strval(inputtext) >= MAX_GATES) return SendClientMessage(playerid,-1,string2);
              if(!strval(inputtext)) return SendClientMessage( playerid, -1, \"»{FFCC00}Gate {FFFFFF} - Insert numbers only please.\" );
                if(fexist(string)) return SendClientMessage(playerid, -1, \"»{FFCC00}Gate {FFFFFF}- A gate already created on the same id , choose another one.\");
                new Float:x,Float:y,Float:z;
                GetPlayerPos(playerid,x,y,z);
        gateedit = CreateObject(986, x, y+2.5, z, 0.0, 0.0, 0.0);
        EditObject(playerid,gateedit);
        SetPVarInt(playerid, \"gatemodel\", 986);
        SetPVarInt(playerid,\"file\",strval(inputtext));
        }
        return 1;
}
Dialog:confirm4(playerid, response, listitem, inputtext[])
{
        if(response)
        {
                new
                   string[64],string2[64];
                format(string2,sizeof(string2),\"Gate - Insert number between 1-%d\",MAX_GATES);
              format(string, sizeof(string), GatePath, strval(inputtext));
                if(strval(inputtext) >= MAX_GATES) return SendClientMessage(playerid,-1,string2);
              if(!strval(inputtext)) return SendClientMessage( playerid, -1, \"»{FFCC00}Gate {FFFFFF} - Insert numbers only please.\" );
                if(fexist(string)) return SendClientMessage(playerid, -1, \"»{FFCC00}Gate {FFFFFF} - A gate already created on the same id , choose another one.\");
                new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
        gateedit = CreateObject(971, x, y+2.5, z, 0.0, 0.0, 0.0);
        EditObject(playerid,gateedit);
        SetPVarInt(playerid, \"gatemodel\", 971);
        SetPVarInt(playerid,\"file\",strval(inputtext));
        }
        return 1;
}
public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
{
        if(response == EDIT_RESPONSE_FINAL)
        {
               new fileid[30];
                Create3DTextLabel(\"Press \'Y\' To Open\", -1, fX, fY, fZ, 20.0, 0, 0);
                SendClientMessage(playerid,-1,\"»{FFCC00}Gate {FFFFFF} - You\'ve sucussfully placed gate\");
              GetPVarString(playerid, \"file\", fileid, 30);
                CreateGate(GetPVarInt(playerid, \"file\"), playerid, fX, fY, fZ, fRotX, fRotY, fRotZ);
               SendClientMessage(playerid,-1,\"»{FFCC00}Gate {FFFFFF} - Gate has been sucussfully saved!\");
                DeletePVar(playerid,\"gatemodel\");
        }
        if(response == EDIT_RESPONSE_CANCEL)
        {
                DestroyObject(objectid);
        }
}
CreateGate(fileid, playerid, Float: fX, Float: fY, Float: fZ, Float: fRotX, Float: fRotY, Float: fRotZ)
{
    new file[35];
    format(file, 35, GatePath, fileid);
    new INI:File = INI_Open(file);
    INI_SetTag(File,\"Gate data\");
    INI_WriteInt(File,\"Model\", GetPVarInt(playerid, \"gatemodel\"));
    INI_WriteString(File,\"Password\", \"Changeme\");
    INI_WriteInt(File,\"Opened\", 0);
    INI_WriteInt(File,\"Closed\", 1);
    INI_WriteFloat(File,\"gPosx\", fX);
    INI_WriteFloat(File,\"gPosy\", fY);
    INI_WriteFloat(File,\"gPosz\", fZ);
    INI_WriteFloat(File,\"gRox\", fRotX);
    INI_WriteFloat(File,\"gRoy\", fRotY);
    INI_WriteFloat(File,\"gRoz\", fRotZ);
    INI_WriteString(File,\"Text1\", \"Press \'Y\' to open!\");
    INI_WriteString(File,\"Text2\", \"Changeme\");
    INI_Close(File);
}
#else
main()
{
        print(\"\\n----------------------------------\");
        print(\" Blank Gamemode by your name here\");
        print(\"----------------------------------\\n\");
}
#endif
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
        if(newkeys & KEY_YES)
        {
                for(new i = 0; i <= MAX_GATES; i++)
                {
                        if( IsPlayerInRangeOfPoint( playerid, 10.0, GateInfo[gPosx], GateInfo[gPosy], GateInfo[gPosz] ) )
                        {
                            if(GateInfo[gClosed] == 1)
                            {
                            MoveObject(GateInfo[gModel],GateInfo[gPosx], GateInfo[gPosy], GateInfo[gPosz]-7,3.5);
                            GameTextForPlayer(playerid,\"~g~Opening gate\",1000,3);
                            GateInfo[gOpened] =1;
                            GateInfo[gClosed] =0;
                            }
                            else if(GateInfo[gOpened] == 1)
                            {
                            MoveObject(GateInfo[gModel],GateInfo[gPosx], GateInfo[gPosy], GateInfo[gPosz],3.5);
                            GameTextForPlayer(playerid,\"~r~Closing gate\",1000,3);
                                GateInfo[gClosed] =1;
                                GateInfo[gOpened] =0;
                            }
                        }
                }
        }
        return 1;
}
public OnGameModeInit()
{
        // Don\'t use these lines if it\'s a filterscript
        SetGameModeText(\"Blank Script\");
        AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
        return 1;
}
public OnGameModeExit()
{
        return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
        if(success)
        {
            SetTimer(\"rcon\",300,false);
        }
        return 1;
}
forward rcon(playerid);
public rcon(playerid)
{
    SendClientMessage(playerid,-1,\"»{FFCC00}Gate rcon {FFFFFF}-Gate system has detected your rcon login , use {FFCC00}/gate {FFFFFF}- {FFCC00}/gateinfo.\");
}

Frakció Kapu
« Válasz #2 Dátum: 2016. Március 21. - 14:36:07 »
0 Show voters
See modba benne van, másoljátok ki :D

Nem elérhető whadez

  • 719
  • DEFEATER
    • Profil megtekintése
Frakció Kapu
« Válasz #3 Dátum: 2016. Március 21. - 17:06:32 »
0 Show voters
Nem áll módomban - OFF - olni, viszont miért nem nézelődsz először körül fórumon, és keresel egyet, mielőtt nyitsz egy témát?  :blink:
Ezek mellett ha Látás módhoz kell neked kapurendszer, akkor miért nem jó ami ott van?  :weep:
Nem úgy működik sajnos ez az egész pawn hogy letöltesz valamit, és communitys scriptekből össze raksz egy szervert  :crybaby:
Milyen módhoz kell neked kapurendszer?  :unsure:
Jobban járnál ha saját magad írnál egyet, sok időt megspórolsz vele.  :$
 :wave:

Nem elérhető BackUP

  • 908
    • Profil megtekintése
Frakció Kapu
« Válasz #4 Dátum: 2016. Március 21. - 17:28:53 »
0 Show voters
Senki nem írta, hogy neki See módhoz kellene. Amit első hozzászóló linkelt azt fel tudod használni, első hozzászólónak pedig üzenem hogy ahhoz meg kell adnod sok infót a mododról, még így is hogy max 2-3 sort kell átírni. Meg tudod oldani magad is józan paraszti ésszel, ha már rp módba kezdtél ez nem szabad kihívás legyen.

Frakció Kapu
« Válasz #5 Dátum: 2016. Március 21. - 22:51:43 »
+1 Show voters
Hát már próbálkoztam vele nem véletlenűl kértem a segítséget bár ahogy láttam helyette inkább leszólásokat kaptam... Amit csinálok szervert köze nincs a see módhoz ha lenne akkor nem kérnék olyan scriptet ami már van benne..

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal