SA-MP Forums Archive
Anti_Speed - problem - 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: Anti_Speed - problem (/showthread.php?tid=353354)



Anti_Speed - problem - Dan_Barocu - 23.06.2012

i made a anti speed but doesnet give me kick and message please help!compiles fine no errors/warning but i dont gget kicked and message..

PHP код:
public Antisp(playerid)
                    {
                    if(
GetPlayerSpeed(playerid) > 100.0) return Kick(playerid);
                    
SendClientMessage(playeridCOLOR_LIGHTRED"Slow!!");
                    return 
1;
                    } 



Re: Anti_Speed - problem - Bu11Sh0t - 23.06.2012

pawn Код:
public Antisp(playerid)
{
    if(GetPlayerSpeed(playerid) > 100.0)
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "Slow!!");
        return Kick(playerid);
    }
}
Try this ї?


Re: Anti_Speed - problem - Dan_Barocu - 23.06.2012

Quote:
Originally Posted by Bu11Sh0t
Посмотреть сообщение
pawn Код:
public Antisp(playerid)
{
    if(GetPlayerSpeed(playerid) > 100.0)
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "Slow!!");
        return Kick(playerid);
    }
(LINE 7701)>> }
Try this ї?
PHP код:
(7701) : warning 209: function "Antisp" should return a value 



Re: Anti_Speed - problem - [NWA]Hannes - 23.06.2012

Quote:
Originally Posted by Dan_Barocu
Посмотреть сообщение
PHP код:
(7701) : warning 209: function "Antisp" should return a value 
pawn Код:
public Antisp(playerid)
{
    if(GetPlayerSpeed(playerid) > 100.0)
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "Slow!!");
        Kick(playerid);
    }
    return 1;
}



Re: Anti_Speed - problem - Dan_Barocu - 23.06.2012

is this good??

PHP код:
stock GetPlayerSpeed(playerid)
                    {
                        new 
Float:ST[4];
                        if(
IsPlayerInAnyVehicle(playerid))
                        
GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
                        else 
GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
                        
ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 179.28625;
                        return 
floatround(ST[3]);
                    } 



Re: Anti_Speed - problem - [NWA]Hannes - 23.06.2012

I have no idea if an anti-speed even would work through VELOCITY functions
pawn Код:
stock GetPlayerSpeed(playerid)
{
    new Float:ST[4];
    if(IsPlayerInAnyVehicle(playerid))
    {
        GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
    }
    else
    {
        GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
    }
    ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 179.28625;
    return floatround(ST[3]);
}



Re: Anti_Speed - problem - Dan_Barocu - 23.06.2012

why doesent it work??


Re: Anti_Speed - problem - leonardo1434 - 23.06.2012

Don't forget to use a settimer.

pawn Код:
// With this function will not be necessary make a foward /public each time.
#define Name:%1(%2) forward %1(%2); public %1(%2)


Name:Antisp(playerid)
{
   if(GetPlayerSpeed(playerid) > 100)  // if it is above.
   {
     SendClientMessage(playerid, -1, "Slow!!");  // will be displayed this message
     Kick(playerid); // Then will kick the player.
   }
   return 1;
}

stock GetPlayerSpeed(playerid)
{
    new Float:ST[4];
    if(IsPlayerInAnyVehicle(playerid))
    GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
    else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
    ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 155.0;
    return floatround(ST[3]);
}



Re: Anti_Speed - problem - SuperViper - 23.06.2012

Vehicles can go above 100 KM/H. An Infernus goes up to exactly 197 but a Hydra can go much higher. I recommend changing the check to 197 and ignoring the check if it's a Hydra.


Re: Anti_Speed - problem - JaKe Elite - 23.06.2012

Not only hydra, also other vehicles like Helicopter and Planes.