SA-MP Forums Archive
Need some help for Gates - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need some help for Gates (/showthread.php?tid=353079)



Need some help for Gates - se7evolution - 22.06.2012

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


Re: Need some help for Gates - Mr.1337 - 22.06.2012

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..


Re: Need some help for Gates - se7evolution - 22.06.2012

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.)


Re: Need some help for Gates - Mr.1337 - 22.06.2012

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 " ( ) "


Re: Need some help for Gates - se7evolution - 22.06.2012

Thanks,