15.04.2018, 08:57
Quote:
There's a simple way to deal with it. You can create an array of siren-only vehicles and check if it is in the list.
On my server, I used to check whether some skin I chose is faction only. That's how it looked like: Код:
new DoCSkins[] = { 70, 71, 74, 280, 281, 282, 288, 284, 285, 283, 265, 266, 267, 274, 275, 276, 277, 278, 300, 301, 302, 306, 307, 308, 309, 310, 311, 279 }; ... stock IsDoCSkin(id) { for(new i = 0; i < sizeof(DoCSkins); i++) { if(id == DoCSkins[i]) return 1; } return 0; } Код:
if(IsDoCSkin(modelid)) { //Do your actions here } P.S. This array is defined globally, don't initialise it in some functions or whatever. P.P.S. imo this approach is comfortable since it simply requires you to add newly picked vehicles/skins/whatever you use it with into the array to then do the same check which requires no changes in its code. |
Код:
IsAUndercoverVehicle(vehicleid) { new vModel = GetVehicleModel(vehicleid); for(new i = 0; i < sizeof(UCAutos); i++) { if(vModel == UCAutos[i]) return true; } return false; }
Код:
if(!IsAUndercoverVehicle(vID))return SendClientMessage(playerid,COLOR_RED,"Du sitzt in keinem PD Premier/Sultan/Cheetah/Securicar");
Код:
new UCAutos[] = { 428, 415, 560, 426 };