Camera on PPC_TRUCKING
#1

Hey im creating /radargun command for cops in PPC_TRUCKING...but i get a warnign..please help..
PHP код:
stock GetPlayerSpeed(playerid,bool:kmh//
{
  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);
}
CMD:radargun(playerid,params[])
{
    new 
Float:playerposx,Float:playerposy,Float:playerposz,wantedlevel;
    if(
ClassPolice && GetPlayerWeapon(playerid) == 43)
    {
    
GetPlayerPos(playerid,playerposx,playerposy,playerposz);
     {
     if (
IsPlayerConnected(playerid))
      {
    if (
IsPlayerInRangeOfPoint(playerid,playerposx,playerposy,playerposz,60.0) && GetPlayerSpeed(playerid,120))
    {
    
SetPlayerWantedLevel(playerid,wantedlevel+1);
    }
    }
    }
    }
    return 
1;

WARNING:
PHP код:
C:\Documents and Settings\scry\Desktop\Truck srv\gamemodes\PPC_Trucking.pwn(1483) : warning 213tag mismatch
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
1 Warning

THE 1483 line is
PHP код:
if (IsPlayerInRangeOfPoint(playerid,playerposx,playerposy,playerposz,60.0) && GetPlayerSpeed(playerid,120)) 
Reply
#2

Um i think your code

pawn Код:
if (IsPlayerInRangeOfPoint(playerid,playerposx,playerposy,playerposz,60.0) && GetPlayerSpeed(playerid,120))
is wrong...

Maybe try this..

pawn Код:
if (IsPlayerInRangeOfPoint(playerid,playerposx,playerposy,playerposz,60.0 && GetPlayerSpeed(playerid,120))
Maybe it will solve the problem? not test yet...
Reply
#3

Quote:
Originally Posted by GAMER_PS2
Посмотреть сообщение
Um i think your code

pawn Код:
if (IsPlayerInRangeOfPoint(playerid,playerposx,playerposy,playerposz,60.0) && GetPlayerSpeed(playerid,120))
is wrong...

Maybe try this..

pawn Код:
if (IsPlayerInRangeOfPoint(playerid,playerposx,playerposy,playerposz,60.0 && GetPlayerSpeed(playerid,120))
Maybe it will solve the problem? not test yet...
^^Is wrong too.

Just move the Float:range to just after playerid. It's in the wrong place.

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
Reply
#4

EDIT: poster above :/
Reply
#5

The tag mismatch is actually in the GetPlayerSpeed function. You've put an integer (120) where the function expects a boolean value (bool:kmh). In this case it means: true = output kmh, false = output mph.
Reply
#6

guys i've made that....please tell me if you see any errors...It should work like..if player is a cop and have a weapon(camera) he can use /Radargun ...that freezes him and if any player is going more then 120kph over him he get a star...and this needs to work on more cops...like 10 cops using /radargun and they will get wanted at all points ..not only at one cop..PLEASE

TOP OF SCRIPT:
PHP код:
new Float:playerposx,Float:playerposy,Float:playerposz,wantedlevel
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;
}
stock GetPlayerSpeed(playerid)
{
        if(
playerid != INVALID_PLAYER_ID)
        {
                new 
Float:Pos[3],Float:PS;
                
GetPlayerVelocity(playeridPos[0], Pos[1], Pos[2]);
                
PS floatsqroot(Pos[0]*Pos[0] + Pos[1]*Pos[1] + Pos[2]*Pos[2])*200;
                return 
floatround(PS,floatround_round);
        }
        return 
INVALID_PLAYER_ID;
}
CMD:radargun(playerid,params[])
{
    if(
ClassPolice && GetPlayerWeapon(playerid) == 43)
    {
    
GetPlayerPos(playerid,playerposx,playerposy,playerposz);
    
TogglePlayerControllable(playerid,0);
    }
    return 
1;
}
public 
OnPlayerUpdate(playerid)
{
    for(new 
0MAX_PLAYERSi++)
    {
     if (
IsPlayerConnected(playerid))
      {
    if (
IsPlayerInRangeOfPoint(playerid,playerposx,playerposy,playerposz,60.0) && GetPlayerSpeed(playerid) <= 120)
    {
    
SetPlayerWantedLevel(playerid,wantedlevel+1);
    }
    }
    }
    return 
1;

Reply
#7

ANYONE?? PLEASE
Reply
#8

CMON GUYS ..UP ^^
Reply
#9

I assume GetPlayerSpeed should equal or be higher than 120? Your GetPlayerSpeed function has only one parameter (playerid) and it returns the speed so...

pawn Код:
if (IsPlayerInRangeOfPoint(playerid,playerposx,playerposy,playerposz,60.0 && GetPlayerSpeed(playerid) >= 120)
Reply
#10

It must be "playerpos" variables
Check are they Float: and check GetPlayerSpeed function maybe you need to add speed variable or something
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)