Problem with Speedometer
#3

pawn Code:
#include <a_samp>

new SpeedUse[MAX_PLAYERS];
new SpeedTimer[MAX_PLAYERS] = -1;
forward ShowCarSpeed(const playerid);

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

#else

main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}

#endif

public OnPlayerConnect(playerid)
{
SpeedTimer[playerid] = SetTimerEx("ShowCarSpeed", 500, true, "d", playerid);
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
if(SpeedUse[playerid] == 1)
{
TextDrawShowForPlayer(playerid, Text:Speed[playerid]);
}
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/speedometer", cmdtext, true, 10) == 0)
{
if(SpeedUse[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREEN, "*Speedometer is disabled!");
SpeedUse[playerid] == 0;
return 1;
}
if(SpeedUse[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREEN, "*Speedometer is enabled!");
SpeedUse[playerid] == 1;
return 1;
}
}
return 0;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_ONFOOT)
{
if(SpeedUse[playerid] == 1)
{
TextDrawHideForPlayer(playerid, Text:Speed[playerid]);
}
}
return 1;
}

public ShowCarSpeed(const playerid)
{
new Float:fPos[3], Float:fSpeed;
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
GetVehicleVelocity(vehicleid, fPos[0], fPos[1], fPos[2]);
fSpeed = floatsqroot(floatpower(fPos[0], 2) + floatpower(fPos[1], 2) + floatpower(fPos[2], 2)) * 200;

if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(SpeedUse[playerid] == 1)
{
format(stringe, MAX_STRING,"~r~%d ~g~km/h", floatround(fSpeed));
TextDrawSetString(Speed[playerid], stringe);
}
}
else
{
TextDrawHideForPlayer(playerid, Text:Speed[playerid]);
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
if(GetPlayerWeapon(playerid) != 0)
{
if(VehicleDriver(GetPlayerVehicleID(playerid)) == INVALID_PLAYER_ID)
{
SetPlayerArmedWeapon(playerid, 0);
}
}
}
}
}
else
{
TextDrawHideForPlayer(playerid, Text:Speed[playerid]);
GetPlayerVelocity(playerid, fPos[0], fPos[1], fPos[2]);
fSpeed = floatsqroot(floatpower(fPos[0], 2) + floatpower(fPos[1], 2) + floatpower(fPos[2], 2)) * 200;
}
return 1;
}

And errors are:

pawn Code:
C:\DOCUME~1\Home\Desktop\Guntis\JAUNAI~2\SAMP03~1\ pawno\FORSCR~1\Speedo\speedo.pwn(43) : error 017: undefined symbol "Speed"
C:\DOCUME~1\Home\Desktop\Guntis\JAUNAI~2\SAMP03~1\ pawno\FORSCR~1\Speedo\speedo.pwn(43) : warning 215: expression has no effect
C:\DOCUME~1\Home\Desktop\Guntis\JAUNAI~2\SAMP03~1\ pawno\FORSCR~1\Speedo\speedo.pwn(43) : error 001: expected token: ";", but found "]"
C:\DOCUME~1\Home\Desktop\Guntis\JAUNAI~2\SAMP03~1\ pawno\FORSCR~1\Speedo\speedo.pwn(43) : error 029: invalid expression, assumed zero
C:\DOCUME~1\Home\Desktop\Guntis\JAUNAI~2\SAMP03~1\ pawno\FORSCR~1\Speedo\speedo.pwn(43) : fatal error 107: too many error messages on one line
Reply


Messages In This Thread
Problem with Speedometer - by GrInDzO - 08.01.2012, 20:53
Re: Problem with Speedometer - by Snowman12 - 08.01.2012, 22:18
Re: Problem with Speedometer - by GrInDzO - 10.01.2012, 16:15
Re: Problem with Speedometer - by GrInDzO - 02.02.2012, 19:40
Re: Problem with Speedometer - by Saw® - 02.02.2012, 19:41
Re: Problem with Speedometer - by GrInDzO - 03.02.2012, 12:17
Re: Problem with Speedometer - by [XST]O_x - 03.02.2012, 12:19
Re: Problem with Speedometer - by GrInDzO - 03.02.2012, 12:25
Re: Problem with Speedometer - by [XST]O_x - 03.02.2012, 12:27
Re: Problem with Speedometer - by GrInDzO - 03.02.2012, 12:28
Re: Problem with Speedometer - by GrInDzO - 08.02.2012, 20:40
Re: Problem with Speedometer - by Twinki1993 - 09.02.2012, 02:50

Forum Jump:


Users browsing this thread: 7 Guest(s)