SA-MP Forums Archive
GetPlayerSpeed 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: GetPlayerSpeed help. (/showthread.php?tid=269044)



GetPlayerSpeed help. - Odyssey - 14.07.2011

Hmmm, I'm trying to make it so players cant score farm, using GetPlayerSpeed, this is only basic becuse it will be replaced with a /work system, but can you guys help me?

I am using this stock.

pawn Код:
stock GetPlayerSpeed(playerid,bool:kmh) // by misco
{
  new Float:Vx,Float:Vy,Float:Vz,Float:rtn;
  if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz); else GetPlayerVelocity(playerid,Vx,Vy,Vz);
  rtn = floatsqroot(floatabs(floatpower(Vx + Vy + Vz,2)));
  return kmh?floatround(rtn * 100 * 1.61):floatround(rtn * 100);
}
So, I tried a couple of things in the score system.

pawn Код:
forward ScoreSystem( );
public ScoreSystem( )
{
    foreach(Player,i)
    {
        if(IsPlayerInPlane(i) && GetPlayerSpeed(i, > 50))
        {
            GivePlayerMoney(i,2000);
            SetPlayerScore(i,GetPlayerScore(i) + 1);
            SendClientMessage(i, COLOR_RED, "One flying minute. 1 Score + 2k cash.");
        }
    }
And this

pawn Код:
forward ScoreSystem( );
public ScoreSystem( )
{
    foreach(Player,i)
    {
        if(IsPlayerInPlane(i) && GetPlayerSpeed(i, = > 50))
        {
            GivePlayerMoney(i,2000);
            SetPlayerScore(i,GetPlayerScore(i) + 1);
            SendClientMessage(i, COLOR_RED, "One flying minute. 1 Score + 2k cash.");
        }
    }
}
But I keep getting theese errors

Код:
C:\Documents and Settings\Ed\My Documents\SA-MP Virtual Pilots\Server\filterscripts\AircraftSystems.pwn(244) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Ed\My Documents\SA-MP Virtual Pilots\Server\filterscripts\AircraftSystems.pwn(244) : warning 215: expression has no effect
C:\Documents and Settings\Ed\My Documents\SA-MP Virtual Pilots\Server\filterscripts\AircraftSystems.pwn(244) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\Ed\My Documents\SA-MP Virtual Pilots\Server\filterscripts\AircraftSystems.pwn(244) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Ed\My Documents\SA-MP Virtual Pilots\Server\filterscripts\AircraftSystems.pwn(244) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Код:
C:\Documents and Settings\Ed\My Documents\SA-MP Virtual Pilots\Server\filterscripts\AircraftSystems.pwn(244) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Any ideas?


Re: GetPlayerSpeed help. - Adil - 14.07.2011

Line of error?


Re: GetPlayerSpeed help. - Odyssey - 14.07.2011

pawn Код:
if(IsPlayerInPlane(i) && GetPlayerSpeed(i, = > 50))
&

pawn Код:
if(IsPlayerInPlane(i) && GetPlayerSpeed(i, > 50))
Prety obvious lol.


Re: GetPlayerSpeed help. - Adil - 14.07.2011

pawn Код:
if(IsPlayerInPlane(i) && GetPlayerSpeed(i, true) > 50)



Re: GetPlayerSpeed help. - Odyssey - 14.07.2011

Код:
C:\Documents and Settings\Ed\My Documents\SA-MP Virtual Pilots\Server\filterscripts\AircraftSystems.pwn(244) : warning 213: tag mismatch



Re: GetPlayerSpeed help. - Vince - 14.07.2011

if(IsPlayerInPlane(i) && GetPlayerSpeed(i) > 50)


Re: GetPlayerSpeed help. - Adil - 14.07.2011

Last post edited, sorry misread it earlier.


Re: GetPlayerSpeed help. - System64 - 14.07.2011

pawn Код:
forward ScoreSystem( );
public ScoreSystem( )
{
    foreach(Player,i)
        if(IsPlayerInPlane(i) && GetPlayerSpeed(i, > 50))
        {
            GivePlayerMoney(i,2000);
            SetPlayerScore(i,GetPlayerScore(i) + 1);
            SendClientMessage(i, COLOR_RED, "One flying minute. 1 Score + 2k cash.");
        }
        return 1;
}



Re: GetPlayerSpeed help. - Odyssey - 14.07.2011

With Vinces line:

Код:
C:\Documents and Settings\Ed\My Documents\SA-MP Virtual Pilots\Server\filterscripts\AircraftSystems.pwn(245) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
System64 just made a repost of my old script.


Re : GetPlayerSpeed help. - timaoux - 16.08.2011

>= not = >
if(IsPlayerInPlane(i) && GetPlayerSpeed(i, = > 50))

like that

if(IsPlayerInPlane(i) && GetPlayerSpeed(i, >= 50))