gate open from skins
#1

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);
			}
Reply
#2

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);
    }
}
Reply
#3

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

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.
Reply
#5

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)".
Reply
#6

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

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

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

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 "
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)