error 017: undefined symbol "i"
#1

pawn Код:
C:\Users\Davey\Desktop\Divoro\gamemodes\fffff.pwn(222) : error 036: empty statement
C:\Users\Davey\Desktop\Divoro\gamemodes\fffff.pwn(228) : error 029: invalid expression, assumed zero
C:\Users\Davey\Desktop\Divoro\gamemodes\fffff.pwn(235) : error 017: undefined symbol "i"
C:\Users\Davey\Desktop\Divoro\gamemodes\fffff.pwn(237) : error 017: undefined symbol "i"
pawn Код:
public UpdateSpeed (vehid)
{
    new id = GetVehicleInfrontID (vehid);
    if (id < 0);
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        PlayerTextDrawSetString (i,RadarHud, "Speed:-");
        PlayerTextDrawSetString (i,Textdraw2,"Car Model:-");
    }
    else
    {
        new str[32], Float: velocityX, Float: velocityY, Float: velocityZ;
        GetVehicleVelocity (id, velocityX, velocityY, velocityZ);
        new speed = floatround (floatsqroot (floatpower (velocityX, 2) + floatpower (velocityY, 2) + floatpower (velocityZ, 2)) * 136.666667, floatround_round);
        for (new i = 0; i < MAX_PLAYERS; i++)
        format (str, sizeof (str), "Speed: %d", speed);
        PlayerTextDrawSetString (i,RadarHud, str);
        format (str, sizeof (str), "Car Model: %s", VehicleModel [GetVehicleModel (id) - 400]);
        PlayerTextDrawSetString (i,Textdraw2, str);
    }

    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerInVehicle (i, vehid))
        {
            PlayerTextDrawShow (i, RadarHud);
            PlayerTextDrawShow (i, Textdraw1);
            PlayerTextDrawShow (i, Textdraw2);
        }
    }
    return 1;
}
I dont know what the problem is so can you please help me?
Reply
#2

"if(id <0;" ? You can't do "if" and than ";" because it's not a command.
Код:
public UpdateSpeed (vehid)
{
    new id = GetVehicleInfrontID (vehid);
    if (id < 0)
    {
	    for (new i = 0; i < MAX_PLAYERS; i++)
	    {
	        PlayerTextDrawSetString (i,RadarHud, "Speed:-");
	        PlayerTextDrawSetString (i,Textdraw2,"Car Model:-");
	    }
	}
    else
    {
        new str[32], Float: velocityX, Float: velocityY, Float: velocityZ;
        GetVehicleVelocity (id, velocityX, velocityY, velocityZ);
        new speed = floatround (floatsqroot (floatpower (velocityX, 2) + floatpower (velocityY, 2) + floatpower (velocityZ, 2)) * 136.666667, floatround_round);
        for (new i = 0; i < MAX_PLAYERS; i++)
        format (str, sizeof (str), "Speed: %d", speed);
        PlayerTextDrawSetString (i,RadarHud, str);
        format (str, sizeof (str), "Car Model: %s", VehicleModel [GetVehicleModel (id) - 400]);
        PlayerTextDrawSetString (i,Textdraw2, str);
    }
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerInVehicle (i, vehid))
        {
            PlayerTextDrawShow (i, RadarHud);
            PlayerTextDrawShow (i, Textdraw1);
            PlayerTextDrawShow (i, Textdraw2);
        }
    }
    return 1;
}
Reply
#3

I don't think you need to loop 2 times.... Plus i'd suggest you to break; loops after it's use is finished and Also, What lines gives the errors?
Reply
#4

Quote:
Originally Posted by Rudy_
Посмотреть сообщение
I don't think you need to loop 2 times.... Plus i'd suggest you to break; loops after it's use is finished and Also, What lines gives the errors?
pawn Код:
PlayerTextDrawSetString (i,RadarHud, str);
PlayerTextDrawSetString (i,Textdraw2, str);
Reply
#5

What do i need to do :O
Reply
#6

