-
Helló. Próbálkoztam csinálni egy kocsi indító/leállító parancsot. Így néz ki:
if(strcmp(\"/motor\", cmdtext, true, 10) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), false, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, FEHER, \"Leállítottad a jármûved motorját !\");
return 1;
}else{
SendClientMessage(playerid, PIROS, \"Nem ülsz jármûben/jármûvön !\");
}
}else{
if(IsPlayerInAnyVehicle(playerid))
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), true, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, FEHER, \"Beindítottad a jármûved motorját !\");
return 1;
}
}
De mikor beülök 1 kocsiba kiírja h leállítottad a motort és le is állítja de mikor indítanám nem indítja. mit csináljak?? PLS zcmd nélkül segítsetek
-
Csáo nemtudom h hibás-e vagy nem mert nem teszteltem de kukkantsd meg jónak kéne lennnie ha hibát ír a változóra írj
if(strcmp(\"/motor\", cmdtext, true, 10) == 0)
new engine[MAX_PLAYERS];
engine[playerid] = false;
{
if(IsPlayerInAnyVehicle(playerid) && engine[playerid] == true)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), false, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, FEHER, \"Leállítottad a jármûved motorját !\");
engine[playerid] = false;
return 1;
}else{
SendClientMessage(playerid, PIROS, \"Nem ülsz jármûben/jármûvön !\");
}
}else{
if(IsPlayerInAnyVehicle(playerid) && engine[playerid] == false)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), true, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, FEHER, \"Beindítottad a jármûved motorját !\");
engine[playerid] = true;
return 1;
}
}
-
ezzel van hibája
new engine[MAX_PLAYERS];
-
akkor new bool:engine[MAX_PLAYERS];
-
C:\\Users\\...\\Desktop\\Blueberry RPG\\gamemodes\\blueberry.pwn(968) : warning 219: local variable \"engine\" shadows a variable at a preceding level
C:\\Users\\...\\Desktop\\Blueberry RPG\\gamemodes\\blueberry.pwn(977) : error 028: invalid subscript (not an array or too many subscripts): \"engine\"
C:\\Users\\...\\Desktop\\Blueberry RPG\\gamemodes\\blueberry.pwn(977) : warning 215: expression has no effect
C:\\Users\\...\\Desktop\\Blueberry RPG\\gamemodes\\blueberry.pwn(977) : error 001: expected token: \";\", but found \"]\"
C:\\Users\\...\\Desktop\\Blueberry RPG\\gamemodes\\blueberry.pwn(977) : error 029: invalid expression, assumed zero
C:\\Users\\...\\Desktop\\Blueberry RPG\\gamemodes\\blueberry.pwn(977) : fatal error 107: too many error messages on one line
-
968 és 977-es sort másold be plz
-
new engine, lights, alarm, doors, bonnet, boot, objective;
engine[playerid] = false;
-
if(strcmp(\"/motor\", cmdtext, true, 10) == 0)
new ensgine[MAX_PLAYERS];
ensgine[playerid] = false;
{
if(IsPlayerInAnyVehicle(playerid) && ensgine[playerid] == true)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), false, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, FEHER, \"Leállítottad a jármûved motorját !\");
ensgine[playerid] = false;
return 1;
}else{
SendClientMessage(playerid, PIROS, \"Nem ülsz jármûben/jármûvön !\");
}
}else{
if(IsPlayerInAnyVehicle(playerid) && ensgine[playerid] == false)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), true, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, FEHER, \"Beindítottad a jármûved motorját !\");
ensgine[playerid] = true;
return 1;
}
}
-
C:\\Users\\...\\Desktop\\Blueberry RPG\\gamemodes\\blueberry.pwn(961) : error 003: declaration of a local variable must appear in a compound block
C:\\Users\\...\\Desktop\\Blueberry RPG\\gamemodes\\blueberry.pwn(961) : error 017: undefined symbol \"ensgine\"
C:\\Users\\...\\Desktop\\Blueberry RPG\\gamemodes\\blueberry.pwn(961) : warning 215: expression has no effect
C:\\Users\\...\\Desktop\\Blueberry RPG\\gamemodes\\blueberry.pwn(961) : error 001: expected token: \";\", but found \"]\"
C:\\Users\\...\\Desktop\\Blueberry RPG\\gamemodes\\blueberry.pwn(961) : fatal error 107: too many error messages on one line
-
961-es sor?
------------------------------------
másold be
-
new ensgine[MAX_PLAYERS];
-
próbáld így new bool:ensgine[MAX_PLAYERS];
-
nem jó
-
próbáld így new bool:ensgine[MAX_PLAYERS];
Úr Isten! :OO
Elmagyarázod miért kell oda bool? És az egész szkript hibás mivel olyan zárások vannak létrehozva ahova nem is kéne + hibás haza jövök és megírom neked jól.
-
[mod] Hamarosan repül a warn. Filip95, jobb ha visszaveszel a stílusodból, átnéztem 10 témát, mindegyikbe hülyeségeket írtál. Lehet, hogy segíteni akarsz, de ez már inkább hozzászólás vadászatnak tûnik. [/mod]