Hallo Breadfish ;),
Ich habe ein Problem bei OnPlayerStateChange, unzwar wenn ich z.B. den Job straßenreiniger hab und in einen Bus einsteige werde ich eigentlich rausgeschmissen und dort steht halt du hast kein Schlüssel für dieses Fahrzeug. Das kommt halt nicht. Hier mal mein OnPlayerStateChange:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
SetPlayerArmedWeapon(playerid,0);
for(new i = 0; i < sizeof Buycars; i++)
{
if(vehicleid == kaufauto[i])
{
new str[150];
format(str,sizeof(str),"Möchten Sie dieses Fahrzeug kaufen?\n\nName: %s\nPreis: %d", Buycars[i][Name], Buycars[i][Preis]);
FreezePlayer(playerid);
return ShowPlayerDialog(playerid,Dialog_Buycar,DIALOG_STYLE_MSGBOX,"Autokauf",str,"Kaufen","Abbrechen");
}
}
if(IsACopCar(vehicleid))
{
if(IsACop(playerid)) { }
else
{
GameTextForPlayer(playerid,"~y~~h~Du hast keinen Schluessel fuer~n~~y~~h~ dieses Auto!", 3500, 1);
RemovePlayerFromVehicle(playerid);
}
}
if(IsAMedicCar(vehicleid))
{
if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2) { }
else
{
GameTextForPlayer(playerid,"~y~~h~Du hast keinen Schluessel fuer~n~~y~~h~ dieses Auto!", 3500, 1);
RemovePlayerFromVehicle(playerid);
}
}
if(IsAFeuerwehrCar(vehicleid))
{
if(PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10) { }
else
{
GameTextForPlayer(playerid,"~y~~h~Du hast keinen Schluessel fuer~n~~y~~h~ dieses Auto!", 3500, 1);
RemovePlayerFromVehicle(playerid);
}
}
if(IsAHitCar(vehicleid))
{
if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8) { }
else
{
GameTextForPlayer(playerid,"~y~~h~Du hast keinen Schluessel fuer~n~~y~~h~ dieses Auto!", 3500, 1);
RemovePlayerFromVehicle(playerid);
}
}
if(IsAYakuzaCar(vehicleid))
{
if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pLeader] == 7) { }
else
{
GameTextForPlayer(playerid,"~y~~h~Du hast keinen Schluessel fuer~n~~y~~h~ dieses Auto!", 3500, 1);
RemovePlayerFromVehicle(playerid);
}
}
if(IsAGroveCar(vehicleid))
{
if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5) { }
else
{
GameTextForPlayer(playerid,"~y~~h~Du hast keinen Schluessel fuer~n~~y~~h~ dieses Auto!", 3500, 1);
RemovePlayerFromVehicle(playerid);
}
}
if(IsAHitCar(vehicleid))
{
if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8) { }
else
{
GameTextForPlayer(playerid,"~y~~h~Du hast keinen Schluessel fuer~n~~y~~h~ dieses Auto!", 3500, 1);
RemovePlayerFromVehicle(playerid);
}
}
if(IsANewsCar(vehicleid))
{
if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4) { }
else
{
GameTextForPlayer(playerid,"~y~~h~Du hast keinen Schluessel fuer~n~~y~~h~ dieses Auto!", 3500, 1);
RemovePlayerFromVehicle(playerid);
}
}
if(IsAOamtCar(vehicleid))
{
if(PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9) { }
else
{
GameTextForPlayer(playerid,"~y~~h~Du hast keinen Schluessel fuer~n~~y~~h~ dieses Auto!", 3500, 1);
RemovePlayerFromVehicle(playerid);
}
}
if(IsABus(vehicleid))
{
if(PlayerInfo[playerid][pJob] == 1) { FreezePlayer(playerid); SendClientMessage(playerid,COLOR_YELLOW,"Tippe '/startejob' um deinen Job zu starten."); }
else
{
GameTextForPlayer(playerid,"~y~~h~Du hast keinen Schluessel fuer~n~~y~~h~ dieses Auto!", 3500, 1);
RemovePlayerFromVehicle(playerid);
}
}
if(IsASweeper(vehicleid))
{
if(PlayerInfo[playerid][pJob] == 2) { FreezePlayer(playerid); SendClientMessage(playerid,COLOR_YELLOW,"Tippe '/startejob' um deinen Job zu starten."); }
else
{
GameTextForPlayer(playerid,"~y~~h~Du hast keinen Schluessel fuer~n~~y~~h~ dieses Auto!", 3500, 1);
RemovePlayerFromVehicle(playerid);
}
}
if(IsAMechanikCar(vehicleid))
{
if(PlayerInfo[playerid][pJob] == 3) { }
else
{
GameTextForPlayer(playerid,"~y~~h~Du hast keinen Schluessel fuer~n~~y~~h~ dieses Auto!", 3500, 1);
RemovePlayerFromVehicle(playerid);
}
}
if(IsAFarmCar(vehicleid))
{
if(PlayerInfo[playerid][pJob] == 4) { }
else
{
GameTextForPlayer(playerid,"~y~~h~Du hast keinen Schluessel fuer~n~~y~~h~ dieses Auto!", 3500, 1);
RemovePlayerFromVehicle(playerid);
}
}
if(IsPlayerInFrac(playerid,9))
{
if(IsAOamtCar(vehicleid))
{
SendClientMessage(playerid,COLOR_YELLOW,"Benutze STRG um Autos abzuschleppen.");
}
}
}
if(newstate == PLAYER_STATE_PASSENGER)
{
if(GetPlayerWeapon(playerid) == 24 )
{
SetPlayerArmedWeapon(playerid, 0);
}
}
return 1;
}
Wenn ihr noch was anderes benötigt dann schreibt einfach
Danke schonmal im vorraus