undefined symbol "playerid".
#1

PHP код:
public OnPlayerConnect(playerid)
{
    
SetTimer("test",360000,true);
    return 
1;
}
public 
test()
{
    if(
IsPlayerInRangeOfPoint(playerid,30.0,-2802.2390,-474.2502,7.1875))
    {
        new 
vid GetPlayerVehicleID(playerid);
        {
            
//codes
        
}
    }

Errors:
PHP код:
C:\Users\TaLhA XIV\Desktop\Pawno scripter\filterscripts\speedcams.pwn(90) : error 017undefined symbol "playerid"
C:\Users\TaLhA XIV\Desktop\Pawno scripter\filterscripts\speedcams.pwn(92) : error 017undefined symbol "playerid" 
The error lines are the lines with the range and the vid((which defines vid.))
Reply
#2

use this:
Код:
	public OnPlayerConnect(playerid)
	{
	    SetTimerEx("test", 360000, true, "i", playerid);
	    return 1;
	}
	public test(playerid)
	{
	    if(IsPlayerInRangeOfPoint(playerid,30.0,-2802.2390,-474.2502,7.1875))
	    {
	        new vid = GetPlayerVehicleID(playerid);
	        {
	            //codes
	        }
	    }
	}
Reply
#3

PHP код:
forward GetVehicleSpeed(vehicleidunit);
forward test(playerid);
/*=========================Callbacks=========================*/

public GetVehicleSpeed(vehicleidunit)
{
        new
                
Float:x_speedFloat:y_speedFloat:z_speedFloat:speedfspeed;


        
GetVehicleVelocity(vehicleid,x_speed,y_speed,z_speed);
        if(
unit == kmh)
        {
                
speedf floatsqroot(((x_speed*x_speed)+(y_speed*y_speed))+(z_speed*z_speed)) * 187.666667;
        }
        else if(
unit == mph)
        {
                
speedf floatsqroot(((x_speed*x_speed)+(y_speed*y_speed))+(z_speed*z_speed)) * 116.541;
        }
        
speed floatround(speedf,floatround_round);
        return 
speed;
}

public 
OnPlayerConnect(playerid)
{
    
SetTimerEx("test"360000true"i"playerid);
    return 
1;
}
public 
test(playerid)
{
    if(
IsPlayerInRangeOfPoint(playerid,30.0,-2802.2390,-474.2502,7.1875))
    {
        new 
GetPlayerVehicleID(playerid);
        
GetVehicleSpeed(v,kmh);
        if(
GetVehicleSpeed(GetPlayerVehicleID(playerid),>50))
        {
            
SendClientMessage(playerid,-1,"Speed kam kar oye!");
            
GivePlayerMoney(playerid,-100);
        }
    }

Errors:
PHP код:
C:\Users\TaLhA XIV\Desktop\Pawno scripter\filterscripts\speedcams.pwn(72) : error 029invalid expressionassumed zero
C
:\Users\TaLhA XIV\Desktop\Pawno scripter\filterscripts\speedcams.pwn(72) : warning 215expression has no effect
C
:\Users\TaLhA XIV\Desktop\Pawno scripter\filterscripts\speedcams.pwn(72) : error 001expected token";"but found ")"
C:\Users\TaLhA XIV\Desktop\Pawno scripter\filterscripts\speedcams.pwn(72) : error 029invalid expressionassumed zero
C
:\Users\TaLhA XIV\Desktop\Pawno scripter\filterscripts\speedcams.pwn(72) : fatal error 107too many error messages on one line

Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase


4 Errors

HeLp!
Reply
#4

pawn Код:
forward GetVehicleSpeed(vehicleid, unit);
forward test(playerid);
/*=========================Callbacks=========================*/

public GetVehicleSpeed(vehicleid, unit)
{
        new
                Float:x_speed, Float:y_speed, Float:z_speed, Float:speedf, speed;


        GetVehicleVelocity(vehicleid,x_speed,y_speed,z_speed);
        if(unit == kmh)
        {
                speedf = floatsqroot(((x_speed*x_speed)+(y_speed*y_speed))+(z_speed*z_speed)) * 187.666667;
        }
        else if(unit == mph)
        {
                speedf = floatsqroot(((x_speed*x_speed)+(y_speed*y_speed))+(z_speed*z_speed)) * 116.541;
        }
        speed = floatround(speedf,floatround_round);
        return speed;
}

public OnPlayerConnect(playerid)
{
    SetTimerEx("test", 360000, true, "i", playerid);
    return 1;
}
public test(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid,30.0,-2802.2390,-474.2502,7.1875))
    {
        new v = GetPlayerVehicleID(playerid);
        GetVehicleSpeed(v,kmh);
        if(GetVehicleSpeed(GetPlayerVehicleID(playerid) > 50))
        {
            SendClientMessage(playerid,-1,"Speed kam kar oye!");
            GivePlayerMoney(playerid,-100);
        }
    }
}

Try This.
Reply
#5

Thanks but tell me what did you exactly changed,thanks for the help.
Reply
#6

Removed the last comma in if.

Old Code:


pawn Код:
if(GetVehicleSpeed(GetPlayerVehicleID(playerid), > 50))
New Code:

pawn Код:
if(GetVehicleSpeed(GetPlayerVehicleID(playerid) > 50))
Reply
#7

EDIT: Too late
Reply
#8

PHP код:
forward GetVehicleSpeed(vehicleidunit);
forward test(playerid);
/*=========================Callbacks=========================*/

public GetVehicleSpeed(vehicleidunit)
{
        new
                
Float:x_speedFloat:y_speedFloat:z_speedFloat:speedfspeed;


        
GetVehicleVelocity(vehicleid,x_speed,y_speed,z_speed);
        if(
unit == kmh)
        {
                
speedf floatsqroot(((x_speed*x_speed)+(y_speed*y_speed))+(z_speed*z_speed)) * 187.666667;
        }
        else if(
unit == mph)
        {
                
speedf floatsqroot(((x_speed*x_speed)+(y_speed*y_speed))+(z_speed*z_speed)) * 116.541;
        }
        
speed floatround(speedf,floatround_round);
        return 
speed;
}

public 
OnPlayerConnect(playerid)
{
    
SetTimerEx("test"360000true"i"playerid);
    return 
1;
}
public 
test(playerid)
{
    if(
IsPlayerInRangeOfPoint(playerid,30.0,-2810.6204,-459.6523,6.8550))
    {
        new 
GetPlayerVehicleID(playerid);
        
GetVehicleSpeed(v,kmh);
        if(
GetVehicleSpeed(GetPlayerVehicleID(playerid) > 50))
        {
            
SendClientMessage(playerid,-1,"Speed kam kar oye!");
            
GivePlayerMoney(playerid,-100);
        }
    }

When I go IG and pass the coordinates,nothing happens?
Reply
#9

decrease the timer here

SetTimerEx("test", 360000, true, "i", playerid);

make it like

SetTimerEx("test", 10000, true, "i", playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)