SA-MP Forums Archive
gate open from skins - 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: gate open from skins (/showthread.php?tid=111534)



gate open from skins - Log1teCk - 02.12.2009

How can I make this scripting "automatic gate" to be able to add that only some skins gates to open, for example (skin 288, 281, 282, 283) ?

Код:
public CheckAPGates()
{
	for(new i=0; i<MAX_PLAYERS; i++)
	{
		if (IsPlayerConnected(i)) {
		  new Float:x, Float:y, Float:z;
			GetPlayerPos(i, Float:x, Float:y, Float:z);


			if (PlayerToPoint(30.0, i, 15980.288696, -16387.887085, 14.706839))
	  	{
				MoveObject(lsgate, 15987.288696, -16387.887085, 14.706839, 4);
				SetTimerEx("CloseAPGate", 1000, 0, "ii", 4, i);
			}



Re: gate open from skins - CaHbKo - 02.12.2009

pawn Код:
if (PlayerToPoint(30.0, i, 15980.288696, -16387.887085, 14.706839))
{
    new skin = GetPlayerSkin(playerid);
    if((skin == 288) || (skin == 281) || (skin == 282) || (skin == 283))
    {
        MoveObject(lsgate, 15987.288696, -16387.887085, 14.706839, 4);
        SetTimerEx("CloseAPGate", 1000, 0, "ii", 4, i);
    }
}



Re: gate open from skins - Log1teCk - 02.12.2009

C:\Users\Log1teCk\Downloads\samp03asvr_R3_win32\fi lterscripts\basic.pwn(324) : error 017: undefined symbol "playerid" what can do now?


Re: gate open from skins - Mike Garber - 02.12.2009

If you want everything made for you, you wont learn scripting.
And If you want someone else to do the whole thing for you, look in the Script request thread.



Re: gate open from skins - CaHbKo - 02.12.2009

pawn Код:
if (PlayerToPoint(30.0, i, 15980.288696, -16387.887085, 14.706839)) //Is the player at the gate?
{ //If yes, then:
    new skin = GetPlayerSkin(playerid); //"skin" now gets the player's skin ID.
    if((skin == 288) || (skin == 281) || (skin == 282) || (skin == 283)) //Does the player have the right skin?
    { //If yes, then:
        MoveObject(lsgate, 15987.288696, -16387.887085, 14.706839, 4);
        SetTimerEx("CloseAPGate", 1000, 0, "ii", 4, i);
    }
}
Ah yea, and use public "CheckAPGates(playerid)".


Re: gate open from skins - Correlli - 02.12.2009

Use IsPlayerInRangeOfPoint-function, it's faster than PlayerToPoint: https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint


Re: gate open from skins - Log1teCk - 02.12.2009

i test this but all the gates are opening for all skins... is not a restriction for selected skins... why?


Re: gate open from skins - laserhel50 - 02.12.2009

if(GetPlayerSkin(playerid) == 287)
{
Now code it further yourself.


Re: gate open from skins - Log1teCk - 02.12.2009

thanks, it's working, now we have a dilemma related to how I could make the barrier to be opened by KEY_HORN when you press "h" or Caps Lock "


Re: gate open from skins - laserhel50 - 02.12.2009

Quote:
Originally Posted by Log1teCk
thanks, it's working, now we have a dilemma related to how I could make the barrier to be opened by KEY_HORN when you press "h" or Caps Lock "
nice to hear u got it working