Need some help for Gates
#1

Hey Guys,
I know that i am asking alot of questions this days because i am building my own server. Anyways i am trying to make a gate system that opens only to Company members or House Owner, The Default commands is /(o)pen. Also the gate should close automatically in 7 seconds
So my question how i can make a system that is easy to configurate or ways to add gates,
Like this
For Companies
pawn Код:
[Object id], [closed X], [closedY], [closedZ], [openX], [open Y], [openZ], [Company ID], [1] //1 means Company Gate.
For Houses
pawn Код:
[Object id], [closed X], [closedY], [closedZ], [openX], [open Y], [openZ], [House ID], [2] //1 means Houses.
After gate
Failed to open gate
Company: You are not the Company member of this gate
Houses: You need to be the House owner to open this gate

Succeed to open gate
Company: Gate opened
Houses: Gate Opened

for those i think i should just use
pawn Код:
SendPlayerMessage
I am using a Mysql panel so it is easier for me to see which house is which id or which company is which id
Reply
#2

Here's a completely different way:

at the start of your script, add this:
pawn Код:
new object;
and
pawn Код:
forward close();
now, under OnGameModeInit add this

pawn Код:
public OnGameModeInit()
{
           object = CreateObject(your gate informations);
           return 1;
}
Now, get the coordinates of the gate when it's opened, and now you need the command..

pawn Код:
if (strcmp("/openmygate", cmdtext, true, 10) == 0)
{
        MoveObject(object, and then type here the new coordinates when it's opened,and now the speed you want the gate to open);
        SetTimer("close", 7000, 0); // 7000 = 7seconds
        return 1;
}
and now, the coordinates of the gate when it closes:
pawn Код:
public close()
{
       MoveObject(object, new coordinates of the gate when it close, speed);
       return 1;
}
Hope I helped..
Reply
#3

Quote:
Originally Posted by Mr.1337
Посмотреть сообщение
Here's a completely different way:

at the start of your script, add this:
pawn Код:
new object;
and
pawn Код:
forward close();
now, under OnGameModeInit add this

pawn Код:
public OnGameModeInit()
{
           object = CreateObject(your gate informations);
           return 1;
}
Now, get the coordinates of the gate when it's opened, and now you need the command..

pawn Код:
if (strcmp("/openmygate", cmdtext, true, 10) == 0)
{
        MoveObject(object, and then type here the new coordinates when it's opened,and now the speed you want the gate to open);
        SetTimer("close", 7000, 0); //7000 = 7seconds
        return 1;
}
and now, the coordinates of the gate when it closes:
pawn Код:
public close()
{
       MoveObject(object, new coordinates of the gate when it close, speed);
       return 1;
}
Hope I helped..
Hey, Yeah i know all of this but i need to make it (only for company members or only for house owners.)
Reply
#4

Quote:
Originally Posted by se7evolution
Посмотреть сообщение
Hey, Yeah i know all of this but i need to make it (only for company members or only for house owners.)
Alright then, If you have pLeader defined or something, you can do this:
pawn Код:
if (strcmp("/openmygate", cmdtext, true, 10) == 0)
{
        if(PlayerInfo[playerid][pLeader] >= (faction ID)
        {
        MoveObject(object, and then type here the new coordinates when it's opened,and now the speed you want the gate to open);
        SetTimer("close", 7000, 0); //7000 = 7seconds
        return 1;
}
Also, add the faction ID without the " ( ) "
Reply
#5

Thanks,
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)