gate scripting 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)
+--- Thread: gate scripting help (
/showthread.php?tid=626396)
gate scripting help -
XHunterZ - 14.01.2017
I want a gate openable with a command, basically it is like moveobject but if i type /opengate, it gets opened but after 5 seconds it must be closed back or come to its initial position.. gimme the codes, i'll write coordinates myself, thank you, i'll rep up for sure..
Re: gate scripting help - iLearner - 14.01.2017
Not the right section for that... but since i have it in my code, ill post it, but you gotta edit it, gimme 1 min.
PHP код:
new Gate, Bool:Open;
ongminit()
{
//create obj on gminit
Gate = CreateDynamicObject(971,1033.2990000,-363.1990000,76.5000000,0.0000000,0.0000000,329.9960000);
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_NO)) // key N
{
if(IsPlayerInRangeOfPoint(playerid,3,1037.6825,-366.1670,73.8657) || IsPlayerInRangeOfPoint(playerid,3,1028.8965,-360.5697,73.9318)) //Gate 1
{
switch(Open) //Check whether the gate opened or closed
{
case true: //the gate opened
{
MoveDynamicObject(Gate,1033.2990000,-363.1990000,76.5000000,3.5,0.0000000,0.0000000,329.9960000); //Close the gate
Open = false; //false for closed
}
case false: //If the gate closed
{
MoveDynamicObject(Gate,1028.880,-365.665,76.500,3.5,0.000,0.000,-98.703); //Open the gate
Open = true; //true for opened
SetTimer("closegate", 20000, false);
}
}
}
}
return 1;
}
// the function
forward closegate();
public closegate()
{
// if the gate is open
if(Open == true)
{
MoveDynamicObject(Gate,1033.2990000,-363.1990000,76.5000000,3.5,0.0000000,0.0000000,329.9960000); //Close the gate
Open = false; //false for closed
return 1;
}
}
Re: gate scripting help -
XHunterZ - 14.01.2017
it's kinda scripting help since u are helping me, i'll understand the code and would never need to be assisted or to urge anyone on sa-mp forums :P
Re: gate scripting help - iLearner - 14.01.2017
No, thats a script request actually.
Re: gate scripting help -
XHunterZ - 14.01.2017
rep'd up faggot