11.06.2011, 17:42
I got wired problem.
I created teams and team cars. The team cars doesnt kick player out of it if hes on wroong team.
Script:
I created teams and team cars. The team cars doesnt kick player out of it if hes on wroong team.
Script:
Код:
enum TeamCars { Bank, Police } new Cars[TeamCars]; #define BANK 0 #define POLICE 1 #define BANK_COLOUR 0x00820FAA #define POLICE_COLOUR 0x003DF5AA new gTeam[MAX_PLAYERS]; SetPlayerTeamFromClass(playerid, classid) { if(classid == 0) { gTeam[playerid] = BANK; } if(classid == 1) { gTeam[playerid] = BANK; } if(classid == 2) { gTeam[playerid] = POLICE; } } SetPlayerToTeamColour(playerid) { if(gTeam[playerid] == BANK) { SetPlayerColor(playerid,BANK_COLOUR); //Green } if(gTeam[playerid] == POLICE) { SetPlayerColor(playerid,POLICE_COLOUR); // Blue } } public OnGameModeInit() { AddPlayerClass(163,-817.0843,1514.4772,20.3744,92.4108,0,0,0,0,0,0); //BANK AddPlayerClass(164,-817.0843,1514.4772,20.3744,92.4108,0,0,0,0,0,0); //BANK AddPlayerClass(280,-1388.9767,2624.5515,55.9844,74.2934,0,0,0,0,0,0); //Police Officer /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// //Police // Cars[Police] = AddStaticVehicle(497,-1406.1665,2669.4944,58.2696,92.2791,94,72); //Police Maverick Cars[Police] = AddStaticVehicle(597,-1400.0337,2653.1772,55.4573,90.1835,94,72); //Police Cars[Police] = AddStaticVehicle(597,-1400.0476,2646.9023,55.4553,88.7202,94,72); //Police Cars[Police] = AddStaticVehicle(597,-1399.7706,2640.5942,55.4570,89.7243,94,72); //Police Cars[Police] = AddStaticVehicle(599,-1400.1295,2634.4502,55.9129,90.3322,94,72); //Police Cars[Police] = AddStaticVehicle(599,-1400.0939,2628.7153,55.9641,89.5174,94,72); //Police Cars[Bank] = AddStaticVehicle(428,-820.8925,1518.1023,20.5814,180.7465,90,4); //Bank return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerTeamFromClass(playerid, classid); return 1; } public OnPlayerSpawn(playerid) { SetPlayerToTeamColour(playerid); return 1; } public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == 2) { new CarCheck = GetPlayerVehicleID(playerid); if(CarCheck == Cars[Bank] ) { if(gTeam[playerid] != BANK) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "You are not Security Man!"); return 1; } } if(CarCheck == Cars[Police] ) { if(gTeam[playerid] != POLICE) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "You are not Police Officer!"); return 1; } } return 1; } return 1; }