Hallo ich habe heute mein Befehl umgeändert:
if(strcmp(cmd, "/engine",true) == 0 || strcmp(cmd, "/motor",true) == 0)
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1;
new vid = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
GetPlayerName(playerid, sendername, sizeof(sendername));
if(vid != INVALID_VEHICLE_ID)
{
if(engine == VEHICLE_PARAMS_ON)
{
StopEngine(playerid,vid);
SendClientMessage(playerid,COLOR_GRAD2," Motor abgeschaltet.");
}
else
{
if(Gas[vid] > 0){
if(PlayerInfo[playerid][pAdmin] >= 1337){
if(Maske[playerid] == 0) {
format(string, sizeof(string), "* %s startet den Motor",sendername);
SetPlayerChatBubble(playerid, string, COLOR_PURPLE, 30.0, 2000); SetTimerEx("StartEngineSleep",800,0,"i",playerid);
}
else {
SetPlayerChatBubble(playerid, "* jemand startet einen Motor", COLOR_PURPLE, 30.0, 2000); SetTimerEx("StartEngineSleep",800,0,"i",playerid);
}
SendClientMessage(playerid,COLOR_GRAD2," Motor wird gestartet.");
if(SpawnKillAktiv[playerid] == 1) { SpawnSkillSchutz(playerid);}
return 1;
}
new typ = IsAutohausCar(vid);
new GATyp = IsGangAutohausCar(vid);
if(typ != -1 || GATyp != -1){
SendClientMessage(playerid,COLOR_GRAD2,"*** Ich habe keinen Schlüssel für das Fahrzeug!");
return 1;
}
if(IsAMedicCar(vid)){
if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4) { }
else { SendClientMessage(playerid, COLOR_ERRORTEXT, "*** Ich gehöre nicht zu dem Rettungsdienst!"); return 1; }
}
if(IsAFahrschulCar(vid)){
if(PlayerInfo[playerid][pMember] == 11 || PlayerInfo[playerid][pLeader] == 11 || TakingLesson[playerid] == 1){}
else{
SendClientMessage(playerid, COLOR_ERRORTEXT, "*** Ich bin kein Fahrlehrer oder habe keine FahrStunde!");
return 1;
}}
if(IsATruckerCar(vid)){
if(PlayerInfo[playerid][pJob] == 16 || TakingLesson[playerid] == 1){}
else{
SendClientMessage(playerid, COLOR_ERRORTEXT, "*** Ich bin kein Trucker!");
return 1;
}}
if(IsANewsCar(vid)){
if(PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9){}
else{
SendClientMessage(playerid, COLOR_ERRORTEXT, "*** Ich gehöre nicht zu den NachrichtenDienst!");
return 1;
}}
if(IsAOAmtCar(vid)){
if(!IsAOrdnungsbeamter(playerid)){
SendClientMessage(playerid, COLOR_ERRORTEXT, "*** Ich bin kein Ordnungsbeamter!");
return 1;
}}
if(IsACopCar(vid)){
if(IsACop(playerid) && OnDuty[playerid] == 1){}
else{
SendClientMessage(playerid, COLOR_ERRORTEXT, "*** Ich bin kein Polizist oder bin nicht im Dienst!");
return 1;
}}
for(new h = 0; h < sizeof(PilotFlug); h++){
if(GetPlayerVehicleID(playerid) == PilotFlug[h]){
if(PlayerInfo[playerid][pJob] == 18)
{
}
else
{
SendClientMessage(playerid, COLOR_ERRORTEXT, "*** Ich habe keinen Schlüssel für das Fahrzeug!");
return 1;
}}}
for(new h = 0; h < sizeof(RobTransporter); h++){
if(GetPlayerVehicleID(playerid) == RobTransporter[h]){
if(TransporterRobberID == playerid || IsACop(playerid) && OnDuty[playerid] == 1){}
else {
SendClientMessage(playerid, COLOR_ERRORTEXT, "*** Ich habe keinen Schlüssel für das Fahrzeug!");
return 1;
}}}
for(new h = 0; h < sizeof(GangAutoInfo); h++){
if(vid == GangAutoInfo[h][cID]){
if(PlayerInfo[playerid][pMember] == GangAutoInfo[h][cOwner] || PlayerInfo[playerid][pLeader] == GangAutoInfo[h][cOwner] || TakingLesson[playerid] == 1 && GangAutoInfo[h][cOwner] == 1 || GangAutoInfo[h][cOwner] == 11 || (GangAutoInfo[h][cOwner] == 7 || GangAutoInfo[h][cOwner] == 14 || GangAutoInfo[h][cOwner] == 16) && IsACop(playerid)) { }
else {
SendClientMessage(playerid, COLOR_ERRORTEXT, "*** Ich habe keinen Schlüssel für das Fahrzeug!"); return 1; }
break;
}}
for(new h = 0; h < sizeof(AutomatischeFSCars); h++) {
if(vid == AutomatischeFSCars[h]) {
if(TakingLesson[playerid] == 2) { CP[playerid] = 24; SetPlayerCheckpoint(playerid, 1213.7196,-1841.5648,13.3828, 5.0); }
else { SendClientMessage(playerid, COLOR_ERRORTEXT, "*** Ich habe keinen Schlüssel für das Fahrzeug! !"); return 1; }
}}
for(new h = 0; h < sizeof(MechanikerWagenCars); h++) {
if(vid == MechanikerWagenCars[h]) {
if(PlayerInfo[playerid][pJob] == 7) { }
else { SendClientMessage(playerid, COLOR_ERRORTEXT, "*** Ich habe keinen Schlüssel für das Fahrzeug! !"); return 1; }
}}
for(new h = 0; h < sizeof(Drescher); h++) {
if(vid == Drescher[h]) {
if(PlayerInfo[playerid][pJob] == 10) {
if(CP[playerid] == 50) { }
else { SendClientMessage(playerid, COLOR_ERRORTEXT, "*** Ich muss erst den Dienst anfange. (/Ernten) Damit ich den Motor startetn kann!"); return 1; } }
else { SendClientMessage(playerid, COLOR_ERRORTEXT, "*** Ich habe keinen Schlüssel für das Fahrzeug!"); return 1; }
}}
for(new SlotID = 0; SlotID < sizeof(RentSystemInfo); SlotID++) {
if(vid == RentSystemInfo[SlotID][RSCarID]) {
if(RentSystemInfo[SlotID][RSRenterID] == playerid) { }
else { SendClientMessage(playerid, COLOR_ERRORTEXT, "*** Ich habe keinen Schlüssel für das Fahrzeug!"); return 1; }
}}
for(new car = 0; car < sizeof(KorierVans); car++) {
if(vid == KorierVans[car][KRVehicle]) {
if(KorierVans[car][KRMieterID] == playerid) { }
else {
if(PlayerInfo[playerid][pJob] == 19) { SendClientMessage(playerid, COLOR_GRAD4, "*** Ich muss das Fahrzeug erst Mieten(/Reservecar)"); }
else { SendClientMessage(playerid, COLOR_ERRORTEXT, " *** Ich habe keinen Schlüssel für das Fahrzeug!"); }
return 1;
}}}
for(new car = 0; car < sizeof(MulmanInfo); car++){
if(vid == MulmanInfo[car][MmCarID]){
if(MulmanInfo[car][MmLeiher] != playerid){
if(PlayerInfo[playerid][pJob] == 20) { SendClientMessage(playerid, COLOR_GRAD4, "*** Ich muss das Fahrzeug erst Mieten(/Reservecar)"); }
else { SendClientMessage(playerid, COLOR_ERRORTEXT, "*** Ich habe keinen Schlüssel für das Fahrzeug!"); }
return 1;
}}}
for(new van = 0; van < 20; van++) {
if(HackerVans[van][Aktive] == 1){
if(vid == HackerVans[van][Vehicle]) {
if(HackerVans[van][MieterID] == playerid) { }
else { SendClientMessage(playerid, COLOR_ERRORTEXT, "*** Ich habe keinen Schlüssel für das Fahrzeug!"); return 1;
}}}}
if(Maske[playerid] == 0) { format(string, sizeof(string), "* %s startet den Motor",sendername); SetPlayerChatBubble(playerid, string, COLOR_PURPLE, 30.0, 2000); }
else { SetPlayerChatBubble(playerid, "* jemand startet einen Motor", COLOR_PURPLE, 30.0, 2000); }
SetTimerEx("StartEngineSleep",1300,0,"i",playerid); SendClientMessage(playerid,COLOR_GRAD2," Motor wird gestartet.");
format(string,sizeof(string),"%s macht de motor an/aus.", sendername);
EnterToLog("motor",string);
if(SpawnKillAktiv[playerid] == 1) { SpawnSkillSchutz(playerid);}
}
else { SendClientMessage(playerid,COLOR_GRAD2," Tank leer..."); return 1; }
}
}
return 1;
}
und hier das mit der Taste [N]
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == 16 && GetPlayerState(playerid == PLAYER_STATE_ONFOOT))
{
for(new i = 0; i < sizeof(SprunkSystemInfo); i++){
if(PlayerToPoint(1.2,playerid,SprunkSystemInfo[i][SSX],SprunkSystemInfo[i][SSY],SprunkSystemInfo[i][SSZ])){
if(PlayerInfo[playerid][pCash] >= 1){
SetPlayerFacingAngle(playerid, SprunkSystemInfo[i][SSRotZ]);
TogglePlayerControllable(playerid,0);
ApplyAnimation(playerid,"VENDING","VEND_Use",3.0,0,0,0,0,0); //sprunk machine animation
PlayerPlaySound(playerid,42600,0,0,0); //sprunk machine noise - NOT SUPPORTED IN SA:MP
GivePlayerMoneys(playerid,-250);
SetTimerEx("SprunkAnimEat", 1800, 0, "i", playerid);
break;
}
else
{
PlayerPlaySound(playerid,1053,0,0,0); //rejected money sound - works!
}}}}
if(!gPlayerUsingLoopingAnim[playerid]) return;
if(IsKeyJustDown(KEY_SPRINT,newkeys,oldkeys))
{
StopLoopingAnim(playerid);
TextDrawHideForPlayer(playerid, TextAnimation);
}
if(newkeys == KEY_NO)
{
if(IsPlayerConnected(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
OnPlayerCommandText(playerid, "/engine");
}
}
}
}
aber wenn ich auf N Drücke startet er nicht den motor why klappt das nicht?