Jump to content
  • 0

pomoc public GetDistanceBetweenPlayers


Fil

Dotaz

7 odpovědí na tuto otázku

Recommended Posts

  • 0

forward GetDistanceBetweenPlayers(playerid,playerid2);

 

stock GetDistanceBetweenPlayers(playerid,playerid2)
{
new Float:x1,Float:y1,Float:z12,Float:x2,Float:y2,Float:z21;
new Float:tmpdis;
GetPlayerPos(playerid,x1,y1,z12);
GetPlayerPos(playerid2,x2,y2,z21);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),
2)+floatpower(floatabs(floatsub(y2,y1)),
2)+floatpower(floatabs(floatsub(z21,z12)),2));
return floatround(tmpdis);
}

Link to comment
Share on other sites

  • 0
forward GetDistanceBetweenPlayers(playerid,playerid2);

 

stock GetDistanceBetweenPlayers(playerid,playerid2)
{
new Float:x1,Float:y1,Float:z12,Float:x2,Float:y2,Float:z21;
new Float:tmpdis;
GetPlayerPos(playerid,x1,y1,z12);
GetPlayerPos(playerid2,x2,y2,z21);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),
2)+floatpower(floatabs(floatsub(y2,y1)),
2)+floatpower(floatabs(floatsub(z21,z12)),2));
return floatround(tmpdis);
}

G:\pawno\mdcity.pwn(112) : error 010: invalid function or declaration

G:\pawno\mdcity.pwn(1518) : warning 219: local variable "x1" shadows a variable at a preceding level

G:\pawno\mdcity.pwn(1518) : warning 219: local variable "y1" shadows a variable at a preceding level

G:\pawno\mdcity.pwn(1519) : warning 219: local variable "tmpdis" shadows a variable at a preceding level

G:\pawno\mdcity.pwn(2235) : warning 219: local variable "x2" shadows a variable at a preceding level

G:\pawno\mdcity.pwn(2235) : warning 219: local variable "y2" shadows a variable at a preceding level

G:\pawno\mdcity.pwn(2460) : warning 219: local variable "x1" shadows a variable at a preceding level

G:\pawno\mdcity.pwn(2460) : warning 219: local variable "y1" shadows a variable at a preceding level

G:\pawno\mdcity.pwn(2466) : warning 219: local variable "x2" shadows a variable at a preceding level

G:\pawno\mdcity.pwn(2466) : warning 219: local variable "y2" shadows a variable at a preceding level

G:\pawno\mdcity.pwn(2476) : error 001: expected token: "-identifier-", but found "("

G:\pawno\mdcity.pwn(2480) : error 021: symbol already defined: "GetPlayerPos"

G:\pawno\mdcity.pwn(2485) : error 010: invalid function or declaration

G:\pawno\mdcity.pwn(2487) : warning 203: symbol is never used: "tmpdis"

G:\pawno\mdcity.pwn(2487) : warning 203: symbol is never used: "x1"

G:\pawno\mdcity.pwn(2487) : warning 203: symbol is never used: "x2"

G:\pawno\mdcity.pwn(2487) : warning 203: symbol is never used: "y1"

G:\pawno\mdcity.pwn(2487) : warning 203: symbol is never used: "y2"

G:\pawno\mdcity.pwn(2487) : warning 203: symbol is never used: "z12"

G:\pawno\mdcity.pwn(2487) : warning 203: symbol is never used: "z21"

Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

 

 

4 Errors.

Link to comment
Share on other sites

  • 0
Guest TriskacSK

forward GetDistanceBetweenPlayers(playerid,playerid2);

 

public GetDistanceBetweenPlayers(playerid,playerid2){
print("GetDistanceBetweenPlayers");
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
new Float:tmpdis;
GetPlayerPos(playerid,x1,y1,z1);
GetPlayerPos(playerid2,x2,y2,z2);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
return floatround(tmpdis);
}
Link to comment
Share on other sites

  • 0
