SA-MP Forums Archive
Errors - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Errors (/showthread.php?tid=492256)



Errors - TheSnaKe - 03.02.2014

Hey guys, i got some errors and i want to fix it, here is the errors and codes.

Errors:
Код:
C:\Users\For SAMP\Desktop\s\gamemodes\RGRP.pwn(85965) : error 017: undefined symbol "fVehSpeed"
C:\Users\For SAMP\Desktop\s\gamemodes\RGRP.pwn(85965) : error 001: expected token: ";", but found "]"
C:\Users\For SAMP\Desktop\s\gamemodes\RGRP.pwn(85965) : error 001: expected token: ";", but found ")"
C:\Users\For SAMP\Desktop\s\gamemodes\RGRP.pwn(85965) : fatal error 107: too many error messages on one line
Code
PHP код:
fCurrentSpeed player_get_speed(i);
if(
PlayerInfo[i][pAdmin] <= 1) switch(Seatbelt[i]) {
case 
0: if(fVehSpeed[i] - fCurrentSpeed 40.0GetPlayerHealth(ifExpHealth), SetPlayerHealth(ifExpHealth - (fVehSpeed[i] - fCurrentSpeed) / 2.0);
default: if(
fVehSpeed[i] - fCurrentSpeed 40.0GetPlayerHealth(ifExpHealth), SetPlayerHealth(ifExpHealth - ((fVehSpeed[i] - fCurrentSpeed) / 4.0));

Line 85965 is
PHP код:
case 0: if(fVehSpeed[i] - fCurrentSpeed 40.0GetPlayerHealth(ifExpHealth), SetPlayerHealth(ifExpHealth - (fVehSpeed[i] - fCurrentSpeed) / 2.0); 



Re: Errors - StreetGT - 03.02.2014

fVehSpeed is not defined.
Probably you need to

new Float:fVehSpeed[MAX_PLAYERS]; on top of your gamemode.
since "i" is looping players


Re: Errors - Dignity - 03.02.2014

pawn Код:
fCurrentSpeed = player_get_speed(i);
if(PlayerInfo[i][pAdmin] <= 1) switch(Seatbelt[i]) {
case 0: if(fVehSpeed[i] - fCurrentSpeed > 40.0) GetPlayerHealth(i, fExpHealth), SetPlayerHealth(i, fExpHealth - (fVehSpeed[i] - fCurrentSpeed)) / 2.0);
default: if(fVehSpeed[i] - fCurrentSpeed > 40.0) GetPlayerHealth(i, fExpHealth), SetPlayerHealth(i, fExpHealth - ((fVehSpeed[i] - fCurrentSpeed)) / 4.0));
}
Try it.


Re: Errors - TheSnaKe - 03.02.2014

Quote:
Originally Posted by Mionee
Посмотреть сообщение
pawn Код:
fCurrentSpeed = player_get_speed(i);
if(PlayerInfo[i][pAdmin] <= 1) switch(Seatbelt[i]) {
case 0: if(fVehSpeed[i] - fCurrentSpeed > 40.0) GetPlayerHealth(i, fExpHealth), SetPlayerHealth(i, fExpHealth - (fVehSpeed[i] - fCurrentSpeed)) / 2.0);
default: if(fVehSpeed[i] - fCurrentSpeed > 40.0) GetPlayerHealth(i, fExpHealth), SetPlayerHealth(i, fExpHealth - ((fVehSpeed[i] - fCurrentSpeed)) / 4.0));
}
Try it.
Well now i get 6 errors, i will send the 6 errors and the whole code.


Code:

Код:
 // Timer Name: ServerMicrobeat()
// TickRate: 250 Milliseconds
Timer:ServerMicrobeat[250]()
{
new
Float: fExpHealth,
Float: fCurrentSpeed,
iVehicle,
szSpeed[42],
arrVehParams[7],
arrDamage[4];

foreach(Player, i)
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
if(arr_Towing[i] != INVALID_VEHICLE_ID) {
if(GetVehicleModel(arr_Towing[i]) && IsVehicleStreamedIn(arr_Towing[i], i)) AttachTrailerToVehicle(arr_Towing[i], GetPlayerVehicleID(i));
else arr_Towing[i] = INVALID_VEHICLE_ID;
}

fCurrentSpeed = player_get_speed(i);
if(PlayerInfo[i][pAdmin] <= 1) switch(Seatbelt[i]) {
case 0: if(fVehSpeed[i] - fCurrentSpeed > 40.0) GetPlayerHealth(i, fExpHealth), SetPlayerHealth(i, fExpHealth - (fVehSpeed[i] - fCurrentSpeed)) / 2.0);
default: if(fVehSpeed[i] - fCurrentSpeed > 40.0) GetPlayerHealth(i, fExpHealth), SetPlayerHealth(i, fExpHealth - ((fVehSpeed[i] - fCurrentSpeed)) / 4.0));
}
fVehSpeed[i] = fCurrentSpeed;
iVehicle = GetPlayerVehicleID(i);

