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



Gates - Drowzz - 17.06.2010

Hey People,

Now i have got this:

Код:
new poort;

	MoveObject(poort, 3502.5634765625, -187.08984375, 9.2750568389893, 2.0);

	poort = CreateObject(10828, 3502.5634765625, -187.08984375, 9.2750568389893, 0.0, 0.0, 0.4998779296875);

	if (strcmp("/agateopen", cmdtext, true, 10) == 0)
	{
 		MoveObject(poort, 3502.5634765625, -187.08984375, 3.1000456809998, 2.0);
		SendClientMessage(playerid, 0x00FF00AA, "De poort is nu geopend.");
		SetTimer("GateClose", 9000, false);
		return 1;
	}
Its with a command...
I want that u press the Space balk that the gates opens.. WIthouth command.
How to fix that?
Greetingz Drowzz



Re: Gates - Mike_Peterson - 17.06.2010

Nederland FTW

Hmm, i guess its something with OnPlayerKeyStateChange
Sorry i cant help you, im not experienced on keys

Cya, and goodluck on ur project.


Re: Gates - Cameltoe - 17.06.2010

You can use isplayerinrange and the gate will open itself
Код:
if (IsPlayerInRange(Range, Float: Z_Range, Float:tar_x, Float:tar_y, Float:tar_z)



Re: Gates - MadeMan - 17.06.2010

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SPRINT)
    {
        MoveObject(poort, 3502.5634765625, -187.08984375, 3.1000456809998, 2.0);
        SendClientMessage(playerid, 0x00FF00AA, "De poort is nu geopend.");
        SetTimer("GateClose", 9000, false);
        return 1;
    }
    return 1;
}



Re: Gates - Mike_Peterson - 18.06.2010

Mademan made it but, wouldnt it be better if you also use isplayerinrange
Then show a GameModeText and then allow key_sprint coz else you can open the gate when u start sprinting -.-


Re: Gates - Drowzz - 19.06.2010

Can u make an example for me with is player in arrange?


Re: Gates - ViruZZzZ_ChiLLL - 19.06.2010

Quote:
Originally Posted by Drowzz
Can u make an example for me with is player in arrange?
You mean like this?
pawn Код:
IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z);



Re: Gates - Drowzz - 19.06.2010

Yes, I dont understand what is must fill in...? :S


Re: Gates - ViruZZzZ_ChiLLL - 19.06.2010

Quote:
Originally Posted by Drowzz
Yes, I dont understand what is must fill in...? :S
Код:
(playerid, Float:range, Float:x, Float:y, Float:z)
playerid	     The ID of the player you want to check the point range of.
Float:range	The furthest distance the player can be to be in range.
Float:x	     The X coordinate of the point to check the range to.
Float:y	     The Y coordinate of the point to check the range to.
Float:z	     The Z coordinate of the point to check the range to.



Re: Gates - ledzep - 19.06.2010

A good read:
https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange

List of key values:
https://sampwiki.blast.hk/wiki/GetPlayerKeys