forward GetDistanceBetweenPlayers(playerid,playerid2);

 

public GetDistanceBetweenPlayers(playerid,playerid2){
print("GetDistanceBetweenPlayers");
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
new Float:tmpdis;
GetPlayerPos(playerid,x1,y1,z1);
GetPlayerPos(playerid2,x2,y2,z2);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
return floatround(tmpdis);
}

 

to má být odpověď nebo jen zkopírování chytrákovo návodu ?

Link to comment
Share on other sites

  • 0

hmm chlapci :cry:

G:\pawno\mdcity.pwn(112) : error 010: invalid function or declaration

G:\pawno\mdcity.pwn(1518) : warning 219: local variable "x1" shadows a variable at a preceding level

G:\pawno\mdcity.pwn(1518) : warning 219: local variable "y1" shadows a variable at a preceding level

G:\pawno\mdcity.pwn(1518) : warning 219: local variable "z1" shadows a variable at a preceding level

G:\pawno\mdcity.pwn(1519) : warning 219: local variable "tmpdis" shadows a variable at a preceding level

G:\pawno\mdcity.pwn(2235) : warning 219: local variable "x2" shadows a variable at a preceding level

G:\pawno\mdcity.pwn(2235) : warning 219: local variable "y2" shadows a variable at a preceding level

G:\pawno\mdcity.pwn(2460) : warning 219: local variable "x1" shadows a variable at a preceding level

G:\pawno\mdcity.pwn(2460) : warning 219: local variable "y1" shadows a variable at a preceding level

G:\pawno\mdcity.pwn(2466) : warning 219: local variable "x2" shadows a variable at a preceding level

G:\pawno\mdcity.pwn(2466) : warning 219: local variable "y2" shadows a variable at a preceding level

G:\pawno\mdcity.pwn(2476) : error 001: expected token: "-identifier-", but found "("

G:\pawno\mdcity.pwn(2480) : error 021: symbol already defined: "GetPlayerPos"

G:\pawno\mdcity.pwn(2483) : error 010: invalid function or declaration

G:\pawno\mdcity.pwn(2485) : warning 203: symbol is never used: "tmpdis"

G:\pawno\mdcity.pwn(2485) : warning 203: symbol is never used: "x1"

G:\pawno\mdcity.pwn(2485) : warning 203: symbol is never used: "x2"

G:\pawno\mdcity.pwn(2485) : warning 203: symbol is never used: "y1"

G:\pawno\mdcity.pwn(2485) : warning 203: symbol is never used: "y2"

G:\pawno\mdcity.pwn(2485) : warning 203: symbol is never used: "z1"

G:\pawno\mdcity.pwn(2485) : warning 203: symbol is never used: "z2"

Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

 

 

4 Errors.

 

 

řádky:

1518-1519: new Float:x1,Float:y1,Float:z1;

new Float:tmpdis;

2235: new Float:x2,Float:y2,Float:az;

 

2460 až 2485:

GetVehicleWithinDistance(playerid, Float:x1, Float:y1, Float:z11, Float:dist, &veh)

{

for(new i = 1; i < MAX_VEHICLES; i++){

if(GetVehicleModel(i) > 0){

if(GetPlayerVehicleID(playerid) != i ){

new Float:x, Float:y, Float:z;

new Float:x2, Float:y2, Float:z22;

GetVehiclePos(i, x, y, z);

x2 = x1 - x; y2 = y1 - y; z22 = z11 - z;

new Float:vDist = (x2*x2+y2*y2+z22*z22);

if( vDist < dist){

veh = i;

dist = vDist;

}}}}

}

//////

public GetDistanceBetweenPlayers(playerid,playerid2){

print("GetDistanceBetweenPlayers");

new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;

new Float:tmpdis;

GetPlayerPos(playerid,x1,y1,z1);

GetPlayerPos(playerid2,x2,y2,z2);

tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));

return floatround(tmpdis);

}

 

112: forward GetDistanceBetweenPlayers(playerid,playerid2);

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...