Lean1337

Leans Graffiti System

Jan 23rd, 2015
5,597
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 17.71 KB | None | 0 0
  1. /*
  2. *
  3. Lean's Graffiti System
  4. **
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17. ****
  18. INCLUDES/DEFINES:
  19. */
  20.  
  21. #include <a_samp>
  22. #include <zcmd>
  23. #include <streamer>
  24. #include <sscanf2>
  25. #include <foreach>
  26. #include <dini>
  27. #define LEANCMD:(%1) CMD:%1(playerid, params[])
  28.  
  29. #define COL_WHITE "{FFFFFF}"
  30. #define COL_RED "{F81414}"
  31. #define COL_GREEN "{00FF22}"
  32. #define COL_LIGHTBLUE "{00CED1}"
  33.  
  34. #define SPRAYCANSOUND "http://k003.kiwi6.com/hotlink/bfd89n1rw9/spray_sound_effect_-_odg_os_sprayu_-_bruit_spray_-_spray_noise.mp3"
  35. #define COLOR_LIGHTRED 0xFF6347AA
  36.  
  37. #define SCM SendClientMessage
  38.  
  39. #define VERSION "Graffiti V1"
  40.  
  41. #define PRESSED(%0) \
  42.     (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  43.  
  44. #define RELEASED(%0) \
  45.     (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
  46.    
  47.    
  48. #define    DIALOG_WELCOME 075
  49. #define    DIALOG_SELECT 076
  50. #define    DIALOG_INPUTGRAFF 077
  51. #define    DIALOG_COLOR 078
  52. #define    DIALOG_HAPPY 079
  53. #define    DIALOG_LIST 080
  54. #define COL_GREY "{C3C3C3}" // 1
  55. #define COL_WHITE "{FFFFFF}" // 2
  56. #define COL_RED "{F81414}" // 3
  57. #define COL_GREEN "{00FF22}" // 4
  58. #define COL_LIGHTBLUE "{00CED1}" // 5
  59. #define COL_ORANGE "{FF9900}" // 6
  60. #define COL_BLACK "{000000}"
  61.  
  62.  
  63. #define GRAFFDIALOG ShowPlayerDialog(playerid, DIALOG_SELECT, DIALOG_STYLE_LIST, "Graffiti Menu", "Enter Graffiti Text\nGraffiti List", "Select", "Exit");
  64. #define GRAFFINPUT ShowPlayerDialog(playerid, DIALOG_INPUTGRAFF, DIALOG_STYLE_INPUT, "Graffiti", "Please Enter Graffiti text", "Continue", "Cancel");
  65. #define GRAFFINPUTER ShowPlayerDialog(playerid, DIALOG_INPUTGRAFF, DIALOG_STYLE_INPUT, ""COL_WHITE"Graffiti", ""COL_RED"ERROR: No text was written \nPlease try again!", "Continue", "Cancel");
  66. #define GRAFFCOLOR ShowPlayerDialog(playerid, DIALOG_COLOR, DIALOG_STYLE_LIST, "Color Menu", "{000000}Black\n{FFFFFF}White\n{F81414}Red\n{00FF22}Green\n{00CED1}Lightblue\n{C3C3C3}Grey", "Select", "Exit");
  67. #define GRAFFHAPPY ShowPlayerDialog(playerid, DIALOG_HAPPY, DIALOG_STYLE_MSGBOX, "Graffiti Menu", "Please Enter Graffiti text", "Continue", "Cancel");
  68. #define GRAFFLIST ShowPlayerDialog(playerid,DIALOG_LIST,DIALOG_STYLE_LIST,"Graffiti List",string,"Ok","Cancel");
  69.    
  70. #define MAXGRAFFS 50
  71. #define Graffitis "/Graffitis/%d.ini"
  72.  
  73. /*-------END OF INCLUDES/DEFINES-----------*/
  74.  
  75.  
  76. /*
  77. NEWS;
  78. *
  79. **
  80. */
  81. new sprayammount[MAX_PLAYERS];
  82. new POBJECT[MAX_PLAYERS];
  83. new POBJECTN[MAX_PLAYERS][96];
  84. new POBJECTC[MAX_PLAYERS][24];
  85. new Float:XYZ[MAX_PLAYERS][6];
  86. new GRAVEH[MAX_PLAYERS];
  87. new spraytimer[MAX_PLAYERS];
  88. new spraytimerch[MAX_PLAYERS];
  89. new sprayammountch[MAX_PLAYERS];
  90. new isveh[MAX_PLAYERS] = 0;
  91. new sprays = 0;
  92. new graffmenup[MAX_PLAYERS] = 0;
  93. new creator[MAX_PLAYERS][MAX_PLAYER_NAME];
  94. new gammount;
  95. new spraytimerx[MAX_PLAYERS];
  96.  
  97. /*-------END OF NEWS-----------*/
  98.  
  99.  
  100.  
  101. //****ENUM****
  102.  
  103. enum graffInfo
  104. {
  105.     graffcreator[MAX_PLAYER_NAME],graffname[96],Float:Xpos,Float:Ypos,Float:Zpos,Float:XYpos,Float:YYpos,Float:ZYpos,OBJECTID
  106. }
  107. new gInfo[MAXGRAFFS][graffInfo];
  108.  
  109.  
  110.  
  111. //*****STOCKS*******
  112.  
  113. stock nGraffiti()
  114. {
  115.     new ID[64]; for(new h = 0; h <= 200; h++){
  116.     format(ID, sizeof(ID), Graffitis, h);if(!dini_Exists(ID)) return h; }return true;
  117. }
  118.  
  119.  
  120. stock LoadGraffitis()
  121. {
  122.     new string[70];
  123.     for(new ID = 0; ID < sizeof(gInfo); ID++)
  124.     {
  125.         format(string, sizeof(string), Graffitis, ID);
  126.         if(dini_Exists(string))
  127.         {
  128.             strmid(gInfo[ID][graffcreator],dini_Get(string,"graffcreator"),0,MAX_PLAYER_NAME,MAX_PLAYER_NAME);
  129.             strmid(gInfo[ID][graffname],dini_Get(string,"graffname"),0,96,96);
  130.             gInfo[ID][OBJECTID] =  dini_Int(string, "OBJECTID");
  131.             gInfo[ID][Xpos] =  dini_Float(string, "Xpos");
  132.             gInfo[ID][Ypos] =  dini_Float(string, "Ypos");
  133.             gInfo[ID][Zpos] =  dini_Float(string, "Zpos");
  134.             gInfo[ID][XYpos] =  dini_Float(string, "XYpos");
  135.             gInfo[ID][YYpos] =  dini_Float(string, "YYpos");
  136.             gInfo[ID][ZYpos] =  dini_Float(string, "ZYpos");
  137.            
  138.         }
  139.     }
  140.     return 1;
  141. }
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148. stock SaveGraffitis()
  149. {
  150.     new string[50];
  151.     for(new ID = 0; ID < sizeof(gInfo); ID++)
  152.     {
  153.         format(string, sizeof(string), Graffitis, ID);
  154.         if(dini_Exists(string))
  155.         {
  156.             dini_Set(string,"graffcreator",gInfo[ID][graffcreator]);
  157.             dini_Set(string,"graffname",gInfo[ID][graffname]);
  158.             dini_Set(string,"OBJECTID", gInfo[ID][OBJECTID]);
  159.             dini_FloatSet(string,"Xpos", gInfo[ID][Xpos]);
  160.             dini_FloatSet(string,"Ypos", gInfo[ID][Ypos]);
  161.             dini_FloatSet(string,"Zpos", gInfo[ID][Zpos]);
  162.             dini_FloatSet(string,"XYpos", gInfo[ID][XYpos]);
  163.             dini_FloatSet(string,"YYpos", gInfo[ID][YYpos]);
  164.             dini_FloatSet(string,"ZYpos", gInfo[ID][ZYpos]);
  165.  
  166.         }
  167.     }
  168.     return 1;
  169. }
  170.  
  171. stock GetName(playerid)
  172. {
  173.     new name[MAX_PLAYER_NAME];
  174.     GetPlayerName(playerid,name,sizeof(name));
  175.     return name;
  176. }
  177.  
  178.  
  179.  
  180.  
  181. /*
  182. FORWARDS;
  183. *
  184. **
  185. */
  186. forward loadgraffs();
  187. forward spraying(playerid);
  188. forward sprayingch(playerid);
  189. forward killgr(playerid);
  190. forward creategraff(playerid);
  191.  
  192.  
  193.  
  194. /*-------END OF FORWARDS-----------*/
  195.  
  196.  
  197. /*
  198. CALLBACKS;
  199. *
  200. **
  201. */
  202. public OnFilterScriptInit()
  203. {
  204.     print( " Leans Graffiti System Loaded" );
  205.     SendClientMessageToAll( -1, "Leans "VERSION" Loaded" );
  206.     LoadGraffitis();
  207.     loadgraffs();
  208.     foreach(Player, i)
  209.     {
  210.         killgr(i);
  211.     }
  212.     return 1;
  213. }
  214.  
  215.  
  216.  
  217.  
  218.  
  219. public OnFilterScriptExit()
  220. {
  221.     SendClientMessageToAll( -1, "Leans "VERSION" UnLoaded" );
  222.     return 1;
  223. }
  224.  
  225.  
  226.  
  227. public loadgraffs()
  228. {
  229.  
  230.     for(new ID = 0; ID < MAXGRAFFS; ID++)
  231.     {
  232.  
  233.             gInfo[ID][OBJECTID] = CreateDynamicObject( 19482, gInfo[ID][Xpos],gInfo[ID][Ypos],gInfo[ID][Zpos], gInfo[ID][XYpos], gInfo[ID][YYpos], gInfo[ID][ZYpos], -1, 0, -1, 200 ); //Creating the object
  234.             SetDynamicObjectMaterialText( gInfo[ID][OBJECTID], 0, gInfo[ID][graffname], OBJECT_MATERIAL_SIZE_256x256, "Diploma", 25, 0, 0xFFFFFFFF, 0, 1 ); // Setting the object text with our choosen graffiti text
  235.             gammount ++;
  236.        
  237.     }
  238.     return 1;
  239. }
  240.  
  241.  
  242.  
  243.  
  244.  
  245. public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)
  246. {
  247.     if( response == EDIT_RESPONSE_FINAL ) // If player press SAVE
  248.     {
  249.         if( GetPVarInt(playerid, "GraffitiCreating") == 1 ) //Checking if player have a positiv variable on GraffitiCreating
  250.         {
  251.  
  252.             XYZ[playerid][0] = x; //Getting XYZ
  253.             XYZ[playerid][1] = y;
  254.             XYZ[playerid][2] = z;
  255.             XYZ[playerid][3] = rx; // Getting Angles
  256.             XYZ[playerid][4] = ry;
  257.             XYZ[playerid][5] = rz;
  258.             GameTextForPlayer( playerid, "Please keep spraying your spraycan till its created.",10000, 5 ); // Telling player to SPRAY with his psraycan
  259.             DestroyDynamicObject( POBJECT[playerid] ); // When player is done with his position of the graffiti and he hits save it gets destroyed
  260.             GivePlayerWeapon( playerid, 41, 9999 ); // DEBUGGING purposes we give him a spraycan
  261.             spraytimerx[playerid] = SetTimerEx( "killgr", 90000, true, "i", playerid );
  262.  
  263.         }
  264.     }
  265.     if( response == EDIT_RESPONSE_CANCEL ) // If he hits ESC
  266.     {
  267.         if( GetPVarInt(playerid, "GraffitiCreating") == 1 ) //Checking if player is in creation of graffiti
  268.         {
  269.             DestroyDynamicObject( POBJECT[playerid] ); // Destroying the object
  270.             SendClientMessage( playerid,0xFF6800FF,"Creation of Graffiti Canceld" ); // <---
  271.             DeletePVar( playerid,"GraffitiCreating" ); // Deleting the PVAR from the player that he is not creating a graffiti
  272.         }
  273.     }
  274.     return 1;
  275. }
  276.  
  277.  
  278. public creategraff( playerid )
  279. {
  280.     new v = random(200+200);
  281.     printf("%d",v);
  282.     POBJECT[playerid] += v;
  283.     DestroyDynamicObject( POBJECT[playerid] ); // Destroying old sprayobject
  284.     POBJECT[playerid] = CreateDynamicObject( 19482, XYZ[playerid][0], XYZ[playerid][1], XYZ[playerid][2], XYZ[playerid][3], XYZ[playerid][4], XYZ[playerid][5], GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1, 200 ); //Creating the object
  285.     SetDynamicObjectMaterialText( POBJECT[playerid], 0, POBJECTN[playerid], OBJECT_MATERIAL_SIZE_256x256, "Diploma", 25, 0, 0xFFFFFFFF, 0, 1 ); // Setting the object text with our choosen graffiti text
  286.     GameTextForPlayer( playerid, "~w~SPRAYED ]",5000,5 ); // SElf explainable?
  287.     DeletePVar( playerid,"GraffitiCreating" ); // Deleting the PVAR afterwards
  288.     sprayammount[playerid] = 0; // SEtting this var to 0, will explain what it is further down
  289.     GRAVEH[playerid] = 0;
  290.     isveh[playerid] = 0;
  291.     sprays ++;
  292.     creator[playerid] = GetName(playerid);
  293.     new string[20];
  294.     new id = nGraffiti();
  295.     format(string, sizeof(string),Graffitis, id);
  296.     dini_Create(string);
  297.     strmid(gInfo[id][graffname] , POBJECTN[playerid], 0, strlen(POBJECTN[playerid]), 32);
  298.     gInfo[id][graffcreator] = GetName(playerid);
  299.     gInfo[id][OBJECTID] = POBJECT[playerid];
  300.     gInfo[id][Xpos] = XYZ[playerid][0];
  301.     gInfo[id][Ypos] = XYZ[playerid][1];
  302.     gInfo[id][Zpos] = XYZ[playerid][2];
  303.     gInfo[id][XYpos] = XYZ[playerid][3];
  304.     gInfo[id][YYpos] = XYZ[playerid][4];
  305.     gInfo[id][ZYpos] = XYZ[playerid][5];
  306.     SaveGraffitis();
  307.     StopAudioStreamForPlayer(playerid);
  308.     return 1;
  309. }
  310.    
  311.    
  312.    
  313.  
  314.  
  315.  
  316. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  317. {
  318.     if ( PRESSED(KEY_FIRE) && GetPVarInt(playerid, "GraffitiCreating") == 0  && GetPlayerWeapon(playerid) == 41 ) // CHeck if player is pressing FIRE key and if he have a positiv pvar on graffiticreating
  319.     {
  320.             spraytimerch[playerid] = SetTimerEx( "sprayingch", 1000, true, "i", playerid ); // STarting a timer for spraying
  321.             SetPVarInt(playerid, "GraffitiMenu", 1);
  322.             return 1;
  323.     }
  324.     if ( RELEASED( KEY_FIRE ) && GetPVarInt(playerid, "GraffitiMenu") == 1 && GetPlayerWeapon(playerid) == 41) // If player releases his fire key
  325.     {
  326.         KillTimer( spraytimerch[playerid] );
  327.         GameTextForPlayer(playerid, "] ~r~Aborted",5000, 5);
  328.         graffmenup[playerid] = 0;
  329.         DeletePVar(playerid, "GraffitiMenu");
  330.         return 1;
  331.     }
  332.  
  333.  
  334.  
  335.     if ( PRESSED(KEY_FIRE) && GetPVarInt(playerid, "GraffitiCreating") == 1 ) // CHeck if player is pressing FIRE key and if he have a positiv pvar on graffiticreating
  336.     {
  337.         if( GetPlayerWeapon(playerid) == 41 ) // Checking if player is holding WEAPON SPRAYCAN
  338.         {
  339.             spraytimer[playerid] = SetTimerEx( "spraying", 1000, true, "i", playerid ); // STarting a timer for spraying
  340.             PlayAudioStreamForPlayer(playerid, SPRAYCANSOUND);
  341.             KillTimer( spraytimerx[playerid] );
  342.         }
  343.     }
  344.  
  345.     if ( RELEASED( KEY_FIRE ) && GetPVarInt(playerid, "GraffitiCreating") == 1 ) // If player releases his fire key
  346.     {
  347.    
  348.         if( GetPlayerWeapon(playerid) == 41 ) // IF player has a spraycan
  349.         {
  350.             KillTimer( spraytimer[playerid] ); // Killing the timer so it wont keep going
  351.             sprayammount[playerid] --; // Removing one POINT of spray for releasing the fire button
  352.             GameTextForPlayer( playerid,"~g~Please keep spraying!!",3000, 5 ); // <---
  353.             StopAudioStreamForPlayer(playerid);
  354.             spraytimerx[playerid] = SetTimerEx( "killgr", 90000, true, "i", playerid );
  355.         }
  356.     }
  357.     return 1;
  358. }
  359.  
  360.  
  361.  
  362.  
  363. public killgr(playerid)
  364. {
  365.     sprayammount[playerid] = 0;
  366.     DeletePVar( playerid,"GraffitiCreating" ); // Deleting the PVAR afterwards
  367.     sprayammountch[playerid] = 0;
  368.     graffmenup[playerid] = 0;
  369.     return 1;
  370. }
  371.  
  372.  
  373.  
  374. public spraying( playerid ) // This Callback gets called evrysecond
  375. {
  376.     if(IsPlayerInRangeOfPoint(playerid, 3.0,XYZ[playerid][0],XYZ[playerid][1], XYZ[playerid][2]))
  377.     {
  378.         sprayammount[playerid] ++; //Evry second it gets called player gets ONE point
  379.    
  380.         if( sprayammount[playerid] == sprayammountch[playerid] ) // If player reached his points
  381.         {
  382.             KillTimer( spraytimer[playerid] ); // We kill this timer as player reached his points
  383.             creategraff( playerid ); // We now call creategraff and the graffiti will be created
  384.             return 1;
  385.         }
  386.         new string[64];
  387.         format( string, sizeof(string),"~g~SPRAYING~n~ ~r~] ~w~%d/%d",sprayammount[playerid], sprayammountch[playerid]); // <----
  388.         GameTextForPlayer( playerid, string, 1000,5 );
  389.         return 1;
  390.     }
  391.     else
  392.     {
  393.         GameTextForPlayer(playerid, "] ~r~Sorry, you are too far away\n-2 points deducted ~y~]",5000, 5);
  394.         sprayammount[playerid] -= 2;
  395.         return 1;
  396.     }
  397.    
  398. }
  399.  
  400.  
  401. public sprayingch( playerid ) // This Callback gets called evrysecond
  402. {
  403.     graffmenup[playerid] ++; //Evry second it gets called player gets ONE point
  404.  
  405.     if( graffmenup[playerid] == 5 ) // If player reached his points
  406.     {
  407.         KillTimer( spraytimerch[playerid] ); // We kill this timer as player reached his points
  408.         GRAFFDIALOG
  409.         return 1;
  410.     }
  411.     new string[64];
  412.     format( string, sizeof(string),"~g~KEEP SPRAYING FOR GRAFFITI MENU~n~ ~r~] ~w~%d/5",graffmenup[playerid]); // <----
  413.     GameTextForPlayer( playerid, string, 1000,5 );
  414.     return 1;
  415. }
  416.  
  417.  
  418. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  419. {
  420.     if(dialogid == DIALOG_SELECT)
  421.     {
  422.         if(response)
  423.         {
  424.             switch(listitem)
  425.             {
  426.                 case 0: GRAFFINPUT
  427.                 case 1:
  428.                 {
  429.                         new string[ 500 ];
  430. //                      new PickupD = nGraffiti();
  431.                         //for(new ID = 0; ID < 30; ID++)
  432.                         new d[96];
  433.                         format(d, sizeof(d),"Graffiti List "COL_ORANGE"(Creator Lean)");
  434.                         new stringz[128];
  435.                         new c;
  436.                         for(new ID = 0; ID < gammount; ID++)
  437.                         {
  438.                             c = strlen(gInfo[ID][graffname]);
  439.                             format(stringz, sizeof(stringz),"/Graffitis/%d.ini",ID);
  440.                             if( c > 1 && fexist(stringz))
  441.                             {
  442.                                 format(string, sizeof(string), "%s\nName: %s "COL_ORANGE"(%d) (Creator: %s)\n",string, gInfo[ID][graffname], ID,gInfo[ID][graffcreator]);
  443.                                 ShowPlayerDialog(playerid,DIALOG_LIST,DIALOG_STYLE_LIST,d,string,"Delete","Cancel");
  444.                             }
  445.                         }
  446.                 }
  447.             }
  448.         }
  449.         else return GameTextForPlayer(playerid, "] Graffiti Menu Aborted ]",5000, 5);
  450.         return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
  451.     }
  452.    
  453.    
  454.     if(dialogid == DIALOG_LIST)
  455.     {
  456.         if(response) // If they clicked 'Select' or double-clicked a weapon
  457.         {
  458.             new id = listitem;
  459.             new string[128];
  460.             format(string, sizeof(string),"/Graffitis/%d.ini",id);
  461.             if(!IsPlayerAdmin(playerid)) return GameTextForPlayer( playerid, "~r~You are not authorized \nto delete Graffitis!]",10000,5);
  462.             if(!fexist(string))
  463.             {
  464.             format(string,sizeof(string),"~y~]~r~Something went wrong, try again~y~]",id);
  465.             GameTextForPlayer(playerid, string,7000,3);
  466.             return 1;
  467.             }
  468.             fremove(string);
  469.             format(string,sizeof(string),"~y~]~g~Graffiti ~r~%d ~g~Succefully removed!~y~]",id);
  470.             GameTextForPlayer(playerid, string,7000,3);
  471.             DestroyDynamicObject( gInfo[id][OBJECTID] );
  472.  
  473.  
  474.         }
  475.         else return GRAFFDIALOG
  476.         return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
  477.     }
  478.    
  479.    
  480.     if(dialogid == DIALOG_COLOR)
  481.     {
  482.         if(response) // If they clicked 'Select' or double-clicked a weapon
  483.         {
  484.  
  485.             switch(listitem)
  486.             {
  487.  
  488.                 case 0: POBJECTC[playerid] = "000000";// BLACK
  489.  
  490.                 case 1: POBJECTC[playerid] = "FFFFFF"; // WHITE
  491.  
  492.                 case 2: POBJECTC[playerid] = "F81414"; // RED
  493.  
  494.                 case 3: POBJECTC[playerid] = "00FF22"; // GREEN
  495.  
  496.                 case 4: POBJECTC[playerid] = "00CED1"; // LIGHTBLUE
  497.  
  498.                 case 5: POBJECTC[playerid] = "C3C3C3";  // GREY
  499.  
  500.  
  501.             }
  502.             new string[128];
  503.             new string2[96];
  504.             format(string2, sizeof(string2),"{%s} %s",POBJECTC[playerid],POBJECTN[playerid]);
  505.             POBJECTN[playerid] = string2;
  506.             format(string,sizeof(string), ""COL_WHITE"Are you happy with your Color? \n  "COL_ORANGE"%s (Points to spray %d)1 point/second",string2, sprayammountch[playerid]);
  507.             ShowPlayerDialog(playerid, DIALOG_HAPPY, DIALOG_STYLE_MSGBOX, "Graffiti Menu", string, "Yes!", "No :(");
  508.             SCM(playerid, COLOR_LIGHTRED, string2);
  509.  
  510.  
  511.  
  512.         }
  513.         else return GRAFFINPUT
  514.         return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
  515.     }
  516.    
  517.     if(dialogid == DIALOG_HAPPY)
  518.     {
  519.         if(response) // If they clicked 'Yes' or pressed enter
  520.         {
  521.             startgraff(playerid);
  522.         }
  523.         else // Pressed ESC or clicked cancel
  524.         {
  525.             GRAFFINPUT
  526.         }
  527.         return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
  528.     }
  529.  
  530.    
  531.     if(dialogid == DIALOG_INPUTGRAFF)
  532.     {
  533.         if(!response) return GRAFFDIALOG
  534.        
  535.         if(isnull(inputtext)) return GRAFFINPUTER
  536.         else
  537.         {
  538.             new string[96];
  539.             format(string, sizeof(string),"%s",inputtext);
  540.             POBJECTN[playerid] = string;
  541.             sprayammountch[playerid] = strlen(string); // All characters input counted
  542.             GRAFFCOLOR
  543.         }
  544.  
  545.            
  546.         return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
  547.     }
  548.    
  549.    
  550.    
  551.  
  552.     return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
  553. }
  554.  
  555.  
  556.  
  557. forward startgraff(playerid);
  558. public startgraff (playerid)
  559. {
  560.     new Float:X[3];
  561.     GetPlayerPos( playerid, X[0], X[1], X[2] ); // SAving players position// storing params in a format // storing text in a player callback
  562.     POBJECT[playerid] = CreateDynamicObject( 19482, X[0], X[1], X[2], 0.0, 0.0, 0.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), playerid, 200 ); // Creating the graffiti for player
  563.     SetDynamicObjectMaterialText( POBJECT[playerid], 0, POBJECTN[playerid], OBJECT_MATERIAL_SIZE_256x256, "Diploma", 26, 0, 0xFFFFFFFF, 0, 1 ); // SEtting the text to what player wrote
  564.     EditDynamicObject( playerid, POBJECT[playerid] ); // Forcing the player to move the graffiti
  565.     SetPVarInt( playerid, "GraffitiCreating",1 ); // SEtting Graffiticreating positive for player
  566.     return 1; // End of script.
  567. }
  568.  
  569.  
  570.  
  571. /*-------END OF CALLBACKS-----------*/
  572.  
  573. /*
  574. COMMANDS;
  575. *
  576. **
  577. */
  578.  
  579.  
  580.  
  581.  
  582.  
  583. LEANCMD:(graffiti)
  584. {
  585.     GRAFFDIALOG
  586.     return 1;
  587. }
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594. /*-------END OF COMMANDS-----------*/
  595.  
  596.  
  597. /*-------END OF Leans Graffiti System Script-----------*/
Advertisement
Add Comment
Please, Sign In to add comment