Help Me in MPH
#1

Hello Guys
i Have Some Error idk Why
Quote:

D:\az\filterscripts\MPH.pwn(5) : error 001: expected token: ";", but found "new"
D:\az\filterscripts\MPH.pwn(34) : error 017: undefined symbol "sdisplay"
D:\az\filterscripts\MPH.pwn(34) : warning 215: expression has no effect
D:\az\filterscripts\MPH.pwn(34) : error 001: expected token: ";", but found "]"
D:\az\filterscripts\MPH.pwn(34) : error 029: invalid expression, assumed zero
D:\az\filterscripts\MPH.pwn(34) : fatal error 107: too many error messages on one line

line 5
PHP код:
new Float:svx[MAX_PLAYERS];//This is for getting the speed of the car 
line 34
PHP код:
TextDrawSetString(sdisplay[playerid], s3[playerid]); // The actual changing of the textdraw 
help me +reps
Reply
#2

Help Me Guys +Rep
Reply
#3

Show The lines befire these lines
Reply
#4

Quote:
Originally Posted by Neos07
Посмотреть сообщение
Show The lines befire these lines
PHP код:
#include <a_samp>
#include <ZCMD>
new Text:Speedometer[MAX_PLAYERS//This will create a textdraw for every player
new Float:svx[MAX_PLAYERS];//This is for getting the speed of the car
new Float:svy[MAX_PLAYERS];//This is for getting the speed of the car
new Float:svz[MAX_PLAYERS];//This is for getting the speed of the car
new Float:s1[MAX_PLAYERS];
new 
s2[MAX_PLAYERS];
new 
s3[MAX_PLAYERS];
new 
stimer[MAX_PLAYERS];
forward speedometer(playerid);
public 
OnPlayerSpawn(playerid)
{
    
Speedometer[playerid] = TextDrawCreate(335.000000434.000000"");
    
TextDrawBackgroundColor(Speedometer[playerid], 255);
    
TextDrawFont(Speedometer[playerid], 1);
    
TextDrawLetterSize(Speedometer[playerid], 0.2300001.100000);
    
TextDrawColor(Speedometer[playerid], -1);
    
TextDrawSetOutline(Speedometer[playerid], 1);
    
TextDrawSetProportional(Speedometer[playerid], 1);
    
    
TextDrawShowForPlayer(playeridSpeedometer[playerid]); //This gotta be in there otherwise speedometer wont show up.
    
return 1;
}
public 
speedometer(playerid)
{
    
GetVehicleVelocity(GetPlayerVehicleID(playerid), svx[playerid], svy[playerid], svz[playerid]); // This Saves Our Velocitys To Our Varibles
    
s1[playerid] = floatsqroot(((svx[playerid]*svx[playerid])+(svy[playerid]*svy[playerid]))+(svz[playerid]*svz[playerid]))*100// This Is Our Forumula ( I Don't Know How It Works but i found it on internet )
    
s2[playerid] = floatround(s1[playerid],floatround_round); // Round the output off to a whole number
    
format(s3[playerid],32,"%i"s2[playerid]); // The textdraw string
    
TextDrawSetString(sdisplay[playerid], s3[playerid]); // The actual changing of the textdraw
    
return 1;
}
public 
OnPlayerStateChange(playeridnewstateoldstate)
// This Is The Callback That Is Called When A Person Changes State
    
KillTimer(stimer[playerid]); // This Stops Our Timer For When You Get Out Of Your Vehicle Your Speed Doesn't Keep Going
    
TextDrawSetString(Speedometer[playerid], " "); // This Sets Our Textdraw To Blank And Freezes Because We Stop The Timer ^
    
if(newstate == 2stimer[playerid] = SetTimerEx("speedometer"255true"i"playerid); // This Starts The Timer When The Player Changes His/Her State To Being The Driver
    
else if(newstate == 3stimer[playerid] = SetTimerEx("speedometer"250true"i"playerid); // This Start The Timer When The Player Changes His/Her Start To Being The Passenger
    
return 1;

all code my MPH
Reply
#5

Quote:

#include <a_samp>
#include <ZCMD>

new Text:Speedometer[MAX_PLAYERS]; //This will create a textdraw for every player
new Floatvx[MAX_PLAYERS];//This is for getting the speed of the car
new Floatvy[MAX_PLAYERS];//This is for getting the speed of the car
new Floatvz[MAX_PLAYERS];//This is for getting the speed of the car
new Float1[MAX_PLAYERS];
new s2[MAX_PLAYERS];
new s3[MAX_PLAYERS];
new stimer[MAX_PLAYERS];
new Textdisplay[MAX_PLAYERS];

forward speedometer(playerid);

public OnPlayerSpawn(playerid)
{
Speedometer[playerid] = TextDrawCreate(335.000000, 434.000000, "");
TextDrawBackgroundColor(Speedometer[playerid], 255);
TextDrawFont(Speedometer[playerid], 1);
TextDrawLetterSize(Speedometer[playerid], 0.230000, 1.100000);
TextDrawColor(Speedometer[playerid], -1);
TextDrawSetOutline(Speedometer[playerid], 1);
TextDrawSetProportional(Speedometer[playerid], 1);

TextDrawShowForPlayer(playerid, Speedometer[playerid]); //This gotta be in there otherwise speedometer wont show up.
return 1;
}
public speedometer(playerid)
{
GetVehicleVelocity(GetPlayerVehicleID(playerid), svx[playerid], svy[playerid], svz[playerid]); // This Saves Our Velocitys To Our Varibles
s1[playerid] = floatsqroot(((svx[playerid]*svx[playerid])+(svy[playerid]*svy[playerid]))+(svz[playerid]*svz[playerid]))*100; // This Is Our Forumula ( I Don't Know How It Works but i found it on internet )
s2[playerid] = floatround(s1[playerid],floatround_round); // Round the output off to a whole number
format(s3[playerid],32,"%i", s2[playerid]); // The textdraw string
TextDrawSetString(sdisplay[playerid], s3[playerid]); // The actual changing of the textdraw
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{ // This Is The Callback That Is Called When A Person Changes State
KillTimer(stimer[playerid]); // This Stops Our Timer For When You Get Out Of Your Vehicle Your Speed Doesn't Keep Going
TextDrawSetString(Speedometer[playerid], " "); // This Sets Our Textdraw To Blank And Freezes Because We Stop The Timer ^
if(newstate == 2) stimer[playerid] = SetTimerEx("speedometer", 255, true, "i", playerid); // This Starts The Timer When The Player Changes His/Her State To Being The Driver
else if(newstate == 3) stimer[playerid] = SetTimerEx("speedometer", 250, true, "i", playerid); // This Start The Timer When The Player Changes His/Her Start To Being The Passenger
return 1;
}

No more Errors! +Rep if i helped you
Reply
#6

still there see
Quote:

D:\da\filterscripts\MPH.pwn(31) : error 017: undefined symbol "svx"
D:\da\filterscripts\MPH.pwn(31) : warning 215: expression has no effect
D:\da\filterscripts\MPH.pwn(31) : error 001: expected token: ";", but found "]"
D:\da\filterscripts\MPH.pwn(31) : error 029: invalid expression, assumed zero
D:\da\filterscripts\MPH.pwn(31) : fatal error 107: too many error messages on one line

line 31
Quote:

GetVehicleVelocity(GetPlayerVehicleID(playerid), svx[playerid], svy[playerid], svz[playerid]); // This Saves Our Velocitys To Our Varibles

Reply
#7

resend code
Reply
#8

this the full code
PHP код:
#include <a_samp>
#include <ZCMD>
new Text:Speedometer[MAX_PLAYERS]; //This will create a textdraw for every player
new Floatvx[MAX_PLAYERS];//This is for getting the speed of the car
new Floatvy[MAX_PLAYERS];//This is for getting the speed of the car
new Floatvz[MAX_PLAYERS];//This is for getting the speed of the car
new Float1[MAX_PLAYERS];
new 
s2[MAX_PLAYERS];
new 
s3[MAX_PLAYERS];
new 
stimer[MAX_PLAYERS];
new 
Textdisplay[MAX_PLAYERS];
forward speedometer(playerid);
public 
OnPlayerSpawn(playerid)
{
Speedometer[playerid] = TextDrawCreate(335.000000434.000000"");
TextDrawBackgroundColor(Speedometer[playerid], 255);
TextDrawFont(Speedometer[playerid], 1);
TextDrawLetterSize(Speedometer[playerid], 0.2300001.100000);
TextDrawColor(Speedometer[playerid], -1);
TextDrawSetOutline(Speedometer[playerid], 1);
TextDrawSetProportional(Speedometer[playerid], 1);
TextDrawShowForPlayer(playeridSpeedometer[playerid]); //This gotta be in there otherwise speedometer wont show up.
return 1;
}
public 
speedometer(playerid)
{
GetVehicleVelocity(GetPlayerVehicleID(playerid), svx[playerid], svy[playerid], svz[playerid]); // This Saves Our Velocitys To Our Varibles
s1[playerid] = floatsqroot(((svx[playerid]*svx[playerid])+(svy[playerid]*svy[playerid]))+(svz[playerid]*svz[playerid]))*100// This Is Our Forumula ( I Don't Know How It Works but i found it on internet )
s2[playerid] = floatround(s1[playerid],floatround_round); // Round the output off to a whole number
format(s3[playerid],32,"%i"s2[playerid]); // The textdraw string
TextDrawSetString(sdisplay[playerid], s3[playerid]); // The actual changing of the textdraw
return 1;
}
public 
OnPlayerStateChange(playeridnewstateoldstate)
// This Is The Callback That Is Called When A Person Changes State
KillTimer(stimer[playerid]); // This Stops Our Timer For When You Get Out Of Your Vehicle Your Speed Doesn't Keep Going
TextDrawSetString(Speedometer[playerid], " "); // This Sets Our Textdraw To Blank And Freezes Because We Stop The Timer ^
if(newstate == 2stimer[playerid] = SetTimerEx("speedometer"255true"i"playerid); // This Starts The Timer When The Player Changes His/Her State To Being The Driver
else if(newstate == 3stimer[playerid] = SetTimerEx("speedometer"250true"i"playerid); // This Start The Timer When The Player Changes His/Her Start To Being The Passenger
return 1;

Reply
#9

Guys Can Any One Take The MPH To My TextDraw ? cuz its there much code not for MPH
this my TextDraw For MPH
Quote:

Speedometer[playerid] = TextDrawCreate(335.000000, 434.000000, "");
TextDrawBackgroundColor(Speedometer[playerid], 255);
TextDrawFont(Speedometer[playerid], 1);
TextDrawLetterSize(Speedometer[playerid], 0.230000, 1.100000);
TextDrawColor(Speedometer[playerid], -1);
TextDrawSetOutline(Speedometer[playerid], 1);
TextDrawSetProportional(Speedometer[playerid], 1);

help me +rep
Reply
#10

Neo, why did you rename all those variables instead of just fixing the code?

The first error was caused by a missing ';' on line 4. (As the error-message already said...)
The second error is caused because you didn't define 'sdisplay', but I guess you just forgot to rename that to SpeedoMeter. The other errors are just a result of this error.

So just get the original code back, add ; at the end of line 4 and change
sdisplay[playerid] to Speedometer[playerid] at line 34
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)