Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*______________________________________________________________________________
- Dynamic Jelka System by Jevtic (c)
- Radio: Jevtic
- Vreme izrade: 30 Min
- Credits: Lazar Jevtic a.k.a Jevtic
- CMD: /maketrees - Kreiranje jelke
- CMD: /etrees - Edit Jelke
- CMD: /treesport - Port do jelke
- ________________________________________________________________________________
- */
- //______________________________________________________________________________
- #include < a_samp >
- #include < sscanf2 >
- #include < streamer >
- #include < YSI\y_commands >
- #include < YSI\y_ini >
- //______________________________________________________________________________
- #define PLAVA "{138ED8}"
- #define BELA "{FFFFFF}"
- #define INFO "{9CA5A4}"
- #define ERROR "{E83232}"
- //______________________________________________________________________________
- #define SCM SendClientMessage
- //______________________________________________________________________________
- #define JELKA_OBJEKAT 19076
- #define JELKA_FILE "Jelke/JELKA_%d.ini"
- #define MAX_JELKA 100
- //______________________________________________________________________________
- enum Jelka
- {
- zPostavljena,
- Float:zX,
- Float:zY,
- Float:zZ,
- Float:zAngle,
- zObjekat,
- aInt,
- aVW,
- Text3D:zLabelJelke
- }
- new JI[MAX_JELKA][Jelka], eData[MAX_PLAYERS];
- //______________________________________________________________________________
- public OnFilterScriptInit()
- {
- for(new i = 0; i < sizeof(JI); i++)
- {
- new kFile[50];
- format(kFile, sizeof(kFile), JELKA_FILE, i);
- if(fexist(kFile))
- {
- INI_ParseFile(kFile, "UcitajJelku", .bExtra = true, .extra = i);
- KreirajJelku(i);
- }
- }
- return 1;
- }
- //______________________________________________________________________________
- public OnFilterScriptExit()
- {
- for(new a = 0; a < sizeof(JI); a++) { SacuvajJelku(a); }
- return 1;
- }
- //______________________________________________________________________________
- public OnPlayerConnect(playerid)
- {
- //________________________________________________
- SCM( playerid, -1, ""INFO"INFO: "BELA" ____________________________________________________ " );
- SCM( playerid, -1, ""INFO"INFO: "BELA" Ovaj server koristi Dinamican System Jelki by Jevtic" );
- SCM( playerid, -1, ""INFO"INFO: "BELA" Facebook: www.fb.com/jevttabrat" );
- SCM( playerid, -1, ""INFO"INFO: "BELA" Skype: lazar.jevtic404" );
- SCM( playerid, -1, ""INFO"INFO: "BELA" Forum: www.zb-samp.com and www.balkan-samp.com" );
- SCM( playerid, -1, ""INFO"INFO: "BELA" ____________________________________________________ " );
- eData[playerid] = -1;
- return 1;
- }
- //______________________________________________________________________________
- YCMD:maketrees( playerid , params[] , help )
- {
- //Dodati proveru : pAdmin i pLoginProvera
- #pragma unused help
- new idJelka,Float:X,Float:Y,Float:Z,Float:Angle,afajl[60];
- GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid, Angle);
- if(sscanf(params, "i",idJelka)) return SCM( playerid, -1,""INFO"KORISTI: "BELA"/maketrees [ID]" );
- if(idJelka >= MAX_JELKA) return SCM( playerid, -1, ""ERROR"GRESKA: "BELA"Imate ogranicen broj jelki!" );
- format(afajl, sizeof(afajl), JELKA_FILE, idJelka);
- if(fexist(afajl)) return SCM( playerid, -1, ""ERROR"GRESKA: "BELA"Taj ID Jelke je vec kreiran!" );
- JI[idJelka][zPostavljena] = 1; JI[idJelka][zAngle] = Angle;
- JI[idJelka][zX] = X; JI[idJelka][zY] = Y; JI[idJelka][zZ] = Z;
- JI[idJelka][aInt] = GetPlayerInterior(playerid); JI[idJelka][aVW] = GetPlayerVirtualWorld(playerid);
- KreirajJelku(idJelka); SacuvajJelku(idJelka); SCM( playerid, -1,""PLAVA"INFO: "BELA"Uspesno ste napravili jelku mozete je premestati (/etrees)" );
- return 1;
- }
- //______________________________________________________________________________
- YCMD:etrees( playerid , params[] , help )
- {
- //Dodati proveru : pAdmin i pLoginProvera
- #pragma unused help
- new afajl[80],idJelka;
- if(sscanf(params, "i",idJelka)) return SCM( playerid, -1,""INFO"KORISTI: "BELA"/etrees [ID]" );
- format(afajl, sizeof(afajl), JELKA_FILE, idJelka);
- if(!fexist(afajl)) return SCM( playerid, -1, ""ERROR"GRESKA: "BELA" Unesen id jelke ne postoji!" );
- if(!IsPlayerInRangeOfPoint(playerid, 3.0, JI[idJelka][zX], JI[idJelka][zY], JI[idJelka][zZ])) return SCM(playerid,-1,"Niste u blizini tog bankoamta!");
- eData[playerid] = idJelka; EditDynamicObject(playerid,JI[idJelka][zObjekat]);
- return 1;
- }
- //______________________________________________________________________________
- YCMD:treesport(playerid , params[] , help )
- {
- //Dodati proveru : pAdmin i pLoginProvera
- #pragma unused help
- new afajl[80],idJelka;
- if(sscanf(params, "i",idJelka)) return SCM( playerid, -1,""INFO"KORISTI: "BELA"/treesport [ID]" );
- format(afajl, sizeof(afajl), JELKA_FILE, idJelka);
- if(!fexist(afajl)) return SCM( playerid,-1, ""ERROR"GRESKA: "BELA"Unesen id jelke ne postoji!" );
- SetPlayerPos(playerid,JI[idJelka][zX], JI[idJelka][zY], JI[idJelka][zZ]);
- SetPlayerInterior(playerid,0); SetPlayerVirtualWorld(playerid,0);
- return 1;
- }
- //______________________________________________________________________________
- forward UcitajJelku(Jelkaid, name[], value[]);
- public UcitajJelku(Jelkaid, name[], value[])
- {
- INI_Int("Postavljena",JI[Jelkaid][zPostavljena]);
- INI_Float("X",JI[Jelkaid][zX]);
- INI_Float("Y",JI[Jelkaid][zY]);
- INI_Float("Z",JI[Jelkaid][zZ]);
- INI_Float("Angle",JI[Jelkaid][zAngle]);
- INI_Int("Int",JI[Jelkaid][aInt]);
- INI_Int("VW",JI[Jelkaid][aVW]);
- return 1;
- }
- //______________________________________________________________________________
- stock SacuvajJelku(Jelkaid)
- {
- new kFile[80];
- format(kFile, sizeof(kFile), JELKA_FILE, Jelkaid);
- new INI:File = INI_Open(kFile);
- INI_WriteInt(File,"Postavljena",JI[Jelkaid][zPostavljena]);
- INI_WriteFloat(File,"X",JI[Jelkaid][zX]);
- INI_WriteFloat(File,"Y",JI[Jelkaid][zY]);
- INI_WriteFloat(File,"Z",JI[Jelkaid][zZ]);
- INI_WriteFloat(File,"Angle",JI[Jelkaid][zAngle]);
- INI_WriteInt(File,"Int",JI[Jelkaid][aInt]);
- INI_WriteInt(File,"VW",JI[Jelkaid][aVW]);
- INI_Close(File);
- return 1;
- }
- //______________________________________________________________________________
- public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)
- {
- if(response == EDIT_RESPONSE_FINAL)
- {
- new id = eData[playerid], Float:angle, string[100];
- GetPlayerFacingAngle(playerid, angle);
- if(id != -1)
- {
- JI[id][zX] = x;
- JI[id][zY] = y;
- JI[id][zZ] = z;
- JI[id][zAngle] = rz;
- DestroyDynamicObject(JI[id][zObjekat]);
- KreirajJelku(id);
- SacuvajJelku(id);
- format(string,sizeof(string),""INFO"INFO: "BELA"Jelka je uspesno kreirana (ID:%d)",id);
- SCM(playerid,-1,string);
- id = -1;
- return 1;
- }
- }
- return 1;
- }
- //______________________________________________________________________________
- stock KreirajJelku(idJelka)
- {
- if(JI[idJelka][zPostavljena] == 1)
- {
- new string[80];
- format(string, sizeof(string), ""PLAVA"["BELA"SRECNE NOVOGODISNJE PRAZNIKE ZELI VAM JEVTIC"PLAVA"]", idJelka);
- JI[idJelka][zLabelJelke] = CreateDynamic3DTextLabel(string, 0x1D9F00AA, JI[idJelka][zX], JI[idJelka][zY], JI[idJelka][zZ]+1.5, 25.0,_,_,_, JI[idJelka][aVW], JI[idJelka][aInt],_,_);
- JI[idJelka][zObjekat] = CreateDynamicObject(JELKA_OBJEKAT, JI[idJelka][zX], JI[idJelka][zY], JI[idJelka][zZ], 0.0, 0.0, JI[idJelka][zAngle], JI[idJelka][aVW], JI[idJelka][aInt],_,_);
- }
- return 1;
- }
- //______________________________________________________________________________
- stock ZJelkaID(playerid)
- {
- new idJelka = 0;
- while(idJelka != MAX_JELKA)
- {
- if(IsPlayerInRangeOfPoint(playerid, 5.0, JI[idJelka][zX], JI[idJelka][zY], JI[idJelka][zZ]))
- {
- return idJelka;
- }
- idJelka++;
- }
- return -1;
- }
- //______________________________________________________________________________
- // Fest and zuroism
- //______________________________________________________________________________
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement