02.11.2012, 11:18
(
Последний раз редактировалось [D]ry[D]esert; 02.11.2012 в 12:28.
)
Hello every one, i would like to know why when i pass on velocity it make me slow(not what type in the command).
the command is /velocity speed
speed:y speed:z
Here is my code
and Here is the command for Creating velocity
Thanks.
the command is /velocity speed
![angry](images/smilies/mad.gif)
Here is my code
pawn Код:
//at the top
#define MAX_VELOCITY 500
#define UPDATE_PICKUPS_TIMER 1
new VelocityCounter;
enum vinfo
{
Float:Pos[3],
Float:V[3]
};
new VELOCITY[MAX_VELOCITY][vinfo];
pawn Код:
public OnGameModeInit()
{
SetTimer("Velocity",UPDATE_PICKUPS_TIMER,true);
return 1;
}
pawn Код:
forward Velocity();
public Velocity()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
for(new x; x<VelocityCounter; x++)
{
if(IsPlayerInRangeOfPoint(i,1,VELOCITY[x][Pos][0],VELOCITY[x][Pos][1],VELOCITY[x][Pos][2]))
{
if(IsPlayerInAnyVehicle(i))
{
new Float:X,Float:Y,Float:Z;
GetVehicleVelocity(GetPlayerVehicleID(i),X,Y,Z);
SetVehicleVelocity(GetPlayerVehicleID(i),X*VELOCITY[x][V][0],Y*VELOCITY[x][V][1],Z*VELOCITY[x][V][2]);
}
}
}
}
}
}
pawn Код:
CMD:velocity(playerid,params[])
{
new Float:v[3];
if(sscanf(params, "ddd", v[0],v[1],v[2])) return SendClientMessage(playerid, 0xFF0000AA, "Command Usage: /velocity [x:speed] [y:speed] [z:speed]");
new Float:PoS[3];
GetPlayerPos(playerid,PoS[0],PoS[1],PoS[2]);
CreateVelocity(PoS[0],PoS[1],PoS[2],v[0],v[1],v[2]);
SendClientMessage(playerid,-1,"Velocity added");
return 1;
}
pawn Код:
stock CreateVelocity(Float:x,Float:y,Float:z,Float:vx,Float:vy,Float:vz)
{
Create3DTextLabel("[Velocity]",0xDEEE20FF,x,y,z,100,0);
VELOCITY[VelocityCounter][Pos][0] = x;
VELOCITY[VelocityCounter][Pos][1] = y;
VELOCITY[VelocityCounter][Pos][2] = z;
VELOCITY[VelocityCounter][V][0] = vx;
VELOCITY[VelocityCounter][V][1] = vy;
VELOCITY[VelocityCounter][V][2] = vz;
VelocityCounter++;
return 1;
}