Autogate for certain skin.
#1

How do i make this work for just skin 20. i used GetPlayerSkin so the skin function is:

if(Skin==20);

public boatgate2timer()
{
new boatgate2status;
for(new i1;i1<MAX_PLAYERS;i1++)
{
if(!IsPlayerConnected(i1)) continue;
/* You would only use this if you're using SA-MP v0.2x or lower
if(PlayerToPoint(10.0, i, closed_X, closed_Y, closed_Z))c_gate_status = 1;
*/
if(IsPlayerInRangeOfPoint(i1,5,-2468.371338, 1547.240723, 24.030167))boatgate2status = 1;
}
if(boatgate2status)MoveObject(cozgate, -2468.352051, 1547.224243, 21.280209,1);
else MoveObject(cozgate, -2468.371338, 1547.240723, 24.030167, 1);
return 1;
}
Reply
#2

if(GetPlayerSkin == 20)
{
//urcode
}
Reply
#3

I can't read your code, and most of it is not right. Here's a working one.

pawn Код:
forward boatgate2timer();
public boatgate2timer() {
  for(new i = 0; i > MAX_PLAYERS; i ++ ) {
    if(IsPlayerConnected(i)) {
       if(GetPlayerSkin(i) == 20) {
         if(PlayerToPoint(10.0, i, closed_X, closed_Y, closed_Z)) {
            boatgate2status = 1;
         }
         if(boatgate2status) return MoveObject(cozgate, -2468.352051, 1547.224243, 21.280209,1);
         else if(boatgate2status) return MoveObject(cozgate, -2468.371338, 1547.240723, 24.030167, 1);
       }
    }
  }
}
Reply
#4

My script is correct, playertopoint is 0.2, my script is 0.3
Reply
#5

PlayerToPoint is not a SA-MP function. So it will work in both versions.
Reply
#6

IsPlayerInRangeOfPoint works fine. How do i use the && feature?


I want it like this: if(boatgate2status)MoveObject(cozgate, -2468.352051, 1547.224243, 21.280209,1); && if(Skin == 20);
Reply
#7

You're not helping yourself by wanting it the way you want it put together when the code is 100% wrong. Read http://www.wiki.sa-mp.com to learn how to use functions, and expression and learn statements etc.
Reply
#8

i got it from here: https://sampwiki.blast.hk/wiki/Automatic_Gates for your information, my script is fine, works fine and everything else, i dont give a shit about your way of doing it, i just want to know how to adapt it to skin id 20 only.

Quote:

Important Note: Since 0.3, you have IsPlayerInRangeOfPoint to your availability. This is a native function and works faster than PlayerToPoint.

By the Way,
Quote:

Read http://www.wiki.sa-mp.com to learn how to use functions, and expression and learn statements etc.

Failed link...
Reply
#9

'For my information', you're just copying and pasting a script that script that you don't know how to edit makes me 'not give a shit' about what you're asking anymore. The code I gave you is perfectly fine. But whatever people like to complain about little stuff like little girls. Here's the code 'in your way'

pawn Код:
public boatgate2timer()
{
new boatgate2status;
for(new i1;i1<MAX_PLAYERS;i1++)
{
if(!IsPlayerConnected(i1)) continue;
/* You would only use this if you're using SA-MP v0.2x or lower
if(PlayerToPoint(10.0, i, closed_X, closed_Y, closed_Z && GetPlayerSkin(i1) == 20) )c_gate_status = 1;
*/

if(IsPlayerInRangeOfPoint(i1,5,-2468.371338, 1547.240723, 24.030167 && GetPlayerSkin(i1) == 20))boatgate2status = 1;
}
if(boatgate2status)MoveObject(cozgate, -2468.352051, 1547.224243, 21.280209,1);
else MoveObject(cozgate, -2468.371338, 1547.240723, 24.030167, 1);
return 1;
}

Edit: Had to edit the code.
Reply
#10

Here:

pawn Код:
public boatgate2timer()
{
  new boatgate2status;
  for(new i1;i1<MAX_PLAYERS;i1++)
  {
        new playerskin;
    playerskin = GetPlayerSkin(i1);
    if(!IsPlayerConnected(i1) && IsPlayerInRangeOfPoint(i1,5,-2468.371338, 1547.240723, 24.030167) && playerskin == 20)
    {
          boatgate2status = 1;
    }
    if(boatgate2status == 1)
    {
        MoveObject(cozgate, -2468.352051, 1547.224243, 21.280209,1);
      }
    else MoveObject(cozgate, -2468.371338, 1547.240723, 24.030167, 1);
    return 1;
  }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)