Dann musst du es so machen:
ocmd:vehiclelock(playerid,params[])
{
new veh = INVALID_VEHICLE_ID;
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
new Float:Pos[3], Float:dist = 20.0, Float:tmp;
for(new i=0;i<MAX_VEHICLES; i++)
{
GetVehiclePos(i, Pos[0], Pos[1], Pos[2]);
tmp = GetPlayerDistanceFromPoint(playerid, Pos[0], Pos[1], Pos[2]);
if(tmp < dist)
{
veh = i;
dist = tmp;
}
}
}
else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
veh = GetPlayerVehicleID(playerid);
}
if(veh == INVALID_VEHICLE_ID) return SendClientMessage(playerid,COLOR_RED,"Es befindet sich keines deiner Fahrzeuge in der Nähe.");
if(sInfo[playerid][alevel] > 0 || cInfo[veh][besitzer] == playerid)
{
new engine,lights,alarm,bonnet,boot,objective;
GetVehicleParamsEx(veh,engine,lights,alarm,vehdoor,bonnet,boot,objective);
GameTextForPlayer(playerid, (vehdoor)?("~w~Fahrzeug ~g~aufgeschlossen"):("~w~Fahrzeug ~g~abgeschlossen"), 3000, 5);
PlaySoundForPlayer(playerid,1147);
SetTimerEx("PlaySoundForPlayer",500,0,"id",playerid,1147);
if(vehdoor!=0) vehdoor = 0;
else vehdoor = 1;
SetVehicleParamsEx(veh,engine,lights,alarm,vehdoor,bonnet,boot,objective);
}
else
{
return SendClientMessage(playerid,COLOR_RED,"Das Auto gehört dir nicht.");
}
return 1;
}
German_ScripterHD: Ändere in der Schleife: MAX_PLAYERS zu MAX_VEHICLES. Ist mir grade aufgefallen.