Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // JoeMatt Graffiti System v0.1 LOAD/SAVE
- //
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #include <YSI\y_ini>
- #define FILTERSCRIPT
- new Text[MAX_PLAYERS];
- new GrafiteID[MAX_PLAYERS];
- new DeleteObject;
- #define MAX_GRAFITI 30
- #define GRAFITI_FILE "Grafiti/%d.ini"
- #if defined FILTERSCRIPT
- #else
- main()
- {
- print("\n----------------------------------");
- print(" Graffiti System JoeMatt ");
- print("----------------------------------\n");
- }
- #endif
- enum xGrafitiInfo
- {
- xIDF,
- xID,
- Float:xMjestox,
- Float:xMjestoy,
- Float:xMjestoz,
- xtextgrafita[128],
- Float:xRotacijax,
- Float:xRotacijay,
- Float:xRotacijaz,
- xfont[35],
- xboja
- }
- new GrafitiInfo [ MAX_GRAFITI ][ xGrafitiInfo ];
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Graffiti System by JoeMatt v0.1 ");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- for(new grafite = 0; grafite < sizeof(GrafitiInfo); grafite++)
- {
- new tFile[50];
- format(tFile, sizeof(tFile), GRAFITI_FILE, grafite);
- if(fexist(tFile))
- {
- INI_ParseFile(tFile, "UcitajGrafite", .bExtra = true, .extra = grafite);
- Text[playerid] = CreateObject(19353, GrafitiInfo[grafite][xMjestox], GrafitiInfo[grafite][xMjestoy], GrafitiInfo[grafite][xMjestoz], GrafitiInfo[grafite][xRotacijax], GrafitiInfo[grafite][xRotacijay], GrafitiInfo[grafite][xRotacijaz]);
- SetObjectMaterialText(Text[playerid],GrafitiInfo[grafite][xtextgrafita], 0, OBJECT_MATERIAL_SIZE_256x128,GrafitiInfo[grafite][xfont], 28, 0, GrafitiInfo[grafite][xboja], 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
- }
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- return 1;
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- return 1;
- }
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- return 1;
- }
- public OnPlayerStreamOut(playerid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamOut(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
- {
- 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 grafite = GrafiteID[playerid];
- if(!playerobject)
- {
- if(!IsValidObject(objectid)) return;
- MoveObject(objectid, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ);
- SetPlayerObjectPos(playerid, objectid, oldX, oldY, oldZ);
- SetPlayerObjectRot(playerid, objectid, oldRotX, oldRotY, oldRotZ);
- GrafitiInfo[grafite][xMjestox] = fX;
- GrafitiInfo[grafite][xMjestoy] = fY;
- GrafitiInfo[grafite][xMjestoz] = fZ;
- //------Rotacija EDITA-------
- GrafitiInfo[grafite][xRotacijax] = fRotX;
- GrafitiInfo[grafite][xRotacijay] = fRotY;
- GrafitiInfo[grafite][xRotacijaz] = fRotZ;
- SacuvajGrafite(grafite);
- }
- }
- public OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ)
- {
- if(type == SELECT_OBJECT_GLOBAL_OBJECT)
- {
- if(DeleteObject == 1)
- {
- GrafiteID[playerid] = objectid;
- new id = GrafiteID[playerid];
- new kFile[50];
- DestroyObject(objectid);
- CancelEdit(playerid);
- SendClientMessage(playerid, -1 , " You deleted that object!");
- DeleteObject = 0;
- format(kFile, sizeof(kFile), "Grafiti/%d.ini" , GrafitiInfo[id][xIDF]);
- fremove(kFile);
- }
- if(DeleteObject == 0)
- {
- GrafiteID[playerid] = objectid;
- EditObject(playerid, objectid);
- }
- }
- return 1;
- }
- forward UcitajGrafite(grafite, name[], value[]);
- public UcitajGrafite(grafite, name[], value[])
- {
- INI_Int("IDF",GrafitiInfo[grafite][xIDF]);
- INI_Int("ID",GrafitiInfo[grafite][xID]);
- INI_Float("Mjestox",GrafitiInfo[grafite][xMjestox]);
- INI_Float("Mjestoy",GrafitiInfo[grafite][xMjestoy]);
- INI_Float("Mjestoz",GrafitiInfo[grafite][xMjestoz]);
- INI_String("textgrafita",GrafitiInfo[grafite][xtextgrafita],128);
- INI_Float("Rotacijax",GrafitiInfo[grafite][xRotacijax]);
- INI_Float("Rotacijay",GrafitiInfo[grafite][xRotacijay]);
- INI_Float("Rotacijaz",GrafitiInfo[grafite][xRotacijaz]);
- INI_String("font",GrafitiInfo[grafite][xfont],35);
- INI_Hex("boja",GrafitiInfo[grafite][xboja]);
- return 1;
- }
- stock SacuvajGrafite(grafite)
- {
- new tFile[128];
- format(tFile, sizeof(tFile), GRAFITI_FILE, grafite);
- if(fexist(tFile))
- {
- new INI:File = INI_Open(tFile);
- INI_WriteInt(File,"IDF",GrafitiInfo[grafite][xIDF]);
- INI_WriteInt(File,"ID",GrafitiInfo[grafite][xID]);
- INI_WriteFloat(File,"Mjestox",GrafitiInfo[grafite][xMjestox]);
- INI_WriteFloat(File,"Mjestoy",GrafitiInfo[grafite][xMjestoy]);
- INI_WriteFloat(File,"Mjestoz",GrafitiInfo[grafite][xMjestoz]);
- INI_WriteString(File,"textgrafita",GrafitiInfo[grafite][xtextgrafita]);
- INI_WriteFloat(File,"Rotacijax",GrafitiInfo[grafite][xRotacijax]);
- INI_WriteFloat(File,"Rotacijay",GrafitiInfo[grafite][xRotacijay]);
- INI_WriteFloat(File,"Rotacijaz",GrafitiInfo[grafite][xRotacijaz]);
- INI_WriteString(File,"font",GrafitiInfo[grafite][xfont]);
- INI_WriteHex(File,"boja",GrafitiInfo[grafite][xboja]);
- INI_Close(File);
- }
- return 1;
- }
- CMD:grafiti(playerid, params[])
- {
- new txt[128],boja, font[35], Float:X, Float:Y, Float:Z;
- if(sscanf(params, "s[128]s[35]h", txt, font,boja)) return SendClientMessage(playerid,-1,"USAGE: /grafiti [Text] [Font] [Color]");
- GetPlayerPos(playerid, X, Y, Z);
- Text[playerid] = CreateObject(19353, X, Y +2, Z, 0.0, 0.0, 90.0);
- SetObjectMaterialText(Text[playerid],txt, 0, OBJECT_MATERIAL_SIZE_256x128,font, 28, 0, boja , 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
- for(new i = 0; i < MAX_GRAFITI; i++)
- {
- new fajl[20]; format(fajl, sizeof(fajl), "Grafiti/%d.ini", i);
- if(!fexist(fajl))
- {
- GrafitiInfo[i][xID] = 19353;
- GrafitiInfo[i][xMjestox] = X;
- GrafitiInfo[i][xMjestoy] = Y;
- GrafitiInfo[i][xMjestoz] = Z;
- GrafitiInfo[i][xIDF] = i;
- GrafitiInfo[i][xboja] = boja;
- GrafitiInfo[i][xRotacijax] = 0;
- GrafitiInfo[i][xRotacijay] = 0;
- GrafitiInfo[i][xRotacijaz] = 0;
- strmid(GrafitiInfo[i][xtextgrafita], txt, 0, strlen(txt), 128);
- strmid(GrafitiInfo[i][xfont], font, 0, strlen(font), 35);
- fopen(fajl, io_write);
- SacuvajGrafite(i);
- GrafiteID[playerid] = i;
- i = 49;
- }
- }
- return 1;
- }
- CMD:grafitiedit(playerid, params[])
- {
- SendClientMessage(playerid, -1, " Please select object for editing.");
- SelectObject(playerid);
- return 1;
- }
- CMD:deletegrafit(playerid, params[])
- {
- SendClientMessage(playerid, -1, " Please select object for delete.");
- SelectObject(playerid);
- DeleteObject = 1;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement