stock GetPlayerSpeed(playerid) // bottom of your script { new Float:X, Float:Y, Float:Z; if(IsPlayerInAnyVehicle(playerid)) { GetVehicleVelocity(GetPlayerVehicleID(playerid), X, Y, Z); return floatround(floatmul(floatmul(floatsqroot(floatpower(floatabs(X), 2) + floatpower(floatabs(Y), 2) + floatpower(floatabs(Z), 2)), 100), 1.621371192), floatround_round); } else { GetPlayerVelocity(playerid, X, Y, Z); return floatround(floatmul(floatmul(floatsqroot(floatpower(floatabs(X), 2) + floatpower(floatabs(Y), 2) + floatpower(floatabs(Z), 2)), 100), 1.621371192), floatround_round); } }
new Str[128]; format(Str, sizeof(Str), "You are driving %d km/hour!", GetPlayerSpeed(playerid)); SendClientMessage(playerid, Str); return 1;
Originally Posted by addinol
FAIL:
You are driving %d km/hour! He asked that police can see other players speed not his own. |
public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[128], idx; cmd = strtok(cmdtext, idx); new tmp[128]; if(strcmp(cmd, "/speed", true) == 0) { if(gteam == TEAM_LSPD) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid,0xFF0000AA, "USAGE: /speed [id]"); new Str[128], iName[MAX_PLAYER_NAME], id; id = strval(tmp); format(Str, sizeof(Str), "%s is driving %d km/hour.", iName, GetPlayerSpeed(id)); SendClientMessage(playerid, 0xFF0000AA, Str); } else { SendClientMessage(playerid,0xFF0000AA, "You are not a cop!"); } return 1; } return 0; }
Originally Posted by VonLeeuwen
Code:
stock GetPlayerSpeed(playerid) { new Float:X, Float:Y, Float:Z; if(IsPlayerInAnyVehicle(playerid)) { GetVehicleVelocity(GetPlayerVehicleID(playerid), X, Y, Z); return floatround(floatmul(floatmul(floatsqroot(floatpower(floatabs(X), 2) + floatpower(floatabs(Y), 2) + floatpower(floatabs(Z), 2)), 100), 1.621371192), floatround_round); } else { GetPlayerVelocity(playerid, X, Y, Z); return floatround(floatmul(floatmul(floatsqroot(floatpower(floatabs(X), 2) + floatpower(floatabs(Y), 2) + floatpower(floatabs(Z), 2)), 100), 1.621371192), floatround_round); } } |
Originally Posted by VonLeeuwen
The guy who made it says so, yes.
|
Originally Posted by addinol
FAIL:
You are driving %d km/hour! He asked that police can see other players speed not his own. |