Speedo Problem
#1

I'm not sure if I'm doing this right, a pointer or two would be nice. Here's the part that's erroring.
Код:
(1240) : error 035: argument type mismatch (argument 2)
(1237) : warning 204: symbol is assigned a value that is never used: "pSpeed"

forward UpdateSpeedo();
public UpdateSpeedo()
{
	for(new i; i < MAX_PLAYERS; i ++)
	{
		new PlayerState = GetPlayerState(i);
		new pSpeed = GetPlayerSpeed(i); // LINE 1237
		if(PlayerState == PLAYER_STATE_DRIVER)
		{
			TextDrawSetString(PlayerSpeedo[i], pSpeed); // LINE 1240
		}
	}
	return 1;
}
I have it setup on a timer to update, it shows when OnPlayerStateChange is called. Any additional tips would be nice.

(If you post to ask me to use your filterscript, NO!)
Reply
#2

Quote:
Originally Posted by ScottCFR
Посмотреть сообщение
I'm not sure if I'm doing this right, a pointer or two would be nice. Here's the part that's erroring.
Код:
CODE
I have it setup on a timer to update, it shows when OnPlayerStateChange is called. Any additional tips would be nice.

(If you post to ask me to use your filterscript, NO!)
Everything alright but this isnt like VB or any other language in which the variable type gets auto converted

And its enough to have it in a timer and at the moment of the first appearance (OnPlayerStateChange)

Additionally I would create the variable before the loop, would be a waste to create / destroy it 500 (MAX_PLAYER) times

So some minor changes and done
pawn Код:
forward UpdateSpeedo();
public UpdateSpeedo()
{
    for(new i, string[16]; i != MAX_PLAYERS; ++i)
    {
        if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
            valstr(string, GetPlayerSpeed(i), false);
            TextDrawSetString(PlayerSpeedo[i], string);
        }
    }
}
Valstr converts an integer into a string
Reply
#3

I fixed the error, realized I wasn't formating the string before adding it to the textdraw. However the speed isn't showing right. When I'm in a car it says "0 km/h".
Reply
#4

Quote:
Originally Posted by ScottCFR
Посмотреть сообщение
I fixed the error, realized I wasn't formating the string before adding it to the textdraw. However the speed isn't showing right. When I'm in a car it says "0 km/h".
how does your code looks like, now ? maybe you put the wrong placeholder %f instead of %d
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)