//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];
public OnGameModeInit()
{
SetTimer("Velocity",UPDATE_PICKUPS_TIMER,true);
return 1;
}
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]);
}
}
}
}
}
}
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;
}
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;
}
You've not actually posted your "CreateVelocity" function. And why are you using arrays to hold three variables?
|
No, but I've just spotted the problem - you use "d" not "f" in "sscanf". Try "extract":
pawn Код:
pawn Код:
|