error 029: invalid expression, assumed zero -
LazzyBoy - 30.10.2017
Код:
else if(!strcmp(tmp, "unimpound", true, 7))
{
if(!strlen(tmp2) || !IsNumeric(tmp2) && PlayerInfo[playerid][playerteam] == FAC_TYPE_POLICE && PlayerInfo[playerid][ranklvl] <=2) return SCP(playerid, "car unimpound [ ID ]");
{
new theunimpoundid = strval(tmp2);
if(!dini_Isset(globalstats, "unimpoundslot"))
dini_IntSet(globalstats, "unimpoundslot", 0);
new ri = dini_Int(globalstats, "unimpoundslot");
if(ri >= sizeof(unimpoundpos))
{
ri = 0;
dini_IntSet(globalstats, "unimpoundslot", 0);
}
else dini_IntSet(globalstats, "unimpoundslot", ri+1);
VehicleInfo[theunimpoundid][vX] = unimpoundpos[ri][spawnx];
VehicleInfo[theunimpoundid][vY] = unimpoundpos[ri][spawny];
VehicleInfo[theunimpoundid][vZ] = unimpoundpos[ri][spawnz];
VehicleInfo[theunimpoundid][vA] = unimpoundpos[ri][sangle];
VehicleInfo[theunimpoundid][vVirtualWorld] = 0;
VehicleInfo[theunimpoundid][vImpounded] = 0;
VehicleInfo[theunimpoundid][vImpoundFee] = 0;
myStrcpy(VehicleInfo[theunimpoundid][vImpoundReason], "None");
ReloadVehicle(theunimpoundid);
printf("%d",theunimpoundid);
}
else //// ERROR Line
{
new iBigStr[1575], iCount, iSmllStr[128];
strcat(iBigStr, "Vehicle\tImpound fee\tImpound Reason\n");
VehicleLoop(v)
{
if(VehicleInfo[v][vActive] != true) continue;
if(strcmp(PlayerName(playerid), VehicleInfo[v][vOwner], false)) continue;
if(VehicleInfo[v][vImpounded] != 1) continue;
if(VehicleInfo[v][vImpounded] == 1 && VehicleInfo[v][vSpawned] != true)
{
iCount++;
format(iSmllStr, sizeof(iSmllStr), "%d %s(%d)\t%d\t%s\n", v, GetVehicleNameFromModel(VehicleInfo[v][vModel]),VehicleInfo[v][rID],VehicleInfo[v][vImpoundFee], VehicleInfo[v][vImpoundReason]);
}
strcat(iBigStr, iSmllStr);
ShowPlayerDialog(playerid, DIALOG_UNIMPOUND, DIALOG_STYLE_TABLIST_HEADERS, "{3196ef}Please select vehicle you would like to unimpound", iBigStr, "Select", "Exit");
}
if(!iCount) return SendClientError(playerid, "You don't have any impounded vehicle");
return 1;
}
}
error
Код:
error 029: invalid expression, assumed zero
Re: error 029: invalid expression, assumed zero -
Lucases - 30.10.2017
Is that hard to use sscanf and zcmd?
Re: error 029: invalid expression, assumed zero -
LazzyBoy - 30.10.2017
im using sscanf and zcmd already
the command is CAR which includes like 15 commands in it
like car lock / car unlock car unimpound etc so.
Re: error 029: invalid expression, assumed zero -
Konstantinos - 30.10.2017
Код:
else dini_IntSet(globalstats, "unimpoundslot", ri + 1);
Your
else statement ends there. What is the next
else for? It doesn't have an
if statement before unless you were supposed to have it as:
pawn Код:
if (..)
{
}
else if (..)
{
}
else
{
}
Re: error 029: invalid expression, assumed zero -
LazzyBoy - 30.10.2017
heres
Код:
if(!dini_Isset(globalstats, "unimpoundslot"))
dini_IntSet(globalstats, "unimpoundslot", 0);
new ri = dini_Int(globalstats, "unimpoundslot");
if(ri >= sizeof(unimpoundpos))
{
ri = 0;
dini_IntSet(globalstats, "unimpoundslot", 0);
}
else dini_IntSet(globalstats, "unimpoundslot", ri+1);
and the errors line should fit with this one
Код:
if(!strlen(tmp2) || !IsNumeric(tmp2) && PlayerInfo[playerid][playerteam] == FAC_TYPE_POLICE && PlayerInfo[playerid][ranklvl] <=2) return SCP(playerid, "car unimpound [ ID ]");
{
Re: error 029: invalid expression, assumed zero -
Konstantinos - 30.10.2017
No, it doesn't fit with that line as you return an error so you basically open a new bracket out of nowhere and execute some code in it. This is your code:
Код:
if (...) return SCP(...);
{
// code.. that is ALWAYS executed
}
else // not an "if" pair before.
{
}
Re: error 029: invalid expression, assumed zero -
LazzyBoy - 30.10.2017
Mind if you could help me a bit to fix the codes
i do understand how it works but in this code its pretty fuckd i'd say xD
Please
Re: error 029: invalid expression, assumed zero -
Konstantinos - 30.10.2017
The code is indeed confusing and most here (including me) are not aware of what you're trying to do
exactly. So let's break it into more pieces. When this code is supposed to be executed?
pawn Код:
{
new theunimpoundid = strval(tmp2);
if (!dini_Isset(globalstats, "unimpoundslot"))
dini_IntSet(globalstats, "unimpoundslot", 0);
new ri = dini_Int(globalstats, "unimpoundslot");
if (ri >= sizeof(unimpoundpos))
{
ri = 0;
dini_IntSet(globalstats, "unimpoundslot", 0);
}
else dini_IntSet(globalstats, "unimpoundslot", ri + 1);
VehicleInfo[theunimpoundid][vX] = unimpoundpos[ri][spawnx];
VehicleInfo[theunimpoundid][vY] = unimpoundpos[ri][spawny];
VehicleInfo[theunimpoundid][vZ] = unimpoundpos[ri][spawnz];
VehicleInfo[theunimpoundid][vA] = unimpoundpos[ri][sangle];
VehicleInfo[theunimpoundid][vVirtualWorld] = 0;
VehicleInfo[theunimpoundid][vImpounded] = 0;
VehicleInfo[theunimpoundid][vImpoundFee] = 0;
myStrcpy(VehicleInfo[theunimpoundid][vImpoundReason], "None");
ReloadVehicle(theunimpoundid);
printf("%d", theunimpoundid);
}
Re: error 029: invalid expression, assumed zero -
LazzyBoy - 30.10.2017
Okay so basiclly this command allows an player to unimpound his vehicle so as u can see there is two part of codes which ive scripted atleast i tried to make it right so
Now when a player writes the command it should show the dialog with the impounded vehicles which is the second script after the ELSE
When a police officer writes the command for example car unimpound it will show him the impounded vehicles that he owns but if he writes for example car unimpound ID(1) it will unimpound the id 1 vehicle which is the first script
hope you understand me and sorry for mistakes phone wroten
Re: error 029: invalid expression, assumed zero -
Konstantinos - 30.10.2017
So if the cop input the ID, it will unimpound the vehicle, otherwise it will just show the dialog for either cop or player?
pawn Код:
else if (!strcmp(tmp, "unimpound", true, 7))
{
if (strlen(tmp2) && IsNumeric(tmp2) && PlayerInfo[playerid][playerteam] == FAC_TYPE_POLICE && PlayerInfo[playerid][ranklvl] <= 2)
{
new theunimpoundid = strval(tmp2);
if (!dini_Isset(globalstats, "unimpoundslot"))
dini_IntSet(globalstats, "unimpoundslot", 0);
new ri = dini_Int(globalstats, "unimpoundslot");
if (ri >= sizeof(unimpoundpos))
{
ri = 0;
dini_IntSet(globalstats, "unimpoundslot", 0);
}
else dini_IntSet(globalstats, "unimpoundslot", ri + 1);
VehicleInfo[theunimpoundid][vX] = unimpoundpos[ri][spawnx];
VehicleInfo[theunimpoundid][vY] = unimpoundpos[ri][spawny];
VehicleInfo[theunimpoundid][vZ] = unimpoundpos[ri][spawnz];
VehicleInfo[theunimpoundid][vA] = unimpoundpos[ri][sangle];
VehicleInfo[theunimpoundid][vVirtualWorld] = 0;
VehicleInfo[theunimpoundid][vImpounded] = 0;
VehicleInfo[theunimpoundid][vImpoundFee] = 0;
myStrcpy(VehicleInfo[theunimpoundid][vImpoundReason], "None");
ReloadVehicle(theunimpoundid);
printf("%d", theunimpoundid);
return 1;
}
new iBigStr[1575], iCount, iSmllStr[128];
strcat(iBigStr, "Vehicle\tImpound fee\tImpound Reason\n");
VehicleLoop(v)
{
if (VehicleInfo[v][vActive] != true) continue;
if (strcmp(PlayerName(playerid), VehicleInfo[v][vOwner], false)) continue;
if (VehicleInfo[v][vImpounded] != 1) continue;
if (VehicleInfo[v][vImpounded] == 1 && VehicleInfo[v][vSpawned] != true)
{
iCount++;
format(iSmllStr, sizeof(iSmllStr), "%d %s(%d)\t%d\t%s\n", v, GetVehicleNameFromModel(VehicleInfo[v][vModel]), VehicleInfo[v][rID], VehicleInfo[v][vImpoundFee], VehicleInfo[v][vImpoundReason]);
}
strcat(iBigStr, iSmllStr);
ShowPlayerDialog(playerid, DIALOG_UNIMPOUND, DIALOG_STYLE_TABLIST_HEADERS, "{3196ef}Please select vehicle you would like to unimpound", iBigStr, "Select", "Exit");
}
if (!iCount) SendClientError(playerid, "You don't have any impounded vehicle");
return 1;
}