Hallo Brotfische,
Mein /vehiclelock Befehl, um Autos abzuschließen geht nicht.
Codes:
enum carEnum{
id_x,
model,
besitzer,
fraktion,
Float:c_x,
Float:c_y,
Float:c_z,
Float:c_r,
db_id,
Locked[MAX_VEHICLES],
kennzeichen[20],
frakid,
rang
}
ocmd:vehiclelock(playerid,params[])
{
new veh = GetOwnVehicle(playerid);
if(veh == INVALID_VEHICLE_ID) return SendClientMessage(playerid,COLOR_RED,!"Es befindet sich keines deiner Fahrzeuge in der Nähe.");
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);
SetVehicleParamsEx(veh,engine,lights,alarm,!vehdoor,bonnet,boot,objective);
for(new i; i<MAX_PLAYERS; i++) SetVehicleParamsForPlayer(veh,i,0,!vehdoor);
vehdoor = !vehdoor;
return 1;
}
stock GetOwnVehicle(playerid) {
new t;
for(new i,Float:p[3],Float:tmp=999.0,Float:z; i<sizeof(cInfo); i++) {
if(cInfo[i][besitzer]!=sInfo[playerid][db_id]) continue;
GetVehiclePos(cInfo[i][id_x],p[0],p[1],p[2]);
z = GetPlayerDistanceFromPoint(playerid,p[0],p[1],p[2]);
if(z < tmp) tmp=z,t=i;
}
return (!t)?INVALID_VEHICLE_ID:t;
}
Ich hoffe es kann mir jemand helfen
MFG German_ScripterHD