/getspeed cmd
#1

anyone have a way to check a players speed ?

like use /getspeed [playerid and it shows as gametext the speed of the player ?
Reply
#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
#3

yes something along them lines
Reply
#4

i got these errors off that
pawn Код:
C:\Documents and Settings\BaLLy\Desktop\The Original\filterscripts\ANTIHAX.pwn(88) : error 021: symbol already defined: "GetPlayerSpeed"
C:\Documents and Settings\BaLLy\Desktop\The Original\filterscripts\ANTIHAX.pwn(105) : warning 203: symbol is never used: "getspeed"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Reply
#5

I think those are your own errors? Show me those lines.
Reply
#6

line 88 error

stock GetPlayerSpeed(playerid){
Reply
#7

Are you sure you don't have that stock anywhere else in your code?
Reply
#8

there is in the code u made me if u look above
Reply
#9

You. Forgot in PlayerCommandText

(cmdtext,9,.....); i think.

And with strcmp??
Reply
#10

pawn Код:
CMD:getspeed(playerid,params[])
{
    new i,Float:p[3];
    if(sscanf(params,"u",i)) return SendClientMessage(playerid,-1,"/getspeed [playerid]");
    new Float:p[3],mph;
    GetVehicleVelocity(GetPlayerVehicleID(i), p[0], p[1], p[2]);
    mph = floatround((floatsqroot(((p[0]*p[0])+(p[1]*p[1]))))*100,floatround_round);
    new stringg[32];
    format(stringg,32,"%d mph",mph);
    GameTextForPlayer(playerid,stringg,6000,1);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)