10.12.2011, 23:19
Something like this?
sscanf, zcmd:
sscanf, zcmd:
pawn Код:
stock GetPlayerSpeed(playerid) {
new vID = GetPlayerVehicleID(playerid);
new Float:Velocity[4];
if(IsPlayerInAnyVehicle(playerid))
GetVehicleVelocity(vID,Velocity[0],Velocity[1],Velocity[2]);
else GetPlayerVelocity(playerid,Velocity[0],Velocity[1],Velocity[2]);
Velocity[3] = floatsqroot(floatpower(floatabs(Velocity[0]), 2.0) + floatpower(floatabs(Velocity[1]), 2.0) + floatpower(floatabs(Velocity[2]), 2.0)) * 179.28625;
return floatround(Velocity[3]);
}
CMD:getspeed(playerid, params[]) {
new szString[256], id, PlayerName[MAX_PLAYER_NAME];
GetPlayerName(id, PlayerName, sizeof(PlayerName));
if (sscanf(params, "d", id)) return SendClientMessage(playerid, 0xFF444499, "USAGE: /getspeed <playerid>");
format(szString, sizeof(szString), "%s (ID:%d) is going at the speed of: %f", PlayerName, id, GetPlayerSpeed(id));
SendClientMessage(playerid, 0xFFFF00AA, szString);
return 1;
}

