[Tutorial] How to make movable gate and openable for only 1 name.
#1

Quote:

#include <zcmd>

First of all you have to make one object that will be gate, my example is this:

Код:
CreateObject(987,1806.09997559,-1353.80004883,14.19999981,0.00000000,0.00000000,90.00000000);
That is just regular fence, then you have to create global variable
Make it above your OnGameModeInt

Код:
new gate;
This is the error you will get:

Код:
C:\Users\Mario\Desktop\lol\gamemodes\kuca.pwn(718) : warning 203: symbol is never used: "gate"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

1 Warning.
Then you have to do this:

Код:
gate = CreateObject(987,1806.09997559,-1353.80004883,14.19999981,0.00000000,0.00000000,90.00000000);
Make that below OnGameModeInt

After that you will get this error:

Код:
C:\Users\Mario\Desktop\lol\gamemodes\kuca.pwn(79) : warning 204: symbol is assigned a value that is never used: "gatee"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
All you have to do is:

Код:
new gate;

public OnGameModeInit()
{
     gate = CreateObject(987,1806.09997559,-1353.80004883,14.19999981,0.00000000,0.00000000,90.00000000); //object(elecfence_bar)
     return 1;
}
This may be little too much detail but it will make new scripters understand...

You will still get error so you gotta do this;

Код:
CMD:opengate(playerid,params[])
{
    MoveObject(gate,1808.00000000,-1354.19995117,7.89999962, 1.500000);
    SendClientMessage(playerid, COLOR_GREEN, "You have succesfully openned the gate!");
    return 1;
}
I use zcmd to make commands, its easy way.
if you use it too, put this at top of your script
Код:
#include <zcmd>
Now let me explain the command
Код:
CMD:opengate(playerid,params[])
This is to make command, the basic.
Код:
MoveObject(gate,1808.00000000,-1354.19995117,7.89999962, 1.500000);
This is to move object "gate" you have made. It moves it down.
Код:
MoveObject(objectid, Float:X, Float:Y, Float:Z, Float:Speed);
http://www.we-r-here.com/cad_07/tuto...s/xyz_axes.gif
That is link to learn it.

So you got X Y Z at CreateObject too, so if you want to move down the object ou just low the Z. Example:
This is Z= 15.89999962 So if you want to move object down u change that to 7.89999962..

Now you have moved the gate down, now let me teach you how to put it back up!
You do all the same:

Код:
CMD:closegate(playerid,params[])
{
    MoveObject(gate,1806.09997559,-1353.80004883,14.19999981, 1.500000);
    SendClientMessage(playerid, COLOR_GREEN, "You have succesfully closed the gate!");
    return 1;
}
You do all the same, but now you move object up, so you put Z how it was at CreateObject..
If you want just one name can open the gate, you put this:
Код:
CMD:opengate(playerid,params[])
{
   new PlayerName[24];
   GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
   if(strcmp(PlayerName,"NAME",true))
   {
     SendClientMessage(playerid, COLOR_RED, "Only NAME can open the gate!");
   }
   MoveObject(gate,1808.00000000,-1354.19995117,7.89999962, 1.500000);
   SendClientMessage(playerid, COLOR_GREEN, "You have succesfully openned the gate!");
   return 1;
}
I hope you learned something from my lame english..
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)