26.07.2010, 15:22
Quote:
Please respond, I tried to make an Admin team for CnR
Here's the script. Код:
#include <a_samp> #define ADMINS 99 #define ADMINS_COLOR 0xFF00FFAA //Purple #define COLOR_RED 0xFF0000AA //RED enum TeamCars { ADMINS } new gTeam[MAX_PLAYERS]; new Cars[TeamCars]; public OnGameModeInit() { AddPlayerClass(163,2127.6602,2377.6648,10.8203,182.7401,0,0,0,0,0,0); AddPlayerClass(164,2127.6602,2377.6648,10.8203,182.7401,0,0,0,0,0,0); Cars[ADMINS] = CreateVehicle(522,2091.4963,2361.1116,10.8058,183.7787,85,0,1000); // Cars[ADMINS] = CreateVehicle(522,2093.6804,2360.7153,10.8131,180.7032,85,0,1000); // Cars[ADMINS] = CreateVehicle(522,2095.8301,2361.1843,10.8129,177.7382,85,0,1000); // Cars[ADMINS] = CreateVehicle(522,2098.3806,2361.2388,10.8129,177.9737,85,0,1000); // return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerTeamFromClass(playerid, classid); return 1; } public OnPlayerSpawn(playerid) { SetPlayerToTeamColour(playerid); return 1; } SetPlayerTeamFromClass(playerid, classid) { if(classid == 99) { gTeam[playerid] = ADMINS; } } SetPlayerToTeamColour(playerid) { if(gTeam[playerid] == ADMINS) { SetPlayerColor(playerid,ADMINS_COLOR); //Purple } } public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == 2) { new CarCheck = GetPlayerVehicleID(playerid); if(CarCheck == Cars[ADMINS] ) { if(gTeam[playerid] != 99) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "You can't drive this car!"); return 1; } } return 1; } return 1; } |
Код:
enum TeamCars { ADMIN }
Here's the full code with those changed:
Код:
#include <a_samp> #define ADMINS 99 #define ADMINS_COLOR 0xFF00FFAA //Purple #define COLOR_RED 0xFF0000AA //RED enum TeamCars { ADMIN } new gTeam[MAX_PLAYERS]; new Cars[TeamCars]; public OnGameModeInit() { AddPlayerClass(163,2127.6602,2377.6648,10.8203,182.7401,0,0,0,0,0,0); AddPlayerClass(164,2127.6602,2377.6648,10.8203,182.7401,0,0,0,0,0,0); Cars[ADMIN] = CreateVehicle(522,2091.4963,2361.1116,10.8058,183.7787,85,0,1000); // Cars[ADMIN] = CreateVehicle(522,2093.6804,2360.7153,10.8131,180.7032,85,0,1000); // Cars[ADMIN] = CreateVehicle(522,2095.8301,2361.1843,10.8129,177.7382,85,0,1000); // Cars[ADMIN] = CreateVehicle(522,2098.3806,2361.2388,10.8129,177.9737,85,0,1000); // return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerTeamFromClass(playerid, classid); return 1; } public OnPlayerSpawn(playerid) { SetPlayerToTeamColour(playerid); return 1; } SetPlayerTeamFromClass(playerid, classid) { if(classid == 99) { gTeam[playerid] = ADMINS; } } SetPlayerToTeamColour(playerid) { if(gTeam[playerid] == ADMINS) { SetPlayerColor(playerid,ADMINS_COLOR); //Purple } } public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == 2) { new CarCheck = GetPlayerVehicleID(playerid); if(CarCheck == Cars[ADMIN] ) { if(gTeam[playerid] != 99) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_RED, "You can't drive this car!"); return 1; } } return 1; } return 1; }