/getspeed cmd
#2

Something like this?
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;
}
Reply


Messages In This Thread
/getspeed cmd - by [LHT]Bally - 10.12.2011, 23:13
Re: /getspeed cmd - by dr.pepper - 10.12.2011, 23:19
Re: /getspeed cmd - by [LHT]Bally - 10.12.2011, 23:22
Re: /getspeed cmd - by [LHT]Bally - 10.12.2011, 23:24
Re: /getspeed cmd - by dr.pepper - 11.12.2011, 00:07
Re: /getspeed cmd - by [LHT]Bally - 11.12.2011, 00:19
Re: /getspeed cmd - by dr.pepper - 11.12.2011, 00:25
Re: /getspeed cmd - by [LHT]Bally - 11.12.2011, 00:26
Re : /getspeed cmd - by mehdi-jumper - 11.12.2011, 11:40
Re: /getspeed cmd - by THE_KNOWN - 11.12.2011, 12:17

Forum Jump:


Users browsing this thread: 1 Guest(s)