[HELP] Stock !
#1

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 ?
Reply
#2

Код:
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");
Reply
#3

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;

Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)