PDA

View Full Version : Help Meeee.. 4 Errors!


AlfaSufaIndo
26/06/2018, 11:07 PM
I just included <MV_Youtube> and after that I get 4 error and some warnings .. what is wrong with this code guys?


d:\SAMPSERVER\samp03\gamemodes\a.pwn(9088) : error 022: must be lvalue (non-constant)
d:\SAMPSERVER\samp03\gamemodes\a.pwn(22700) : error 035: argument type mismatch (argument 1)
d:\SAMPSERVER\samp03\gamemodes\a.pwn(22701) : error 035: argument type mismatch (argument 4)
d:\SAMPSERVER\samp03\gamemodes\a.pwn(24621) : error 022: must be lvalue (non-constant)
d:\SAMPSERVER\samp03\gamemodes\a.pwn(9077) : warning 219: local variable "Distance" shadows a variable at a preceding level
d:\SAMPSERVER\samp03\gamemodes\a.pwn(9077) : warning 203: symbol is never used: "Distance"
d:\SAMPSERVER\samp03\gamemodes\a.pwn(22699) : warning 219: local variable "Title" shadows a variable at a preceding level
d:\SAMPSERVER\samp03\gamemodes\a.pwn(22699) : warning 204: symbol is assigned a value that is never used: "Title"
d:\SAMPSERVER\samp03\gamemodes\a.pwn(24613) : warning 219: local variable "Distance" shadows a variable at a preceding level
d:\SAMPSERVER\samp03\gamemodes\a.pwn(24613) : warning 203: symbol is never used: "Distance"


stock GetClosestCar(playerid, exception = INVALID_VEHICLE_ID)
{
new
Float: Distance, //WARNING LINE: 9077
target = -1,
Float: vPos[3];
if(!IsPlayerInAnyVehicle(playerid)) GetPlayerPos(playerid, vPos[0], vPos[1], vPos[2]);
else GetVehiclePos(GetPlayerVehicleID(playerid), vPos[0], vPos[1], vPos[2]);

for(new v; v < MAX_VEHICLES; v++) if(GetVehicleModel(v) >= 400)
{
if(v != exception && (target < 0 || Distance > GetDistanceToCar(playerid, v, vPos[0], vPos[1], vPos[2])))
{
target = v;
Distance = GetDistanceToCar(playerid, v, vPos[0], vPos[1], vPos[2]); //ERROR LINE 9088
}
}
return target;
}

stock GetClosestGymTool(playerid, idx)
{
new Float:Distance, target = -1; //WARNING LINE:24613
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new s; s < MAX_GYMTOOL; s++)
{
if(target < 0 || Distance > GetDistanceToGymTool(playerid, idx, s, x, y, z))
{
target = s;
Distance = GetDistanceToGymTool(playerid, idx, s, x, y, z); //ERROR LINE 24621
}
}
return target;
}
================================================== =====================
new Title[128]; //WARNING LINE:22699
format(Title, sizeof(Title), "{FFFFFF}Statistic - {33CCFF} %s", GetPlayerNameEx(targetid)); //ERROR LINE:22700
ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, Title, str, "Ok", ""); //ERROR LINE:22701

AlfaSufaIndo
26/06/2018, 11:12 PM
And when I try not to include <MV_Youtube> the errors and the warning is gone

CodeStyle175
26/06/2018, 11:36 PM
dont use MV_Youtube it contains those variables and MV_Youtube doesn't even work.

Slawi
27/06/2018, 12:19 AM
You need to change the variable name because its already defined
try this
stock GetClosestCar(playerid, exception = INVALID_VEHICLE_ID)
{
new
Float: Distance1, //WARNING LINE: 9077
target = -1,
Float: vPos[3];
if(!IsPlayerInAnyVehicle(playerid)) GetPlayerPos(playerid, vPos[0], vPos[1], vPos[2]);
else GetVehiclePos(GetPlayerVehicleID(playerid), vPos[0], vPos[1], vPos[2]);

for(new v; v < MAX_VEHICLES; v++) if(GetVehicleModel(v) >= 400)
{
if(v != exception && (target < 0 || Distance1 > GetDistanceToCar(playerid, v, vPos[0], vPos[1], vPos[2])))
{
target = v;
Distance1 = GetDistanceToCar(playerid, v, vPos[0], vPos[1], vPos[2]); //ERROR LINE 9088
}
}
return target;
}

stock GetClosestGymTool(playerid, idx)
{
new Float:Distance1, target = -1; //WARNING LINE:24613
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new s; s < MAX_GYMTOOL; s++)
{
if(target < 0 || Distance1 > GetDistanceToGymTool(playerid, idx, s, x, y, z))
{
target = s;
Distance1 = GetDistanceToGymTool(playerid, idx, s, x, y, z); //ERROR LINE 24621
}
}
return target;
}
================================================== =====================
new Title1[128]; //WARNING LINE:22699
format(Title1, sizeof(Title1), "{FFFFFF}Statistic - {33CCFF} %s", GetPlayerNameEx(targetid)); //ERROR LINE:22700
ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, Title1, str, "Ok", ""); //ERROR LINE:22701