CMD:mdc(playerid, params[]) { if(eingeloggt[playerid] == 0)return SendClientMessage(playerid,COLOR_RED,"Du bist noch nicht eingeloggt."); if(pInfo[playerid][fraktion] != 1)return SendClientMessage(playerid,COLOR_RED,"Du bist kein Mitglied vom SFPD."); if(pInfo[playerid][fraktion] == 1 && pInfo[playerid][duty] != 1)return SendClientMessage(playerid,COLOR_RED,"Du bist nicht im Dienst."); for(new i=0; i<sizeof(sfpdcars); i++) if(GetPlayerVehicleID(playerid) == sfpdcars[i]) { return ShowPlayerDialog(playerid,MDCDIALOG1,DIALOG_STYLE_INPUT,"SAPD - Mobile Data Computer","Gebe das MDC Passwort ein.","Okay","Abbrechen"); } else { return SendClientMessage(playerid,COLOR_RED,"Du sitzt in keinem PD Fahrzeug."); } return 1; }
CMD:mdc(playerid, params[]) { if(eingeloggt[playerid] == 0)return SendClientMessage(playerid,COLOR_RED,"Du bist noch nicht eingeloggt."); if(pInfo[playerid][fraktion] != 1)return SendClientMessage(playerid,COLOR_RED,"Du bist kein Mitglied vom SFPD."); if(pInfo[playerid][fraktion] == 1 && pInfo[playerid][duty] != 1)return SendClientMessage(playerid,COLOR_RED,"Du bist nicht im Dienst."); for(new i=0; i<sizeof(sfpdcars); i++) { if(GetPlayerVehicleID(playerid) == sfpdcars[i]) { return ShowPlayerDialog(playerid,MDCDIALOG1,DIALOG_STYLE_INPUT,"SAPD - Mobile Data Computer","Gebe das MDC Passwort ein.","Okay","Abbrechen"); } } SendClientMessage(playerid,COLOR_RED,"Du sitzt in keinem PD Fahrzeug."); return 1; }
sfpdcars[0] = CreateVehicle(597, -1599.9693, 677.0426, -5.4322, 0.0000, 0, 1, -1); //Police Car (SFPD) sfpdcars[1] = CreateVehicle(597, -1596.0677, 676.9625, -5.4322, 0.0000, 0, 1, -1); //Police Car (SFPD) sfpdcars[2] = CreateVehicle(597, -1596.1678, 692.9227, -5.4322, 0.0000, 0, 1, -1); //Police Car (SFPD) sfpdcars[3] = CreateVehicle(597, -1600.1787, 692.9227, -5.4322, 0.0000, 0, 1, -1); //Police Car (SFPD) sfpdcars[4] = CreateVehicle(597, -1604.2593, 692.9227, -5.4322, 0.0000, 0, 1, -1); //Police Car (SFPD) sfpdcars[5] = CreateVehicle(597, -1608.4194, 692.9227, -5.4322, 0.0000, 0, 1, -1); //Police Car (SFPD) sfpdcars[6] = CreateVehicle(597, -1612.4881, 692.9227, -5.4322, 0.0000, 0, 1, -1); //Police Car (SFPD) sfpdcars[7] = CreateVehicle(597, -1616.6889, 692.9227, -5.4322, 0.0000, 0, 1, -1); //Police Car (SFPD) for(new i=0; i<sizeof(sfpdcars); i++) { SetVehicleNumberPlate(sfpdcars[i],"SFPD"); }
<sizeof(sfpdcars);
for(new i=0; i < 9; i++)
This is your problem:
PHP код:
What you want to do is this: PHP код:
|
<sizeof(sfpdcars);
CMD:mdc(playerid, params[]) { if(eingeloggt[playerid] == 0)return SendClientMessage(playerid,COLOR_RED,"Du bist noch nicht eingeloggt."); if(pInfo[playerid][fraktion] != 1)return SendClientMessage(playerid,COLOR_RED,"Du bist kein Mitglied vom SFPD."); if(pInfo[playerid][fraktion] == 1 && pInfo[playerid][duty] != 1)return SendClientMessage(playerid,COLOR_RED,"Du bist nicht im Dienst."); for(new i=0; i <sizeof(sfpdcars); i++) { if(!IsPlayerInAnyVehicle(playerid))continue; if(GetPlayerVehicleID(playerid) != sfpdcars[i])continue; if(i == sizeof(sfpdcars))continue; ShowPlayerDialog(playerid,MDCDIALOG1,DIALOG_STYLE_INPUT,"SAPD - Mobile Data Computer","Gebe das MDC Passwort ein.","Okay","Abbrechen"); } return 1; }
IsAPoliceVehicle(vehicleid) { for(new i = 0; i < sizeof(sfpdcars); i++) { if(vehicleid == sfpdcars[i]) return true; } return false; }
if(IsAPoliceVehicle(GetPlayerVehicleID(playerid))) { ShowPlayerDialog(playerid,MDCDIALOG1,DIALOG_STYLE_INPUT,"SAPD - Mobile Data Computer","Gebe das MDC Passwort ein.","Okay","Abbrechen"); } else { SendClientMessage(playerid,COLOR_RED,"Du sitzt in keinem PD Fahrzeug."); }
You could also write a function like
Код:
IsAPoliceVehicle(vehicleid) { for(new i = 0; i < sizeof(sfpdcars); i++) { if(vehicleid == sfpdcars[i]) return true; } return false; } Код:
if(IsAPoliceVehicle(GetPlayerVehicleID(playerid))) { ShowPlayerDialog(playerid,MDCDIALOG1,DIALOG_STYLE_INPUT,"SAPD - Mobile Data Computer","Gebe das MDC Passwort ein.","Okay","Abbrechen"); } else { SendClientMessage(playerid,COLOR_RED,"Du sitzt in keinem PD Fahrzeug."); } |