[Help] Combining this together. - 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: [Help] Combining this together. (
/showthread.php?tid=137497)
[Help] Combining this together. -
Scenario - 28.03.2010
I am trying to combine the two below functions... How can I do that?
Full script:
Click here.
Both Parts:
I need to combine this...
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if((newkeys & KEY_ANALOG_RIGHT) && !(oldkeys & KEY_ANALOG_RIGHT))
{
if(IsPlayerInRangeOfPoint(playerid, 200, 3459.901611, -683.968445, 1.892129))
{
if(IsPlayerLuxAdmin(playerid))
{
if(GateOpened == false)
{
MoveObject (gate1,3459.955566, -679.748474, 1.874337,2);
MoveObject (gate2,3459.746826, -693.807861, 1.874337,2);
SendClientMessage(playerid, 0x00ff00ff, "[Security System]: Access Granted! Have a nice day!");
GateOpened = true;
return 1;
}
else if(GateOpened == true)
{
MoveObject (gate1,3459.901611, -683.968445, 1.892129,2);
MoveObject (gate2,3459.791260, -689.405701, 1.892129,2);
GateOpened = false;
return 1;
}
}
}
}
return 1;
}
and this...
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if((newkeys & KEY_ANALOG_RIGHT) && !(oldkeys & KEY_ANALOG_RIGHT))
{
if(IsPlayerLuxAdmin(playerid))
{
if(IsPlayerInRangeOfPoint(playerid, 200, 2287.92, 617.19, 12.00))
{
if(GateOpened == false)
{
MoveObject(admingate, 2287.92, 617.19, 6.00, 2);
SendClientMessage(playerid, COLOR_GREEN, "[Security System]: Access Granted! Have a nice day!");
GateOpened = true;
}
else if(GateOpened == true)
{
MoveObject (admingate, 2287.92, 617.19, 12.00, 2);
GateOpened = false;
}
}
else return 0;
}
else
{
}
return 1;
}
return 1;
}
together.
Anyone know how to do this? Thanks in advance.
Credits to: "[SAP]Sidhu", "Babul", and "[ĦŁ₣]ЉǾǖŦĦЗŁΛẄ".
Re: [Help] Combining this together. -
woot - 28.03.2010
https://sampwiki.blast.hk/wiki/Keywords:Statements#else
Re: [Help] Combining this together. -
Babul - 28.03.2010
create one more variable "AdminGateOpened", then it should work:
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if((newkeys & KEY_ANALOG_RIGHT) && !(oldkeys & KEY_ANALOG_RIGHT))
{
if(IsPlayerLuxAdmin(playerid))
{
if(IsPlayerInRangeOfPoint(playerid, 200, 3459.901611, -683.968445, 1.892129))
{
if(GateOpened == false)
{
MoveObject (gate1,3459.955566, -679.748474, 1.874337,2);
MoveObject (gate2,3459.746826, -693.807861, 1.874337,2);
SendClientMessage(playerid, 0x00ff00ff, "[Security System]: Access Granted! Have a nice day!");
GateOpened = true;
return 1;
}
else if(GateOpened == true)
{
MoveObject (gate1,3459.901611, -683.968445, 1.892129,2);
MoveObject (gate2,3459.791260, -689.405701, 1.892129,2);
GateOpened = false;
return 1;
}
}
else if(IsPlayerInRangeOfPoint(playerid, 200, 2287.92, 617.19, 12.00))
{
if(AdminGateOpened == false)
{
MoveObject(admingate, 2287.92, 617.19, 6.00, 2);
SendClientMessage(playerid, COLOR_GREEN, "[Security System]: Access Granted! Have a nice day!");
AdminGateOpened = true;
return 1;
}
else if(AdminGateOpened == true)
{
MoveObject (admingate, 2287.92, 617.19, 12.00, 2);
AdminGateOpened = false;
return 1;
}
}
}
}
return 1;
}
Re: [Help] Combining this together. -
Scenario - 29.03.2010
Ahh. Thanks Babul.