23.05.2012, 14:11
(
Last edited by Rg-Gaming.Info; 23/05/2012 at 04:52 PM.
)
Hello guys today i decided to make a tutorial about movin multiple gates.
So now you need to make a new pawn project in pawno.
If you don't have pawno download the server package from sa-mp.com.
For this tutorial you will also need the streamer plugin which you can download from here.
Now when you have everything setted up lets get started.
So now you need to make a new pawn project in pawno.
If you don't have pawno download the server package from sa-mp.com.
For this tutorial you will also need the streamer plugin which you can download from here.
Now when you have everything setted up lets get started.
Step #1: Include the streamer:
pawn Code:
#include <streamer>
Step #2: When you create the new project delete all unnecessarily callbacks till you have only public OnFilterScriptInit() and public OnPlayerCommandText.
pawn Code:
#include <a_samp>
#include <streamer>
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Multiple Gates ");
print("--------------------------------------\n");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
return 0;
}
Step #4: Now you need to define how much parameters the gate array is going to have. In this this tutorial i will have only 2. So in the [] put 2.
Step #5: Now lets move on to the gates. For this tutorial you must already have the gates code. First define each gate with in the array. And now in order to make the objects dynamic add an extra "Dynamic" to the CreateObject the code should look like this below. Also the those must be the gate "closed object". You need to do this ar the OnFilterScriptInit
pawn Code:
#include <a_samp>
#include <streamer>
new gate[2];
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Multiple Gates ");
print("--------------------------------------\n");
gate[0] = CreateDynamicObject(987,1496.59997559,-699.75000000,93.80000305,0.00000000,0.00000000,0.00000000);
gate[1] = CreateDynamicObject(987,1484.59997559,-699.75000000,93.80000305,0.00000000,0.00000000,0.00000000);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
return 0;
}
Step #6: Now it's time to make the commad for opening the gates. First you need your gate "opened object".
pawn Code:
if(!strcmp(cmdtext, "/open"))
{
MoveDynamicObject(gate[0], 1496.59997559,-699.75000000,86.80000305, 1);
MoveDynamicObject(gate[1], 1484.59997559,-699.75000000,86.80000305, 1);
return 1;
}
Step #7: Now it's time to make the commad for closing the gates. First you need your gate "closed object".
pawn Code:
if(!strcmp(cmdtext, "/close", true))
{
MoveDynamicObject(agate[0], 1496.59997559,-699.75000000,93.40000153, 1);
MoveDynamicObject(agate[1], 1484.59997559,-699.75000000,93.40000153, 1);
return 1;
}
Now here is how your code should look like in the end.
pawn Code:
#include <a_samp>
#include <streamer>
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Multiple Gates ");
print("--------------------------------------\n");
gate[0] = CreateDynamicObject(987,1496.59997559,-699.75000000,93.80000305,0.00000000,0.00000000,0.00000000);
gate[1] = CreateDynamicObject(987,1484.59997559,-699.75000000,93.80000305,0.00000000,0.00000000,0.00000000);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/open"))
{
MoveDynamicObject(gate[0], 1496.59997559,-699.75000000,86.80000305, 1);
MoveDynamicObject(gate[1], 1484.59997559,-699.75000000,86.80000305, 1);
return 1;
}
if(!strcmp(cmdtext, "/close"))
{
MoveDynamicObject(gate[0], 1496.59997559,-699.75000000,86.80000305, 1);
MoveDynamicObject(gate[1], 1484.59997559,-699.75000000,86.80000305, 1);
return 1;
}
}