SA-MP Forums Archive
/getspeed cmd - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /getspeed cmd (/showthread.php?tid=302897)



/getspeed cmd - [LHT]Bally - 10.12.2011

anyone have a way to check a players speed ?

like use /getspeed [playerid and it shows as gametext the speed of the player ?


Re: /getspeed cmd - dr.pepper - 10.12.2011

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;
}



Re: /getspeed cmd - [LHT]Bally - 10.12.2011

yes something along them lines


Re: /getspeed cmd - [LHT]Bally - 10.12.2011

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.



Re: /getspeed cmd - dr.pepper - 11.12.2011

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


Re: /getspeed cmd - [LHT]Bally - 11.12.2011

line 88 error

stock GetPlayerSpeed(playerid){


Re: /getspeed cmd - dr.pepper - 11.12.2011

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


Re: /getspeed cmd - [LHT]Bally - 11.12.2011

there is in the code u made me if u look above


Re : /getspeed cmd - mehdi-jumper - 11.12.2011

You. Forgot in PlayerCommandText

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

And with strcmp??


Re: /getspeed cmd - THE_KNOWN - 11.12.2011

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;
}