Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /****************************************************************************************************************************************************************************
- *****************************************************************************************************************************************************************************
- *****************************************************************************************************************************************************************************
- ***********************************************************************__________________************************************************************************************
- **********************************************************************| Gate System |***********************************************************************************
- **********************************************************************| |***********************************************************************************
- **********************************************************************| By |***********************************************************************************
- **********************************************************************| Gireada |***********************************************************************************
- **********************************************************************| |***********************************************************************************
- **********************************************************************| |***********************************************************************************
- **********************************************************************| |***********************************************************************************
- **********************************************************************| |***********************************************************************************
- **********************************************************************| |***********************************************************************************
- **********************************************************************---------------------************************************************************************************
- */
- //Nu stergeti Creditele.
- #include <a_samp>
- #include <dini>
- #include <zcmd>
- #include <sscanf2>
- #include <mSelection>
- #define MAX_POARTA 100
- new Poarta[MAX_POARTA];
- new porti = mS_INVALID_LISTID;
- new poartastatus[MAX_POARTA];
- new setinchisa[MAX_PLAYERS];
- new setdeschisa[MAX_PLAYERS];
- new editpoarta[MAX_PLAYERS];
- new Text3D:porttextlabel[1000];
- forward LoadPoarta();
- forward SaveThisPoarta(poartaid);
- forward SendAdminMesaj(color,const string[]);
- enum portaData
- {
- ID,
- Model,
- Float:Timer,
- Float:Inchisax,
- Float:Inchisay,
- Float:Inchisaz,
- Float:Inchisarx,
- Float:Inchisary,
- Float:Inchisarz,
- Float:Deschisax,
- Float:Deschisay,
- Float:Deschisaz,
- Float:Deschisarx,
- Float:Deschisarz,
- Float:Deschisary,
- };
- new PoartaInfo[MAX_POARTA][portaData];
- public OnFilterScriptInit()
- {
- porti = LoadModelSelectionMenu("porti.txt");
- LoadPoarta();
- print("\n--------------------------------------");
- print(" Sistem de Poarti by Gireada");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- main()
- {
- print("\n----------------------------------");
- print(" Sistem de Poarti by Gireada");
- print("----------------------------------\n");
- }
- CMD:createpoarta(playerid, params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- ShowModelSelectionMenu(playerid, porti, "Porti");
- }
- return 1;
- }
- CMD:dpoarta(playerid, params[])
- {
- new poartaid;
- if(unformat(params, "i", poartaid))
- {
- SendClientMessage(playerid, 0xFF0000AA, "Usage: /dpoarta <idpoarta>");
- return 1;
- }
- if(!IsValidObject(Poarta[poartaid]))
- {
- SendClientMessage(playerid, 0xFF0000AA, "Acea poarta nu exista");
- return 1;
- }
- if(IsPlayerAdmin(playerid))
- {
- if(poartastatus[poartaid] == 0)
- {
- MoveObject(Poarta[poartaid], PoartaInfo[poartaid][Deschisax], PoartaInfo[poartaid][Deschisay], PoartaInfo[poartaid][Deschisarz], PoartaInfo[poartaid][Timer],\
- PoartaInfo[poartaid][Deschisarx],PoartaInfo[poartaid][Deschisary], PoartaInfo[poartaid][Deschisarz]);
- poartastatus[poartaid] = 1;
- }
- else if(poartastatus[poartaid] == 1)
- {
- MoveObject(Poarta[poartaid], PoartaInfo[poartaid][Inchisax], PoartaInfo[poartaid][Inchisay], PoartaInfo[poartaid][Inchisaz], PoartaInfo[poartaid][Timer],\
- PoartaInfo[poartaid][Inchisarx],PoartaInfo[poartaid][Inchisary], PoartaInfo[poartaid][Inchisarz]);
- poartastatus[poartaid] = 0;
- }
- }
- else
- {
- if(IsPlayerInRangeOfPoint(playerid, 7.0, PoartaInfo[poartaid][Deschisax], PoartaInfo[poartaid][Deschisay], PoartaInfo[poartaid][Deschisaz]))
- {
- if(poartastatus[poartaid] == 0)
- {
- MoveObject(Poarta[poartaid], PoartaInfo[poartaid][Deschisax], PoartaInfo[poartaid][Deschisay], PoartaInfo[poartaid][Deschisarz], PoartaInfo[poartaid][Timer],\
- PoartaInfo[poartaid][Deschisarx],PoartaInfo[poartaid][Deschisary], PoartaInfo[poartaid][Deschisarz]);
- poartastatus[poartaid] = 1;
- }
- else if(poartastatus[poartaid] == 1)
- {
- MoveObject(Poarta[poartaid], PoartaInfo[poartaid][Inchisax], PoartaInfo[poartaid][Inchisay], PoartaInfo[poartaid][Inchisaz], PoartaInfo[poartaid][Timer],\
- PoartaInfo[poartaid][Inchisarx],PoartaInfo[poartaid][Inchisary], PoartaInfo[poartaid][Inchisarz]);
- poartastatus[poartaid] = 0;
- }
- }
- }
- return 1;
- }
- CMD:setinchisa(playerid, params[])
- {
- new poartaid, Float:x, Float:y, Float:z;
- if(unformat(params, "i", poartaid))
- {
- SendClientMessage(playerid, 0xFF0000AA, "Usage: /setinchisa <idpoarta>");
- return 1;
- }
- if(!IsValidObject(Poarta[poartaid]))
- {
- SendClientMessage(playerid, 0xFF0000AA, "Acea poarta nu exista");
- return 1;
- }
- if(IsPlayerAdmin(playerid))
- {
- GetObjectPos(Poarta[poartaid], x,y,z);
- if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
- {
- setinchisa[playerid] = 1;
- editpoarta[playerid] = poartaid;
- poartastatus[poartaid] = 0;
- EditObject(playerid, Poarta[poartaid]);
- }
- else
- {
- SendClientMessage(playerid, 0xFF0000AA, "Trebuie sa fii langa poarta");
- }
- }
- else
- {
- SendClientMessage(playerid, 0xFF0000AA, "Trebuie sa fii admin RCON");
- }
- return 1;
- }
- CMD:setdeschisa(playerid, params[])
- {
- new poartaid, Float:x, Float:y, Float:z;
- if(unformat(params, "i", poartaid))
- {
- SendClientMessage(playerid, 0xFF0000AA, "Usage: /setdeschisa <idpoarta>");
- return 1;
- }
- if(!IsValidObject(Poarta[poartaid]))
- {
- SendClientMessage(playerid, 0xFF0000AA, "Acea poarta nu exista");
- return 1;
- }
- if(IsPlayerAdmin(playerid))
- {
- GetObjectPos(Poarta[poartaid], x,y,z);
- if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
- {
- setdeschisa[playerid] = 1;
- editpoarta[playerid] = poartaid;
- poartastatus[poartaid] = 1;
- EditObject(playerid, Poarta[poartaid]);
- }
- else
- {
- SendClientMessage(playerid, 0xFF0000AA, "Trebuie sa fii langa poarta");
- }
- }
- else
- {
- SendClientMessage(playerid, 0xFF0000AA, "Trebuie sa fii admin RCON");
- }
- return 1;
- }
- public LoadPoarta()
- {
- new file[50], string2[256];
- for(new idx=1;idx<MAX_POARTA;idx++)
- {
- format(file, sizeof(file),"Porti/%d.ini", idx);
- if(dini_Exists(file))
- {
- PoartaInfo[idx][ID] = dini_Int(file,"ID");
- PoartaInfo[idx][Model] = dini_Int(file,"Model");
- PoartaInfo[idx][Timer] = dini_Float(file,"Timer");
- PoartaInfo[idx][Inchisax] = dini_Float(file,"Inchisax");
- PoartaInfo[idx][Inchisay] = dini_Float(file,"Inchisay");
- PoartaInfo[idx][Inchisaz] = dini_Float(file,"Inchisaz");
- PoartaInfo[idx][Inchisarx] = dini_Float(file,"Inchisarx");
- PoartaInfo[idx][Inchisary] = dini_Float(file,"Inchisary");
- PoartaInfo[idx][Inchisarz] = dini_Float(file,"Inchisarz");
- PoartaInfo[idx][Deschisax] = dini_Float(file,"Deschisax");
- PoartaInfo[idx][Deschisay] = dini_Float(file,"Deschisay");
- PoartaInfo[idx][Deschisaz] = dini_Float(file,"Deschisaz");
- PoartaInfo[idx][Deschisarx] = dini_Float(file,"Deschisarx");
- PoartaInfo[idx][Deschisary] = dini_Float(file,"Deschisary");
- PoartaInfo[idx][Deschisarz] = dini_Float(file,"Deschisarz");
- Poarta[idx] = CreateObject(PoartaInfo[idx][Model], PoartaInfo[idx][Inchisax], PoartaInfo[idx][Inchisay], PoartaInfo[idx][Inchisaz], PoartaInfo[idx][Inchisarx], PoartaInfo[idx][Inchisary], PoartaInfo[idx][Inchisarz]);
- poartastatus[idx] = 0;
- format(string2, sizeof(string2), " Poarta: %d",idx);
- porttextlabel[idx] = Create3DTextLabel(string2, 0x7FFF00FF, PoartaInfo[idx][Inchisax], PoartaInfo[idx][Inchisay], PoartaInfo[idx][Inchisaz], 20.0, 0, 0);
- }
- }
- return 1;
- }
- public SaveThisPoarta(poartaid)
- {
- new file2[50];
- format(file2, sizeof(file2),"Porti/%d.ini", poartaid);
- if(dini_Exists(file2))
- {
- dini_IntSet(file2,"ID",PoartaInfo[poartaid][ID]);
- dini_IntSet(file2,"Model",PoartaInfo[poartaid][Model]);
- dini_FloatSet(file2,"Timer",PoartaInfo[poartaid][Timer]);
- dini_FloatSet(file2,"Inchisax",PoartaInfo[poartaid][Inchisax]);
- dini_FloatSet(file2,"Inchisay",PoartaInfo[poartaid][Inchisay]);
- dini_FloatSet(file2,"Inchisaz",PoartaInfo[poartaid][Inchisaz]);
- dini_FloatSet(file2,"Inchisarx",PoartaInfo[poartaid][Inchisarx]);
- dini_FloatSet(file2,"Inchisary",PoartaInfo[poartaid][Inchisary]);
- dini_FloatSet(file2,"Inchisarz",PoartaInfo[poartaid][Inchisarz]);
- dini_FloatSet(file2,"Inchisarz",PoartaInfo[poartaid][Inchisarz]);
- dini_FloatSet(file2,"Deschisax",PoartaInfo[poartaid][Deschisax]);
- dini_FloatSet(file2,"Deschisay",PoartaInfo[poartaid][Deschisay]);
- dini_FloatSet(file2,"Deschisaz",PoartaInfo[poartaid][Deschisaz]);
- dini_FloatSet(file2,"Deschisarx",PoartaInfo[poartaid][Deschisarx]);
- dini_FloatSet(file2,"Deschisary",PoartaInfo[poartaid][Deschisary]);
- dini_FloatSet(file2,"Deschisarz",PoartaInfo[poartaid][Deschisarz]);
- }
- else if(!dini_Exists(file2))
- {
- dini_Create(file2);
- dini_IntSet(file2,"ID",PoartaInfo[poartaid][ID]);
- dini_IntSet(file2,"Model",PoartaInfo[poartaid][Model]);
- dini_FloatSet(file2,"Timer",PoartaInfo[poartaid][Timer]);
- dini_FloatSet(file2,"Inchisax",PoartaInfo[poartaid][Inchisax]);
- dini_FloatSet(file2,"Inchisay",PoartaInfo[poartaid][Inchisay]);
- dini_FloatSet(file2,"Inchisaz",PoartaInfo[poartaid][Inchisaz]);
- dini_FloatSet(file2,"Inchisarx",PoartaInfo[poartaid][Inchisarx]);
- dini_FloatSet(file2,"Inchisary",PoartaInfo[poartaid][Inchisary]);
- dini_FloatSet(file2,"Inchisarz",PoartaInfo[poartaid][Inchisarz]);
- dini_FloatSet(file2,"Inchisarz",PoartaInfo[poartaid][Inchisarz]);
- dini_FloatSet(file2,"Deschisax",PoartaInfo[poartaid][Deschisax]);
- dini_FloatSet(file2,"Deschisay",PoartaInfo[poartaid][Deschisay]);
- dini_FloatSet(file2,"Deschisaz",PoartaInfo[poartaid][Deschisaz]);
- dini_FloatSet(file2,"Deschisarx",PoartaInfo[poartaid][Deschisarx]);
- dini_FloatSet(file2,"Deschisary",PoartaInfo[poartaid][Deschisary]);
- dini_FloatSet(file2,"Deschisarz",PoartaInfo[poartaid][Deschisarz]);
- }
- return 1;
- }
- public OnPlayerModelSelection(playerid, response, listid, modelid)
- {
- new Float:x, Float:y, Float:z, string[700], name[MAX_PLAYER_NAME], file2[100], string2[256];
- GetPlayerName(playerid, name, sizeof(name));
- if(listid == porti)
- {
- if(response)
- {
- for(new i=1;i<MAX_PLAYERS; i++)
- {
- format(file2, sizeof(file2),"Porti/%d.ini", i);
- if(!dini_Exists(file2))
- {
- GetPlayerPos(playerid, x,y,z);
- editpoarta[playerid] = i;
- setdeschisa[playerid] = 1;
- PoartaInfo[i][ID] = i;
- PoartaInfo[i][Model] = modelid;
- PoartaInfo[i][Inchisax] = x+2;
- PoartaInfo[i][Inchisay] = y;
- PoartaInfo[i][Inchisaz] = z;
- PoartaInfo[i][Timer] = 4.00;
- Poarta[i] = CreateObject(modelid, x+2, y, z,\
- 0, 0, 0);
- format(string, sizeof(string), "Admin-ul %s a creiat poarta %d",name,i);
- SendAdminMesaj(0xFFFFFFFF,string); SaveThisPoarta(i); EditObject(playerid, Poarta[i]); SendClientMessage(playerid, 0xFF0000FF, "Seteaza poarta cand e deschisa");
- SendClientMessage(playerid, 0xFF0000FF, "[HINT] Foloseste Space pentru a misca camera");
- porttextlabel[editpoarta[playerid]] = Create3DTextLabel(string2, 0x7FFF00FF, PoartaInfo[editpoarta[playerid]][Inchisax], PoartaInfo[editpoarta[playerid]][Inchisay], PoartaInfo[editpoarta[playerid]][Inchisaz], 20.0, 0, 0);
- break;
- }
- }
- }
- else SendClientMessage(playerid, 0xFF0000FF, "Altadata");
- return 1;
- }
- return 1;
- }
- public SendAdminMesaj(color,const string[])
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(IsPlayerAdmin(i))
- {
- SendClientMessage(i, color, string);
- printf("%s", string);
- }
- }
- }
- return 1;
- }
- public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
- {
- new Float:oldX, Float:oldY, Float:oldZ,
- Float:oldRotX, Float:oldRotY, Float:oldRotZ;
- GetObjectPos(objectid, oldX, oldY, oldZ);
- GetObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
- new string2[256];
- if(response == EDIT_RESPONSE_FINAL)
- {
- if(setinchisa[playerid] == 1)
- {
- SetObjectPos(objectid, fX, fY, fZ);
- SetObjectRot(objectid, fRotX, fRotY, fRotZ);
- PoartaInfo[editpoarta[playerid]][Inchisax] = fX;
- PoartaInfo[editpoarta[playerid]][Inchisay] = fY;
- PoartaInfo[editpoarta[playerid]][Inchisaz] = fZ;
- PoartaInfo[editpoarta[playerid]][Inchisarx] = fRotX;
- PoartaInfo[editpoarta[playerid]][Inchisary] = fRotY;
- PoartaInfo[editpoarta[playerid]][Inchisarz] = fRotZ;
- setinchisa[playerid] = 0; SaveThisPoarta(editpoarta[playerid]);
- poartastatus[editpoarta[playerid]] = 0;
- SendClientMessage(playerid, 0xFF0000FF, "Ai setat si cand e inchisa? Daca nu foloseste /setdeschisa");
- Delete3DTextLabel(porttextlabel[editpoarta[playerid]]);
- porttextlabel[editpoarta[playerid]] = Create3DTextLabel(string2, 0x7FFF00FF, PoartaInfo[editpoarta[playerid]][Inchisax], PoartaInfo[editpoarta[playerid]][Inchisay], PoartaInfo[editpoarta[playerid]][Inchisaz], 20.0, 0, 0);
- }
- if(setdeschisa[playerid] == 1)
- {
- SetObjectPos(objectid, fX, fY, fZ);
- SetObjectRot(objectid, fRotX, fRotY, fRotZ);
- PoartaInfo[editpoarta[playerid]][Deschisax] = fX;
- PoartaInfo[editpoarta[playerid]][Deschisay] = fY;
- PoartaInfo[editpoarta[playerid]][Deschisaz] = fZ;
- PoartaInfo[editpoarta[playerid]][Deschisarx] = fRotX;
- PoartaInfo[editpoarta[playerid]][Deschisary] = fRotY;
- PoartaInfo[editpoarta[playerid]][Deschisarz] = fRotZ;
- setdeschisa[playerid] = 0; SaveThisPoarta(editpoarta[playerid]);
- poartastatus[editpoarta[playerid]] = 1;
- SendClientMessage(playerid, 0xFF0000FF, "Ai setat si cand e inchisa? Daca nu foloseste /setinchisa");
- }
- }
- if(response == EDIT_RESPONSE_CANCEL)
- {
- if(setinchisa[playerid] == 1)
- {
- SetObjectPos(objectid, oldX, oldY, oldZ);
- SetObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
- }
- if(setdeschisa[playerid] == 1)
- {
- SetObjectPos(objectid, oldX, oldY, oldZ);
- SetObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement