SA-MP Forums Archive
[HELP] Stock ! - 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: [HELP] Stock ! (/showthread.php?tid=575618)



[HELP] Stock ! - M0HAMMAD - 28.05.2015

pawn Код:
stock GetVehicleSpeed(id) // Geting speed with km/h !
{
    new Float:p[3],string[128];
    GetVehicleVelocity(id,p[0],p[1],p[2]);
    format(string,sizeof(string),"%.0f",150.0*(p[0]*p[0]+p[1]*p[1]));
    return string;
}
Line and Error:
pawn Код:
LINE: if(GetVehicleSpeed(GetPlayerVehicleID(i)) > 221) KickAntiCheat(i,"Speed Hack");

ERROR: .pwn(20699) : error 033: array must be indexed (variable "GetVehicleSpeed")
what is problem ?


Re: [HELP] Stock ! - Rudimental - 28.05.2015

Код:
stock GetVehicleSpeed(vehicleid)
{
	new
		Float:speed_x,
		Float:speed_y,
		Float:speed_z,
		Float:FloatBrzine,
		FFinalnaBrzina;
	GetVehicleVelocity(vehicleid, speed_x, speed_y, speed_z);
	FloatBrzine = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*183.666667;
	FFinalnaBrzina = floatround(FloatBrzine, floatround_round);
	return FFinalnaBrzina;
}
Код:
if(GetVehicleSpeed(GetPlayerVehicleID(i)) > 221) return KickAntiCheat(i,"Speed Hack");



Re: [HELP] Stock ! - Azula - 28.05.2015

PHP код:
stock GetVehicleSpeed(vehicleid )
{
    if(
vehicleid != INVALID_VEHICLE_ID)
    {
        new 
Float:Pos[3],Float:VS ;
        
GetVehicleVelocity(vehicleidPos[0], Pos[1], Pos[2]);
            
VS floatsqroot(Pos[0]*Pos[0] + Pos[1]*Pos[1] + Pos[2]*Pos[2])*200;
        return 
floatround(VS,floatround_round);
    }
    return 
INVALID_VEHICLE_ID;




Re: [HELP] Stock ! - bgedition - 28.05.2015

this is my stock :
Код:
stock GetVehicleSpeed(vehicleid, speedtype) {
	new Float:sX, Float:sY, Float:sZ, Float:sF, sT[20], string[30];
	switch(speedtype) { //KMPH
		case 1: {
			GetVehicleVelocity(vehicleid, sX, sY, sZ);
			sF = floatsqroot(((sX * sX) + (sY * sY)) + (sZ *sZ)) * 250.6666677;
			format(sT, sizeof(sT), "kmph");
		}
		case 2: { //MPH
			GetVehicleVelocity(vehicleid, sX, sY, sZ);
			sF = floatsqroot(((sX * sX) + (sY * sY)) + (sZ *sZ)) * 199.4166672;
			format(sT, sizeof(sT), "mph");
		}
		case 3: { //KNOTS
			GetVehicleVelocity(vehicleid, sX, sY, sZ);
			sF = floatsqroot(((sX * sX) + (sY * sY)) + (sZ *sZ)) * 165.3985645;
			format(sT, sizeof(sT), "knots");
		}
	}
	format(string, sizeof(string), "%d %s", floatround(sF, floatround_round), sT);
	return string;
}