12.06.2011, 23:40
Yeh what RealCop said ^
Although that is a more efficient way to do it (and is something you should do!), it won't actually fix the current problems you are having. You haven't shown us the creation of the Speedo variable, which is quite important regarding the problem you are having with this line:
You have referenced Speedo as an array here (which I believe should be correct), but in all other cases you do not refer to Speedo as an array. Your initial creation of the Speedo variable should be at the top of your script and look something like this:
Once that is done, you can uncomment the line that I previously quoted, and then you will need to go back and change all other references to Speedo. So for example:
will become:
Once you have changed all references to Speedo, your speedo should display to the correct player when in a vehicle driver, and hide itself otherwise.
The next problem you mention is that it only shows 0mph or 4mph. That sounds like a problem with the maths to me, and is unfortunately something I can't assist with! I'd suggest looking around other available speedo scripts to see exactly how the maths works there.
Good luck!
Although that is a more efficient way to do it (and is something you should do!), it won't actually fix the current problems you are having. You haven't shown us the creation of the Speedo variable, which is quite important regarding the problem you are having with this line:
pawn Код:
//TextDrawHideForPlayer(playerid, Speedo[playerid]);
pawn Код:
new Text:Speedo[MAX_PLAYERS];
pawn Код:
TextDrawSetString(Speedo, string);
TextDrawShowForPlayer(playerid, Speedo);
pawn Код:
TextDrawSetString(Speedo[playerid], string);
TextDrawShowForPlayer(playerid, Speedo[playerid]);
The next problem you mention is that it only shows 0mph or 4mph. That sounds like a problem with the maths to me, and is unfortunately something I can't assist with! I'd suggest looking around other available speedo scripts to see exactly how the maths works there.
Good luck!