enum TeamCars {
Y[13],
N[20],
M[17],
T[11]
}
for(new i=0; i<sizeof(Y); i++)
{
if(CarCheck == Cars[[Y[i]])
{
if(ZaidejoKomanda[playerid] != 1)
{
RemovePlayerFromVehicle(playerid);
SukurtiDialog(playerid, 5, DIALOG_STYLE_MSGBOX,"Yakuza", "Рis automobilis priklauso Yakuza.", "Gerai", "Uюdaryti");
return 1;
}
}
}
public OnPlayerStateChange(playerid, newstate, oldstate) { /// another shit // CARS if(newstate == 2) { new CarCheck = GetPlayerVehicleID(playerid); else if(CarCheck == NostraMasinos[1] >= NostraMasinos[16]) { if(ZaidejoKomanda[playerid] != 2) { RemovePlayerFromVehicle(playerid); SukurtiDialog(playerid, 5, DIALOG_STYLE_MSGBOX,"La Cosa Nostra", "Рis automobilis priklauso La Cosa Nostra.", "Gerai", "Uюdaryti"); return 1; } } else if(CarCheck == PolicijosMasinos[1] >= PolicijosMasinos[17]) { if(ZaidejoKomanda[playerid] != 3) { RemovePlayerFromVehicle(playerid); SukurtiDialog(playerid, 5, DIALOG_STYLE_MSGBOX,"Policijos Departamentas", "Рis automobilis priklauso Policijos Departamentui", "Gerai", "Uюdaryti"); return 1; } } else if(CarCheck == YakuzaMasinos[1] >= YakuzaMasinos[11]) { if(ZaidejoKomanda[playerid] != 1) { RemovePlayerFromVehicle(playerid); SukurtiDialog(playerid, 5, DIALOG_STYLE_MSGBOX,"Yakuza", "Рis automobilis priklauso Yakuza.", "Gerai", "Uюdaryti"); return 1; } } else if(CarCheck == TriadsMasinos[1] >= TriadsMasinos[9]) { if(ZaidejoKomanda[playerid] != 4) { RemovePlayerFromVehicle(playerid); SukurtiDialog(playerid, 5, DIALOG_STYLE_MSGBOX,"Triads", "Рis automobilis priklauso Triads.", "Gerai", "Uюdaryti"); return 1; } } else if(CarCheck == YakuzaMasinos[12] || CarCheck == YakuzaMasinos[13]) { if(GetPlayerScore(playerid) < 5000 && ZaidejoInformacija[playerid][Licenzija] > 0 || ZaidejoInformacija[playerid][Administratorius] < 1 || ZaidejoInformacija[playerid][VIP] < 1) { SukurtiDialog(playerid, 5, DIALOG_STYLE_MSGBOX,"Yakuza", "Jыs neturite pakankamai,\nPatirties taрkш valdyti рб tankа. (XP < 5000)", "Gerai", "Uюdaryti"); RemovePlayerFromVehicle(playerid); return 1; } if(ZaidejoKomanda[playerid] != 1) { RemovePlayerFromVehicle(playerid); SukurtiDialog(playerid, 5, DIALOG_STYLE_MSGBOX,"Yakuza", "Рis naikintuvas priklauso Yakuza.", "Gerai", "Uюdaryti"); return 1; } } else if(CarCheck == NostraMasinos[17] || NostraMasinos[18] || NostraMasinos[19] || NostraMasinos[20]) { if(GetPlayerScore(playerid) < 3500 && ZaidejoInformacija[playerid][Licenzija] > 0 || ZaidejoInformacija[playerid][Administratorius] < 1 || ZaidejoInformacija[playerid][VIP] < 1) { SukurtiDialog(playerid, 5, DIALOG_STYLE_MSGBOX,"La Cosa Nostra", "Jыs neturite pakankamai,\nPatirties taрkш valdyti рб tankа.\n(XP < 3500)", "Gerai", "Uюdaryti"); RemovePlayerFromVehicle(playerid); return 1; } if(ZaidejoKomanda[playerid] != 2) { RemovePlayerFromVehicle(playerid); SukurtiDialog(playerid, 5, DIALOG_STYLE_MSGBOX,"La Cosa Nostra", "Рis naikintuvas/tankas priklauso La Cosa Nostra.", "Gerai", "Uюdaryti"); return 1; } } else if(CarCheck == TriadsMasinos[10] || CarCheck == TriadsMasinos[10]) { if(GetPlayerScore(playerid) < 5000 && ZaidejoInformacija[playerid][Licenzija] > 0 || ZaidejoInformacija[playerid][Administratorius] < 1 || ZaidejoInformacija[playerid][VIP] < 1) { SukurtiDialog(playerid, 5, DIALOG_STYLE_MSGBOX,"Triads", "Jыs neturite pakankamai,\nPatirties taрkш valdyti рб tankа. (XP < 5000)", "Gerai", "Uюdaryti"); RemovePlayerFromVehicle(playerid); return 1; } if(ZaidejoKomanda[playerid] != 4) { RemovePlayerFromVehicle(playerid); SukurtiDialog(playerid, 5, DIALOG_STYLE_MSGBOX,"Triads", "Рis lлktuvas/tankas priklauso Triads.", "Gerai", "Uюdaryti"); return 1; } } } return 1; }
You can put arrays in the enum instead of lots of single variables:
pawn Код:
variable[Y][2]; |
pWeapon1,
pAmmo1,
pWeapon2,
pAmmo2,
pWeapon3,
pAmmo3,
pWeapon4,
pAmmo4,
pWeapon5,
pAmmo5,
pWeapon6,
pAmmo6,
pWeapon7,
pAmmo7,
pWeapon8,
pAmmo8,
pWeapon9,
pAmmo9,
pWeapon10,
pAmmo10,
pWeapon11,
pAmmo11,
pWeapon12,
pAmmo12,
I feel like a newbie. (lol) I should probably make this into an array, right?
pawn Код:
|
Yep, you can make it one or two arrays: pWeapon[12]/pAmmo[12] or pWeaponData[12][2]. It is also very useful when storing the data. Instead of doing it line by line, you can use GetPlayerWeaponData in a loop (i=array index=weapon slot)
|