SA-MP Forums Archive
Need help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help (/showthread.php?tid=188622)



Need help - Franklyn - 08.11.2010

Hi. I've seen server, where my gate open/close automatically if i've bought a house, which have gate. And gate opens only for house owner and house renters. So can someone help me? I need to make gate moving automatically if i own this house. But not for others.
Also it can be command , what only this house owner/renter can use.
Well. I'm new scripter, but i know how to make gate with command. But then can everyone use this command :/ .

----
Thanks.
Franklyn.


Re: Need help - Jochemd - 08.11.2010

Well, if you have written the owners name into a variable, you can do it this way (this would be for 'house 1'

pawn Код:
if(!strcmp("/opengate", cmdtext, true))
    {
        if(!strcmp(Ownername[House1],Playername,true))
        {
            SetTimer("OnGateMoveBack",4000,false); // setting a timer to move the gate back
            MoveObject(blablabla); // Put your info here to move the gate to
            MoveGateBack[playerid] = 1; // Do not forget to define this.
        }
        return 1;
    }
pawn Код:
forward OnGateMoveBack();
public OnGateMoveBack()
{
    if(MoveGateBack[playerid] == 1)
    {
        MoveObject(blabla); // move the object back
        MoveGateBack[playerid] = 0;
    }
    return 1;
}
Please note that I have not done something good now by writing almost the whole code. try making it yourself next time and learn these function, and the 'Related Functions'. They're really useful.


Re: Need help - Franklyn - 08.11.2010

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
Well, if you have written the owners name into a variable, you can do it this way (this would be for 'house 1'

pawn Код:
if(!strcmp("/opengate", cmdtext, true))
    {
        if(!strcmp(Ownername[House1],Playername,true))
        {
            SetTimer("OnGateMoveBack",4000,false); // setting a timer to move the gate back
            MoveObject(blablabla); // Put your info here to move the gate to
            MoveGateBack[playerid] = 1; // Do not forget to define this.
        }
        return 1;
    }
pawn Код:
forward OnGateMoveBack();
public OnGateMoveBack()
{
    if(MoveGateBack[playerid] == 1)
    {
        MoveObject(blabla); // move the object back
        MoveGateBack[playerid] = 0;
    }
    return 1;
}
Please note that I have not done something good now by writing almost the whole code. try making it yourself next time and learn these function, and the 'Related Functions'. They're really useful.

Thanks i will try it. Thing is , that i've been scripting only week : ).

---
Thanks.
Franklyn.


Re: Need help - Jochemd - 08.11.2010

No problem, new scripters are always welcome ^^ but learn these functions. They're useful. ^^