28.04.2015, 08:06
In this tutorial I'll be showing an example of how to edit a big piece of code very easily.
I will be using a text editor called: Sublime Text 2 (Free)
You don't have to code your scripts in this text editor, I just copy the pieces I need to edit into Sublime and copy them back to pawno once they're done.
The code that we want to edit: (of course your code can be much bigger)
In this tutorial I will be changing the code shown above so that it is using the function CreateDynamicObject from incognito's streamer.
So go ahead and copy the code into sublime
Now press CTRL + H, this will show you the replace window at the bottom of your screen
Now in the 'Find what:' area we will type 'CreateObject' and in the 'Replace With:' area we put 'CreateDynamicObject'
This replaces all instances of 'CreateObject' with 'CreateDynamicObject'
Press the replace all button and you should see that all instances of 'CreateObject' were replaced with 'CreateDynamicObject'
But wait! The parameters of the function are still not right with CreateDynamicObject.
CreateDynamicObject function:
CreateObject function:
As you can see, the function used in our script is missing 5 parameters.
These are:
Now that we know this, we can start editing the functions.
First let's remove all the ');' from the end of the functions just by using the replace feature.
Replace with: (nothing)
Now that all the ');' are gone, we can go ahead and select all lines. (CTRL + A)
and now do CTRL + SHIFT + L and RIGHT ARROW
It may sound complicated but once you've done it right, it should look like this:
You can now type something and it will appear on the end of each line! How easy was that?
Let's simply type in our parameters now and close them with a ');'
That's it, you're done! How easy was that?
(Yes, you could have done the last part with the replace feature aswell but I wanted to show the CTRL + SHIFT + L feature )
I will be using a text editor called: Sublime Text 2 (Free)
You don't have to code your scripts in this text editor, I just copy the pieces I need to edit into Sublime and copy them back to pawno once they're done.
The code that we want to edit: (of course your code can be much bigger)
PHP Code:
CreateObject(19377, 2817.83130, 2668.52466, 9.89860, 0.00000, 90.00000, 90.00000);
CreateObject(19355, 2814.20215, 2670.69873, 9.77740, 0.00000, 0.00000, 90.00000);
CreateObject(19355, 2821.47583, 2670.69873, 9.77740, 0.00000, 0.00000, 90.00000);
CreateObject(19447, 2814.39282, 2665.95923, 11.71586, 0.00000, 0.00000, 0.00000);
CreateObject(19447, 2821.30029, 2665.95923, 11.71590, 0.00000, 0.00000, 0.00000);
CreateObject(19447, 2824.65405, 2665.23804, 11.71590, 0.00000, 0.00000, 90.00000);
CreateObject(14409, 2817.80811, 2668.45142, 8.34180, 0.00000, 0.00000, 180.00000);
CreateObject(19355, 2815.73853, 2669.94287, 9.78740, 0.00000, 0.00000, 0.00000);
CreateObject(19355, 2819.80566, 2669.94287, 9.78740, 0.00000, 0.00000, 0.00000);
CreateObject(19362, 2822.40845, 2672.22388, 11.46280, 0.00000, 90.00000, 0.00000);
CreateObject(19362, 2818.90991, 2672.22388, 11.46280, 0.00000, 90.00000, 0.00000);
CreateObject(19362, 2815.41040, 2672.22388, 11.46280, 0.00000, 90.00000, 0.00000);
CreateObject(19362, 2811.91748, 2672.22388, 11.46280, 0.00000, 90.00000, 0.00000);
CreateObject(19377, 2817.83130, 2679.06250, 10.35130, 0.00000, 90.00000, 90.00000);
CreateObject(19447, 2817.83130, 2673.74561, 9.79898, 0.00000, 0.00000, 90.00000);
CreateObject(19454, 2822.16064, 2678.64331, 11.46280, 0.00000, 90.00000, 0.00000);
CreateObject(19454, 2813.73828, 2678.64331, 11.46280, 0.00000, 90.00000, 0.00000);
CreateObject(19447, 2820.48950, 2678.62842, 9.79900, 0.00000, 0.00000, 0.00000);
CreateObject(19447, 2815.40869, 2678.62842, 9.79900, 0.00000, 0.00000, 0.00000);
CreateObject(1437, 2817.84009, 2664.65259, 9.98590, 10.00000, 0.00000, 0.00000);
CreateObject(19447, 2811.02466, 2665.23804, 11.71590, 0.00000, 0.00000, 90.00000);
CreateObject(19447, 2816.50171, 2661.86768, 11.71590, 0.00000, 0.00000, -45.00000);
CreateObject(19447, 2819.20361, 2661.87158, 11.71590, 0.00000, 0.00000, 45.00000);
So go ahead and copy the code into sublime
Now press CTRL + H, this will show you the replace window at the bottom of your screen
Now in the 'Find what:' area we will type 'CreateObject' and in the 'Replace With:' area we put 'CreateDynamicObject'
This replaces all instances of 'CreateObject' with 'CreateDynamicObject'
Press the replace all button and you should see that all instances of 'CreateObject' were replaced with 'CreateDynamicObject'
But wait! The parameters of the function are still not right with CreateDynamicObject.
CreateDynamicObject function:
Code:
CreateDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 200.0, Float:drawdistance = 0.0);
Code:
CreateObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:DrawDistance [not used in our script])
These are:
Code:
worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 200.0, Float:drawdistance = 0.0
First let's remove all the ');' from the end of the functions just by using the replace feature.
Replace with: (nothing)
Now that all the ');' are gone, we can go ahead and select all lines. (CTRL + A)
and now do CTRL + SHIFT + L and RIGHT ARROW
It may sound complicated but once you've done it right, it should look like this:
You can now type something and it will appear on the end of each line! How easy was that?
Let's simply type in our parameters now and close them with a ');'
That's it, you're done! How easy was that?
(Yes, you could have done the last part with the replace feature aswell but I wanted to show the CTRL + SHIFT + L feature )