Move Multiple cars in a straight line, but + metres? -
Norn - 19.02.2009
The multiple cars in the title, is what i will be doing later.
pawn Код:
if(strcmp(cmd, "/masshousemove", true) == 0)
{
if (PlayerInfo[playerid][pAdmin] >= 20)
{
for(new i = 0; i < sizeof(Houses); i++)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid, x, y, z);
new Float:metres = 1.0;
metres += 1.0;
Houses[i][EnterX] = metres+x;
Houses[i][EnterY] = y;
Houses[i][EnterZ] = z;
Houses[i][EnterWorld] = GetPlayerVirtualWorld(playerid);
Houses[i][EnterInterior] = GetPlayerInterior(playerid);
new Float:angle;
GetPlayerFacingAngle(playerid, angle);
Houses[i][EnterAngle] = angle;
DestroyPickup(Houses[i][PickupID]);
if(Houses[i][Owned] == 0)
{
Houses[i][PickupID] = CreatePickup(1273, 1, Houses[i][EnterX], Houses[i][EnterY], Houses[i][EnterZ]);
}
else if(Houses[i][Owned] == 1)
{
Houses[i][PickupID] = CreatePickup(1239, 1, Houses[i][EnterX], Houses[i][EnterY], Houses[i][EnterZ]);
}
//format(string, sizeof(string), "%f", metres);
//SendClientMessage(playerid,COLOR_ADMINCMD, string);
//SaveHouses();
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Your not an administrator.");
}
return 1;
}
I'm trying to make this command, move all the houses in a straight line, but + metres.
Obviously i've done something wrong, but i thought this would work.
For example:
[ME] - I then do the command.
[ME] - [CAR] [CAR] [CAR] [CAR] [CAR] [CAR]
Re: Move Multiple cars in a straight line, but + metres? -
Norn - 19.02.2009
Anyone?
Re: Move Multiple cars in a straight line, but + metres? -
ICECOLDKILLAK8 - 19.02.2009
Why would you wanna move every house entrance and exit to 1 position?
Re: Move Multiple cars in a straight line, but + metres? -
Norn - 19.02.2009
Quote:
Originally Posted by JeNkStAX
Why would you wanna move every house entrance and exit to 1 position?
|
Because i use dynamic vehicles, houses and businesses and there positions are all null unless there set.
Why does it matter why i want it, it's not one position, it's the players plus 1.0 metre every time.
Re: Move Multiple cars in a straight line, but + metres? -
Nero_3D - 19.02.2009
you did
pawn Код:
new Float:metres = 1.0;
metres += 1.0;
in the loop and so each pickup was exactly 2.0 m away
pawn Код:
if(strcmp(cmd, "/masshousemove", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] < 20)
return SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Your not an administrator.");
new i, pmodel,
Float:distance = 1.0,
Float:metres = distance;
for(; i < sizeof(Houses); i++, metres += distance)
{
GetPlayerPos(playerid, Houses[i][EnterX], Houses[i][EnterY], Houses[i][EnterZ]);
GetPlayerFacingAngle(playerid, Houses[i][EnterAngle]);
Houses[i][EnterX] += (metres * floatsin(-Houses[i][EnterAngle], degrees));
Houses[i][EnterY] += (metres * floatcos(-Houses[i][EnterAngle], degrees));
Houses[i][EnterWorld] = GetPlayerVirtualWorld(playerid);
Houses[i][EnterInterior] = GetPlayerInterior(playerid);
DestroyPickup(Houses[i][PickupID]);
switch(Houses[i][Owned])
{
case 0: pmodel = 1273;
case 1: pmodel = 1239;
}
Houses[i][PickupID] = CreatePickup(pmodel, 1, Houses[i][EnterX], Houses[i][EnterY], Houses[i][EnterZ]);
//SaveHouses();
}
return 1;
}
Re: Move Multiple cars in a straight line, but + metres? -
Norn - 19.02.2009
Quote:
Originally Posted by ♣ ⓐⓢⓢ
you did
pawn Код:
new Float:metres = 1.0; metres += 1.0;
in the loop and so each pickup was exactly 2.0 m away
pawn Код:
if(strcmp(cmd, "/masshousemove", true) == 0) { if(PlayerInfo[playerid][pAdmin] < 20) return SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Your not an administrator."); new i, pmodel, Float:distance = 1.0, Float:metres = distance; for(; i < sizeof(Houses); i++, metres += distance) { GetPlayerPos(playerid, Houses[i][EnterX], Houses[i][EnterY], Houses[i][EnterZ]); GetPlayerFacingAngle(playerid, Houses[i][EnterAngle]); Houses[i][EnterX] += (metres * floatsin(-Houses[i][EnterAngle], degrees)); Houses[i][EnterY] += (metres * floatcos(-Houses[i][EnterAngle], degrees)); Houses[i][EnterWorld] = GetPlayerVirtualWorld(playerid); Houses[i][EnterInterior] = GetPlayerInterior(playerid); DestroyPickup(Houses[i][PickupID]); switch(Houses[i][Owned]) { case 0: pmodel = 1273; case 1: pmodel = 1239; } Houses[i][PickupID] = CreatePickup(pmodel, 1, Houses[i][EnterX], Houses[i][EnterY], Houses[i][EnterZ]); //SaveHouses(); } return 1; }
|
Very smart, works like a treat! Thanks dude