IsPlayerInRangeOfPoint for cops -
Dainyzxz - 20.03.2010
Код:
new c_gate_status;
forward CheckGate();
public CheckGate()
{
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i,10.0,1588.0451660156, -1638.1147460938, 15.199743270874))c_gate_status = 1;
}
if(c_gate_status) MoveObject(c_gate, 1598.0441894531, -1638.2209472656, 15.199743270874, 2);
else MoveObject(c_gate, 1588.0451660156, -1638.1147460938, 15.199743270874, 2);
}
Код:
c_gate = CreateObject(980, 1588.0451660156, -1638.1147460938, 15.199743270874, 0, 0, 0);
now this code is opening gates for everyone player, but i wanna make this automatic gates only for cops, but don't know how,
i was tryed but nothing gud happened
i have /police ant /outjob commands
police[playerid] = 1; | police[playerid] = 0;
new police[MAX_PLAYERS];
Re: IsPlayerInRangeOfPoint for cops -
ray187 - 20.03.2010
A solution is to create a global value for each player like:
cop[playerid].
In your function CheckGate you can then check whether cop[playerid] is true or false and make an if-clause depending on that.
Re: IsPlayerInRangeOfPoint for cops -
Dainyzxz - 20.03.2010
Quote:
Originally Posted by ray187
A solution is to create a global value for each player like:
cop[playerid].
In your function CheckGate you can then check whether cop[playerid] is true or false and make an if-clause depending on that.
|
i tryed this, then are cop[playerid] = true; gates opening, but not closing than player get out of RangePoint, than is cop[playerid] = false; gates not opening, but gates closing in RangePoint, i cant it make working
Re: IsPlayerInRangeOfPoint for cops -
MadeMan - 20.03.2010
pawn Код:
public CheckGate()
{
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i,10.0,1588.0451660156, -1638.1147460938, 15.199743270874) && cop[i] == 1)c_gate_status = 1;
}
if(c_gate_status) MoveObject(c_gate, 1598.0441894531, -1638.2209472656, 15.199743270874, 2);
else MoveObject(c_gate, 1588.0451660156, -1638.1147460938, 15.199743270874, 2);
}
Re: IsPlayerInRangeOfPoint for cops -
Dainyzxz - 20.03.2010
i don't understand this script, ERROR on ERROR
Код:
(433) : error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
Re: IsPlayerInRangeOfPoint for cops -
ray187 - 20.03.2010
Quote:
Originally Posted by SpectroTek
i tryed this, then are cop[playerid] = true; gates opening, but not closing than player get out of RangePoint, than is cop[playerid] = false; gates not opening, but gates closing in RangePoint, i cant it make working
|
I didn`t understand any of the above. Can you please rephrase that?
Re: IsPlayerInRangeOfPoint for cops -
Dainyzxz - 20.03.2010
Quote:
Originally Posted by ray187
Quote:
Originally Posted by SpectroTek
i tryed this, then are cop[playerid] = true; gates opening, but not closing than player get out of RangePoint, than is cop[playerid] = false; gates not opening, but gates closing in RangePoint, i cant it make working
|
I didn`t understand any of the above. Can you please rephrase that?
|
my bad english, sor.
i try to use cop[playerid] = true; but nothing happen as well as i need and playrd ID is undefined symbol
Re: IsPlayerInRangeOfPoint for cops -
ray187 - 20.03.2010
Of course you have to use a playerid given. Either you pass the playerid already when calling the function CheckGate();
Would look somehow like CheckGate(playerid);
or you loop through all connected players in CheckGate(); like MadeMan showed you.
Re: IsPlayerInRangeOfPoint for cops -
MadeMan - 20.03.2010
Quote:
Originally Posted by SpectroTek
i don't understand this script, ERROR on ERROR
Код:
(433) : error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
|
Which line? Show it please.
Re: IsPlayerInRangeOfPoint for cops -
Dainyzxz - 20.03.2010
sorry, it was my mistake with errors, 0 errors, but it still not working, than cop get out of range point, gate still opened, and thy closing than came player not cop