Have you seen what I wrote up there? Don't put ";" in the end of if statement
Reply
#7

Quote:
Originally Posted by dominik523
Посмотреть сообщение
Have you seen what I wrote up there? Don't put ";" in the end of if statement
Quote:
Originally Posted by lulo356
Посмотреть сообщение
pawn Код:
PlayerTextDrawSetString (i,RadarHud, str);
PlayerTextDrawSetString (i,Textdraw2, str);
Bro this gives the errros what do i need to do to fix that if you see in the update speed is I defined
Reply
#8

You may edit it a bit as i don't know which loop is used for which textdraw
pawn Код:
public UpdateSpeed (vehid)
{
    new id = GetVehicleInfrontID (vehid);
    if (id < 0)
    {
        for (new i = 0; i < MAX_PLAYERS; i++)
        {
            PlayerTextDrawSetString (i,RadarHud, "Speed:-");
            PlayerTextDrawSetString (i,Textdraw2,"Car Model:-");
        }
    }
    else
    {
        new str[32], Float: velocityX, Float: velocityY, Float: velocityZ;
        GetVehicleVelocity (id, velocityX, velocityY, velocityZ);
        new speed = floatround (floatsqroot (floatpower (velocityX, 2) + floatpower (velocityY, 2) + floatpower (velocityZ, 2)) * 136.666667, floatround_round);
        for (new r = 0; r < MAX_PLAYERS; r++)
        {
            format (str, sizeof (str), "Speed: %d", speed);
            PlayerTextDrawSetString (r,RadarHud, str);
            format (str, sizeof (str), "Car Model: %s", VehicleModel [GetVehicleModel (id) - 400]);
            PlayerTextDrawSetString (r,Textdraw2, str);
        }
    }
    for (new t = 0; t < MAX_PLAYERS; t++)
    {
        if (IsPlayerInVehicle (i, vehid))
        {
            PlayerTextDrawShow (r, RadarHud);
            PlayerTextDrawShow (t, Textdraw1);
            PlayerTextDrawShow (r, Textdraw2);
        }
    }
    return 1;
}
Reply
#9

Give me still Undefined errors

pawn Код:
C:\Users\Davey\Desktop\fffff.pwn(245) : error 017: undefined symbol "i"
C:\Users\Davey\Desktop\fffff.pwn(247) : error 017: undefined symbol "r"
C:\Users\Davey\Desktop\fffff.pwn(249) : error 017: undefined symbol "r"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.
Reply
#10

pawn Код:
public UpdateSpeed (vehid)
{
    new id = GetVehicleInfrontID (vehid);
    if (id < 0)
    {
        for (new i = 0; i < MAX_PLAYERS; i++)
        {
            PlayerTextDrawSetString (i,RadarHud, "Speed:-");
            PlayerTextDrawSetString (i,Textdraw2,"Car Model:-");
        }
    }
    else
    {
        new str[32], Float: velocityX, Float: velocityY, Float: velocityZ;
        GetVehicleVelocity (id, velocityX, velocityY, velocityZ);
        new speed = floatround (floatsqroot (floatpower (velocityX, 2) + floatpower (velocityY, 2) + floatpower (velocityZ, 2)) * 136.666667, floatround_round);
        for (new r = 0; r < MAX_PLAYERS; r++)
        {
            format (str, sizeof (str), "Speed: %d", speed);
            PlayerTextDrawSetString (r,RadarHud, str);
            format (str, sizeof (str), "Car Model: %s", VehicleModel [GetVehicleModel (id) - 400]);
            PlayerTextDrawSetString (r,Textdraw2, str);
        }
    }
    for (new t = 0; t < MAX_PLAYERS; t++)
    {
        if (IsPlayerInVehicle (t, vehid))
        {
            PlayerTextDrawShow (t, RadarHud);
            PlayerTextDrawShow (t, Textdraw1);
            PlayerTextDrawShow (t, Textdraw2);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)