Need a script - /speed
#1

Hello guys, does anyone know how to make command /speed (nickname) 0km/h (this command would say the speed of the player) (ZCDM)

Thank you
Reply
#2

PHP код:
// You should include sscanf2 and (i)ZCMD.
CMD:speed(playeridparams[])
{
    new 
target;
    if(
sscanf(params"u"target)) return SendClientMessage(playerid0xFF0000FF"[USAGE] speed [playerid/playername]");
    else
    {
        new 
vehicleid;
        if ((
vehicleid GetPlayerVehicleID(target)))
        {
            new
                
Float:vx,
                
Float:vy,
                
Float:vz,
                
_speed
            
;
            
GetVehicleVelocity(vehicleidvxvyvz);
            
speed floatroundfloatsqroot(vx vx vy vy vz vz) * 187.666667 );
            new 
tmp[128], tmp_name[MAX_PLAYER_NAME];
            
GetPlayerName(targettmp_namesizeof tmp_name);
            
format(tmpsizeof tmp"%s's speed: %i"tmp_namespeed);
            
SendClientMessage(playerid, -, "[USAGE] speed [playerid/playername]");
        }
        else return 
SendClientMessage(playerid0xFF0000FF"[ERROR] player is not in vehicle.");
    }
    return 
true;

Reply
#3

Thank you so much, I see you quite good at it, would u script for money? Please PM me x
Reply
#4

speed = floatround( floatsqroot(vx * vx + vy * vy + vz * vz) * 187.666667 ); That is the incorrect "magic number" the value should be from 180.0 to 181.5 for accurate speed readings.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)