SA-MP Forums Archive
Need a help - 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: Need a help (/showthread.php?tid=324994)



Need a help - [HRD]Mar1 - 11.03.2012

Hello,

Код:
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)) * 100.3;
    return floatround(ST[3]);
}
public OnPlayerUpdate(playerid)
{
    if(GetPlayerSpeed > 160) return Kick(playerid);
    return 1;
}
I get that:
Код:
G:\Disque Local [E]\samp\gamemodes\lvdm.pwn(1412) : error 076: syntax error in the expression, or invalid function call
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: Need a help - mrskull42 - 11.03.2012

Try this
Код:
stock GetPlayerSpeed(playerid)
{
  new Float:x,Float:y,Float:z;
  if(IsPlayerInAnyVehicle(playerid))
GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
else
GetPlayerVelocity(playerid,x,y,z);
return floatround((ServerVariables[SPEED_3D]?floatsqroot(x*x+y*y+z*z):floatsqroot(x*x+y*y))*100.0*1.6);
}



Re : Need a help - [HRD]Mar1 - 11.03.2012

Doesn't work

The Problem is here :

Код:
if(GetPlayerSpeed > /*How i can add the speed limit ?) return Kick*/(playerid);



Re: Need a help - CmZxC - 11.03.2012

pawn Код:
if(GetPlayerSpeed(playerid) > 160) return Kick(playerid);
you forgot the playerid


Re : Need a help - [HRD]Mar1 - 11.03.2012

Ohh! Thanks =D