public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/speed", cmdtext, true, 10) == 0)
{
new Float:XX, Float:YY, Float:ZZ, Speed[MAX_PLAYERS], SpeedMessage[128];
GetVehicleVelocity(GetPlayerVehicleID(playerid), XX, YY, ZZ);
Speed[playerid] = XX+YY+ZZ;
format(SpeedMessage, sizeof(SpeedMessage), "Your current speed: %d", Speed[playerid]);
return 1;
}
return 0;
}
E:\Users\Chris\Desktop\speed.pwn(36) : warning 213: tag mismatch Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Warning.
Speed[playerid] = XX+YY+ZZ;
format(SpeedMessage, sizeof(SpeedMessage), "Your current speed: %d", XX+YY+ZZ);
|
Originally Posted by Killaz/s0nic
Well first of all your adding them together..And ive never messed with the velocity functions so idk what to tell you..but are you trying to get the speed as in to make it return as what a speedometer would do?
|
stock GetPlayerSpeedSpeedo(playerid, bool:kmh) // by misco
{
new Float:Vx,Float:Vy,Float:Vz,Float:rtn;
if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz); else GetPlayerVelocity(playerid,Vx,Vy,Vz);
rtn = floatsqroot(floatabs(floatpower(Vx + Vy + Vz,2)));
return kmh?floatround(rtn * 100 * 1.61):floatround(rtn * 100);
}
|
Originally Posted by lolumadd [cod5server.tk
]
pawn Код:
![]() |
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/speed", cmdtext, true, 10) == 0)
{
new Float:XX, Float:YY, Float:ZZ, Float:Speed[MAX_PLAYERS], SpeedMessage[128];
GetVehicleVelocity(GetPlayerVehicleID(playerid), XX, YY, ZZ);
Speed[playerid] = XX+YY+ZZ;
format(SpeedMessage, sizeof(SpeedMessage), "Your current speed: %f", Speed[playerid]);
return 1;
}
return 0;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/speed", cmdtext, true, 10) == 0)
{
new Float:XX, Float:YY, Float:ZZ, Float:Speed[MAX_PLAYERS], SpeedMessage[128];
GetVehicleVelocity(GetPlayerVehicleID(playerid), XX, YY, ZZ);
Speed[playerid] = XX+YY+ZZ;
format(SpeedMessage, sizeof(SpeedMessage), "Your current speed: %d", floatround(Speed[playerid]));
return 1;
}
return 0;
}
|
Originally Posted by Chris - X-Host
Quote:
|
format(string, sizeof(string), You're speed: %d", GetPlayerSpeedSpeedo(playerid, false));
format(string, sizeof(string), You're speed: %d", GetPlayerSpeedSpeedo(playerid, true));