-
Sziasztok.
Ezeket az errorokat kaptam:
(5953) : warning 219: local variable \"vehicleid\" shadows a variable at a preceding level
(5962) : warning 219: local variable \"engine\" shadows a variable at a preceding level
(5962) : warning 219: local variable \"lights\" shadows a variable at a preceding level
(5962) : warning 219: local variable \"alarm\" shadows a variable at a preceding level
(5962) : warning 219: local variable \"doors\" shadows a variable at a preceding level
(5962) : warning 219: local variable \"bonnet\" shadows a variable at a preceding level
(5962) : warning 219: local variable \"boot\" shadows a variable at a preceding level
(5962) : warning 219: local variable \"objective\" shadows a variable at a preceding level
(5970) : warning 219: local variable \"engine\" shadows a variable at a preceding level
(5970) : warning 219: local variable \"lights\" shadows a variable at a preceding level
(5970) : warning 219: local variable \"alarm\" shadows a variable at a preceding level
(5970) : warning 219: local variable \"doors\" shadows a variable at a preceding level
(5970) : warning 219: local variable \"bonnet\" shadows a variable at a preceding level
(5970) : warning 219: local variable \"boot\" shadows a variable at a preceding level
(5970) : warning 219: local variable \"objective\" shadows a variable at a preceding level
(5983) : warning 219: local variable \"vehicleid\" shadows a variable at a preceding level
(5992) : warning 219: local variable \"engine\" shadows a variable at a preceding level
(5992) : warning 219: local variable \"lights\" shadows a variable at a preceding level
(5992) : warning 219: local variable \"alarm\" shadows a variable at a preceding level
(5992) : warning 219: local variable \"doors\" shadows a variable at a preceding level
(5992) : warning 219: local variable \"bonnet\" shadows a variable at a preceding level
(5992) : warning 219: local variable \"boot\" shadows a variable at a preceding level
(5992) : warning 219: local variable \"objective\" shadows a variable at a preceding level
(6000) : warning 219: local variable \"engine\" shadows a variable at a preceding level
(6000) : warning 219: local variable \"lights\" shadows a variable at a preceding level
(6000) : warning 219: local variable \"alarm\" shadows a variable at a preceding level
(6000) : warning 219: local variable \"doors\" shadows a variable at a preceding level
(6000) : warning 219: local variable \"bonnet\" shadows a variable at a preceding level
(6000) : warning 219: local variable \"boot\" shadows a variable at a preceding level
(6000) : warning 219: local variable \"objective\" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
30 Warnings.
És itt vannak a Sorok :(
6000-es: new engine,lights,alarm,doors,bonnet,boot,objective;
5992-es: new engine,lights,alarm,doors,bonnet,boot,objective;
5983-as: new vehicleid = GetPlayerVehicleID(playerid);
5970-es: new engine,lights,alarm,doors,bonnet,boot,objective;
5962-es: new engine,lights,alarm,doors,bonnet,boot,objective;
5953-as: new vehicleid = GetPlayerVehicleID(playerid);
Nem jövök rá hogy mi az Error :(
Itt az összes olyan sor ami az errorok közöt van!:
if(newkeys == KEY_NO)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
if(vehicleid < 47 || vehicleid > 50)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(vInfo[vehicleid][MOTORHAZTETO] == 0)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,1,boot,objective);
SendClientMessage(playerid, NARANCS, \"Kinyitottad a motorháztetõt!\");
vInfo[vehicleid][MOTORHAZTETO] = 1;
}
else
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,0,boot,objective);
SendClientMessage(playerid, NARANCS, \"Becsuktad a motorháztetõt!\");
vInfo[vehicleid][MOTORHAZTETO] = 0;
}
}
}
}
}
if(newkeys == KEY_YES)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
if(vehicleid < 47 || vehicleid > 50)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(vInfo[vehicleid][CSOMAGTARTO] == 0)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,1,objective);
SendClientMessage(playerid, NARANCS, \"Kinyitottad a motorháztetõt!\");
vInfo[vehicleid][CSOMAGTARTO] = 1;
}
else
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
SendClientMessage(playerid, NARANCS, \"Becsuktad a csomagtartót!\");
vInfo[vehicleid][CSOMAGTARTO] = 0;
}
}
}
}
}
-
A baj az, hogy az elágazásod (if) alá többször van beleírva a változók létrehozása. [Többször van létrehozva.] Csak egyszer hozd létre ezeket:
new engine,lights,alarm,doors,bonnet,boot,objective;
new vehicleid = GetPlayerVehicleID(playerid);
A kód helyesen:
if(newkeys == KEY_NO)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerVehicleID(playerid) < 47 || GetPlayerVehicleID(playerid) > 50)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
if(vInfo[GetPlayerVehicleID(playerid)][MOTORHAZTETO] == 0)
{
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,1,boot,objective);
SendClientMessage(playerid, NARANCS, \"Kinyitottad a motorháztetõt!\");
vInfo[GetPlayerVehicleID(playerid)][MOTORHAZTETO] = 1;
}
else
{
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,0,boot,objective);
SendClientMessage(playerid, NARANCS, \"Becsuktad a motorháztetõt!\");
vInfo[GetPlayerVehicleID(playerid)][MOTORHAZTETO] = 0;
}
}
}
}
}
if(newkeys == KEY_YES)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerVehicleID(playerid) < 47 || GetPlayerVehicleID(playerid) > 50)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
if(vInfo[GetPlayerVehicleID(playerid)][CSOMAGTARTO] == 0)
{
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,1,objective);
SendClientMessage(playerid, NARANCS, \"Kinyitottad a motorháztetõt!\");
vInfo[GetPlayerVehicleID(playerid)][CSOMAGTARTO] = 1;
}
else
{
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,0,objective);
SendClientMessage(playerid, NARANCS, \"Becsuktad a csomagtartót!\");
vInfo[GetPlayerVehicleID(playerid)][CSOMAGTARTO] = 0;
}
}
}
}
}
Nincs tesztelve, amúgy még lehetne törölgetni, ha a két dolgot az OnDialogResponse alatt rögtön létrehozod.
-
Köszi. Félig jó.
De akkor is még 16 error van xd xd
(5954) : warning 219: local variable \"vehicleid\" shadows a variable at a preceding level
(5961) : warning 219: local variable \"engine\" shadows a variable at a preceding level
(5961) : warning 219: local variable \"lights\" shadows a variable at a preceding level
(5961) : warning 219: local variable \"alarm\" shadows a variable at a preceding level
(5961) : warning 219: local variable \"doors\" shadows a variable at a preceding level
(5961) : warning 219: local variable \"bonnet\" shadows a variable at a preceding level
(5961) : warning 219: local variable \"boot\" shadows a variable at a preceding level
(5961) : warning 219: local variable \"objective\" shadows a variable at a preceding level
(5983) : warning 219: local variable \"vehicleid\" shadows a variable at a preceding level
(5990) : warning 219: local variable \"engine\" shadows a variable at a preceding level
(5990) : warning 219: local variable \"lights\" shadows a variable at a preceding level
(5990) : warning 219: local variable \"alarm\" shadows a variable at a preceding level
(5990) : warning 219: local variable \"doors\" shadows a variable at a preceding level
(5990) : warning 219: local variable \"bonnet\" shadows a variable at a preceding level
(5990) : warning 219: local variable \"boot\" shadows a variable at a preceding level
(5990) : warning 219: local variable \"objective\" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
16 Warnings.
És akkor 5990-tól 5954-ig a sorok :(
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
if(vehicleid < 47 || vehicleid > 50)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
if(vInfo[vehicleid][MOTORHAZTETO] == 0)
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,1,boot,objective);
SendClientMessage(playerid, NARANCS, \"Kinyitottad a motorháztetõt!\");
vInfo[vehicleid][MOTORHAZTETO] = 1;
}
else
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,0,boot,objective);
SendClientMessage(playerid, NARANCS, \"Becsuktad a motorháztetõt!\");
vInfo[vehicleid][MOTORHAZTETO] = 0;
}
}
}
}
}
if(newkeys == KEY_YES)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
if(vehicleid < 47 || vehicleid > 50)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
És szintén az egész :)
if(newkeys == KEY_NO)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
if(vehicleid < 47 || vehicleid > 50)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
if(vInfo[vehicleid][MOTORHAZTETO] == 0)
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,1,boot,objective);
SendClientMessage(playerid, NARANCS, \"Kinyitottad a motorháztetõt!\");
vInfo[vehicleid][MOTORHAZTETO] = 1;
}
else
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,0,boot,objective);
SendClientMessage(playerid, NARANCS, \"Becsuktad a motorháztetõt!\");
vInfo[vehicleid][MOTORHAZTETO] = 0;
}
}
}
}
}
if(newkeys == KEY_YES)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
if(vehicleid < 47 || vehicleid > 50)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
if(vInfo[vehicleid][CSOMAGTARTO] == 0)
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,1,objective);
SendClientMessage(playerid, NARANCS, \"Kinyitottad a motorháztetõt!\");
vInfo[vehicleid][CSOMAGTARTO] = 1;
}
else
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
SendClientMessage(playerid, NARANCS, \"Becsuktad a csomagtartót!\");
vInfo[vehicleid][CSOMAGTARTO] = 0;
}
}
}
}
}
-
Akkor MÉG MINDIG van a játékmódban/filterszkriptben ilyesfajta létrehozás... nézd már át teljesen, ez azt jelenti, hogy valamit többször hoztál létre a kelleténél.
Nem tudom, elolvastad-e az utolsó válaszom, de legalul odaírtam:
ezt a két sort tedd az OnDialogResponse { alá rögtön! Így:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new engine,lights,alarm,doors,bonnet,boot,objective, vehicleid = GetPlayerVehicleID(playerid);
// és ide alá jönnek a lekérdezések, hogy: if(newkeys == KEY_NO) stb...!
// és a KEY_NO és KEY_YES alól vedd ki a létrehozásokat! mivel már elõttük létre lett hozva, nem kell mégegyszer!
return 1;
}
-
Nézd meg a módot elejénél, hogy globális változóként nincs-e létrehozva.
-
Köszönöm szépen.
Csak én már most így fáradt vagyok oszt nem vettem észre hogy itt már létre van hozva:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new engine,lights,alarm,doors,bonnet,boot,objective, vehicleid = GetPlayerVehicleID(playerid);
// és itt jönek a Key stb :)
return 1;
}
Még azt a kérdést szeretném fel rakni hogy amikor meg nyomod a Bal klikket akkor az mien KEY_??? Mert én Num0-át találtam. Akkor annak a kódja a bal klikk és a Num0-?
-
KEY_FIRE