GetVehicleHealth(iVehicle,fExpHealth);
if(fExpHealth < 350.0)
{
SetVehicleHealth(iVehicle, 251.0);
GetVehicleParamsEx(iVehicle, arrVehParams[0], arrVehParams[1], arrVehParams[2], arrVehParams[3], arrVehParams[4], arrVehParams[5], arrVehParams[6]);
if(arrVehParams[0] == VEHICLE_PARAMS_ON) SetVehicleParamsEx(iVehicle,VEHICLE_PARAMS_OFF, arrVehParams[1], arrVehParams[2], arrVehParams[3], arrVehParams[4], arrVehParams[5], arrVehParams[6]);
GameTextForPlayer(i, "~r~Totalled!", 2500, 3);
arr_Engine{iVehicle} = 0;
}
else if(PlayerInfo[i][pSpeedo] != 0 && FindTimePoints[i] == 0 && arr_Engine{iVehicle} == 1) {
format(szSpeed, sizeof(szSpeed),"~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~%.0f MPH", fCurrentSpeed);
GameTextForPlayer(i, szSpeed, 1500, 3);
}
for(new s=0;s<10;s++)
{
if(SpikeStrips[s][sX] != 0) // Reduced from three vars to one
{
if(VehicleToPoint( 3.0, iVehicle, SpikeStrips[s][sX], SpikeStrips[s][sY], SpikeStrips[s][sZ]))
{
GetVehicleDamageStatus(iVehicle, arrDamage[0], arrDamage[1], arrDamage[2], arrDamage[3]);
arrDamage[3] = encode_tires(1, 1, 1, 1);
UpdateVehicleDamageStatus(iVehicle, arrDamage[0], arrDamage[1], arrDamage[2], arrDamage[3]);
}
}
}
}
else if(GetPlayerState(i) == PLAYER_STATE_PASSENGER) {
fCurrentSpeed = player_get_speed(i);
if(PlayerInfo[i][pAdmin] <= 1) switch(Seatbelt[i]) {
case 0: if(fVehSpeed[i] - fCurrentSpeed > 40.0) GetPlayerHealth(i, fExpHealth), SetPlayerHealth(i, fExpHealth - (fVehSpeed[i] - fCurrentSpeed) / 2.0);
default: if(fVehSpeed[i] - fCurrentSpeed > 40.0) GetPlayerHealth(i, fExpHealth), SetPlayerHealth(i, fExpHealth - ((fVehSpeed[i] - fCurrentSpeed) / 4.0));
}
fVehSpeed[i] = fCurrentSpeed;
}
}
}
*/

// Timer Name: VehicleUpdate()
// TickRate: 10 secs.
Errors:

Код:
C:\Users\For SAMP\Desktop\s\gamemodes\RGRP.pwn(85966) : error 001: expected token: ";", but found ")"
C:\Users\For SAMP\Desktop\s\gamemodes\RGRP.pwn(85966) : error 036: empty statement
C:\Users\For SAMP\Desktop\s\gamemodes\RGRP.pwn(85967) : error 014: invalid statement; not in switch
C:\Users\For SAMP\Desktop\s\gamemodes\RGRP.pwn(85967) : error 029: invalid expression, assumed zero
C:\Users\For SAMP\Desktop\s\gamemodes\RGRP.pwn(85967) : error 001: expected token: ";", but found "if"
C:\Users\For SAMP\Desktop\s\gamemodes\RGRP.pwn(85967) : fatal error 107: too many error messages on one line

NOTE: Anyway, i don't need it i saw that is useless, so i will not use it.



Re: Errors - Dignity - 04.02.2014

Try replacing

pawn Код:
default: if(fVehSpeed[i] - fCurrentSpeed > 40.0) GetPlayerHealth(i, fExpHealth), SetPlayerHealth(i, fExpHealth - ((fVehSpeed[i] - fCurrentSpeed)) / 4.0));
With

pawn Код:
default: if(fVehSpeed[i] - fCurrentSpeed > 40.0) GetPlayerHealth(i, fExpHealth), SetPlayerHealth(i, fExpHealth - (fVehSpeed[i] - fCurrentSpeed)) / 4.0);