12.06.2011, 22:51
Heres the new code. After awhile it said I was going 4 MPH. Idk what is wrong. I also get an error if i uncomment the TextDrawHide line.
Код:
C:\Users\zack\Desktop\SAMP03CSVR_WIN32 (1)\gamemodes\MYSQLgm.pwn(552) : error 028: invalid subscript (not an array or too many subscripts): "Speedo" C:\Users\zack\Desktop\SAMP03CSVR_WIN32 (1)\gamemodes\MYSQLgm.pwn(552) : warning 215: expression has no effect C:\Users\zack\Desktop\SAMP03CSVR_WIN32 (1)\gamemodes\MYSQLgm.pwn(552) : error 001: expected token: ";", but found "]" C:\Users\zack\Desktop\SAMP03CSVR_WIN32 (1)\gamemodes\MYSQLgm.pwn(552) : error 029: invalid expression, assumed zero C:\Users\zack\Desktop\SAMP03CSVR_WIN32 (1)\gamemodes\MYSQLgm.pwn(552) : fatal error 107: too many error messages on one line
pawn Код:
forward Speedometer(playerid);
public Speedometer(playerid)
{
new Float:VehVelocity[3];
new State = GetPlayerState(playerid);
if(State == PLAYER_STATE_DRIVER && IsPlayerInAnyVehicle(playerid))
{
#define MULTIPLY_SPEED 4
new vID = GetPlayerVehicleID(playerid);
GetVehicleVelocity(vID, VehVelocity[0], VehVelocity[1], VehVelocity[2]);
new Float:speed = floatsqroot(VehVelocity[0] * VehVelocity[0] + VehVelocity[1] * VehVelocity[1] + VehVelocity[2] * VehVelocity[2]);
new Sspeed[15], string[200];
if( speed == 0) {
format(Sspeed,sizeof(Sspeed),"~G~%dm/h",(floatround(speed)*MULTIPLY_SPEED));
} else if( speed >= 1 && speed <= 65 ){
format(Sspeed,sizeof(Sspeed),"~G~%dm/h",(floatround(speed)*MULTIPLY_SPEED));
} else if( speed >= 66 && speed <= 120 ){
format(Sspeed,sizeof(Sspeed),"~Y~%dm/h",(floatround(speed)*MULTIPLY_SPEED));
} else {
format(Sspeed,sizeof(Sspeed),"~R~%dm/h",(floatround(speed)*MULTIPLY_SPEED));
}
format(string,sizeof(string),"Speed: %s", Sspeed);
TextDrawSetString(Speedo, string);
TextDrawShowForPlayer(playerid, Speedo);
}
else
{
//TextDrawHideForPlayer(playerid, Speedo[playerid]);
}
return true;
}