Help with a command for lift
#1



I need help with my lift. I am trying to make a lift work in my demoragen defence .
I am trying to make it so the lift works when:

- You are on the lift
- You are skin 70,276,286,287 ( i havent done this yet )

And make it not work when:

- You are skin, 275, 202, 133, 122
- And when you are not on the lift


This is my command or whatever:



NOTE* I do have a new float: x, float: y, float: z;

if (strcmp("/l1u", cmdtext, true, 10) == 0)
{
if ( > GetPlayerPos(playerid, 131.7778,1927.9940,1 && < GetPlayerPos(playerid, 139.6464,1954.1235,19.4223))
{
}
else
{
return GameTextForPlayer(playerid, "~w~ You are not on the lift!", 1000, 1);
}
MoveObject(l1,292.579040 , 1821.149536 , 25, 3);
MoveObject(l2,279.135253 , 1821.149536 , 25, 3);
GameTextForPlayer(playerid, "~Y~ Lift Rising", 3000, 5);
return 1;
}




I hope you can help me
Reply
#2

You need to get the x and y for how wide and long the lift is. Then you can see if their x and y is less then or greater to that. If you know how to do like gang zones or player bounds, do it like that. I can help you with the rest once you get those coords.
Reply
#3

Yea but i hav them right there. i made it so its like this....



[attachment deleted by admin]
Reply
#4

Use PlayerToPoint and GetPlayerSkin, Also if your gonna use a function then learn how to use it, Maybe try the Wiki
pawn Код:
if(strcmp("/gate", cmdtext, true) == 0)
{
  new skin;
  if(skin == w/e) // replace w/e with your skin id and use && for multiple skins
  {
    if(PlayerToPoint(10, playerid, w/e x, w/e y, w/e z))
    {
      // They are at the gate and they have the right skin
    }
    else
    {
      // They are not at the gate
    }
  }
  else
  {
    // They dont have the right skin
  }
  return 1;
}
Reply
#5

Im always using wiki.samp
Reply
#6

Try this. I think you mean || not && jenk. And you don't really need playertopoint for this. Especially since this is a square lift. There's no need to get the distance to the middle of the lift and it's just more accurate like this. Sorry, just trying to use constructive criticism.

pawn Код:
if (!strcmp("/l1u", cmdtext, true))
{
    new skin = GetPlayerSkin(playerid);
    if(skin == 70 || skin == 276 || skin == 286 || skin == 287)
    {
        new Float:px,Float:py,Float:pz;
        GetPlayerPos(playerid,px,py,pz);
        if(px > 131.7778 && px < 139.6464 && py > 1927.9940 && py < 1954.1235)
        {
            MoveObject(l1,292.579040 , 1821.149536 , 25, 3);
            MoveObject(l2,279.135253 , 1821.149536 , 25, 3);
            GameTextForPlayer(playerid, "~Y~ Lift Rising", 3000, 5);
            return 1;
        }
        else
        {
            return GameTextForPlayer(playerid, "~w~ You are not on the lift!", 1000, 1);
        }
    }
    else
    {
        //Wrong skin
    }
}
Reply
#7

Thankoyu so mutch im going to try it right away!
Reply
#8

Oops. I forgot to add in the check for the skin. It's updated now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)