#include //------------------------------------------------------------------------------ #define TEAM_BLUE 0 #define TEAM_GREEN 1 //------------------------------------------------------------------------------ new gTeam[MAX_PLAYERS]; new gPlayerClass[MAX_PLAYERS]; new PlayerLoggedIn[MAX_PLAYERS]; //------------------------------------------------------------------------------ #define COLOR_GREY 0xAFAFAFAA #define COLOR_ADMIN 0xD0D0FFAA #define COLOR_IMPORTANT 0xFF0000AA #define COLOR_BROADCAST 0x0066CCAA #define COLOR_PERSONAL 0x8080FFAA #define COLOR_GREEN 0x33AA33AA #define COLOR_BLUE 0x352CEBFF //------------------------------------------------------------------------------ #define BAT 5 #define SAWEDOFF 26 #define M4 31 //------------------------------------------------------------------------------ #define NRG500 522 main() { print("\n----------------------------------"); print(" System Logowania & Basic TDM"); print("----------------------------------\n"); } public OnGameModeInit() { // Don't use these lines if it's a filterscript SetGameModeText("Basic TDM & admin system"); UsePlayerPedAnims(); ShowPlayerMarkers(1); ShowNameTags(1); AddStaticVehicle(NRG500,2409.5420,-1651.2783,13.0725,274.7751,-1,-1); AddStaticVehicle(NRG500,2423.6235,-1647.0985,13.0947,179.8473,-1,-1); AddStaticVehicle(NRG500,2523.2610,-1669.5527,14.5625,89.0356,-1,-1); AddStaticVehicle(NRG500,2508.2864,-1679.5383,13.1118,136.4631,-1,-1); AddPlayerClass(102,2413.7192,-1647.8033,13.7500,175.6881,BAT,-1,SAWEDOFF,999999,M4,999999); //Blue AddPlayerClass(106,2521.1357,-1679.2052,15.3045,90.3473,BAT,-1,SAWEDOFF,999999,M4,999999); //Green return 1; } public OnPlayerConnect(playerid) { new string[128], pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); format(string, sizeof(string), "*** %s has joined the server.", pname); SendClientMessageToAll(COLOR_GREY, string); } public OnPlayerDisconnect(playerid, reason) { if(reason==0){ new string[128], pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); format(string, sizeof(string), "*** %s left the server. (Timeout)", pname); SendClientMessageToAll(COLOR_GREY, string); }else if(reason==1){ new string[128], pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); format(string, sizeof(string), "*** %s left the server. (Leaving)", pname); SendClientMessageToAll(COLOR_GREY, string); }else if(reason==2){ new string[128], pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); format(string, sizeof(string), "*** %s left the server. (Kicked)", pname); SendClientMessageToAll(COLOR_GREY, string); } return 1; } SetPlayerTeamFromClass(playerid, classid) { if(classid == 0) { gTeam[playerid] = TEAM_BLUE; } else if(classid == 1) { gTeam[playerid] = TEAM_GREEN; } return 1; } SetupPlayerForClassSelection(playerid) { SetPlayerInterior(playerid,14); SetPlayerPos(playerid,258.4893,-41.4008,1002.0234); SetPlayerFacingAngle(playerid, 270.0); SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234); SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234); return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerTeamFromClass(playerid, classid); SetupPlayerForClassSelection(playerid); gPlayerClass[playerid] = classid; switch (classid) { case 0: { GameTextForPlayer(playerid, "~b~Blue ~w~team", 3000, 6); ApplyAnimation(playerid,"PED", "WALK_DRUNK",4.0,0,1,0,0,0); } case 1: { GameTextForPlayer(playerid, "~g~green ~w~team", 3000, 6); ApplyAnimation(playerid,"PED", "WALK_DRUNK",4.0,0,1,0,0,0); } } return 1; } public OnPlayerSpawn(playerid) { SetCameraBehindPlayer(playerid); SetPlayerInterior(playerid,0); if(gTeam[playerid]==TEAM_BLUE){ SetPlayerColor(playerid,COLOR_BLUE); } if(gTeam[playerid]==TEAM_GREEN){ SetPlayerColor(playerid,COLOR_GREEN); } return 1; } public OnPlayerDeath(playerid, killerid, reason) { if(killerid == INVALID_PLAYER_ID) { SendDeathMessage(INVALID_PLAYER_ID,playerid,reason); } else { if(gTeam[killerid] != gTeam[playerid]) { SendDeathMessage(killerid,playerid,reason); SetPlayerScore(killerid,GetPlayerScore(killerid)+1); GivePlayerMoney(killerid, 1000); } else { new warning[256]; format(warning, sizeof(warning), "Be careful! You have been punished for teamkilling."); SendClientMessage(killerid, 0xFFFF00AA, warning); SendDeathMessage(killerid,playerid,reason); GivePlayerMoney(killerid, -1000); SetPlayerScore(killerid, GetPlayerScore(killerid) - 1); } } return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[256],idx; cmd = strtok(cmdtext,idx); if(strcmp(cmdtext, "/kill", true) == 0) { SetPlayerHealth(playerid,0.0); return 1; } if(strcmp(cmd, "/report", true, 7) == 0) { SendClientMessage(playerid,COLOR_PERSONAL,"Thank you for report."); new str[256]; new pname[256]; GetPlayerName(playerid, pname, 256); format(str, 256, "Report from: %s, about:%s", pname, cmdtext[7]); for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)==1 && PlayerLoggedIn[i]==1){ SendClientMessage(i,COLOR_PERSONAL, str); } } return 1; } if(strcmp(cmdtext,"/admins",true)==0) { new output[256]; for (new i=0 ; i ' ') && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; return result; } IsNumeric(string[]) { if(strlen(string)==0) { return 0; } for(new n=0;n'9') { return 0; } } return 1; } idmatch(playerid,string[]) { new id=-1; if(strlen(string)==0) { SendClientMessage(playerid,COLOR_PERSONAL,"Input an ID/name!"); return -1; } else { new matches=0; if(IsNumeric(string)==1) { new nid=strval(string); if(IsPlayerConnected(nid)) { return nid; } } for(new n=0;n1) { new output[256]; format(output,sizeof(output),"There were %d matches found for \"%s\" - aborting.",matches,string); SendClientMessage(playerid,COLOR_PERSONAL,output); return -1; } else if(matches==0) { new output[256]; format(output,sizeof(output),"There were no matches found for \"%s\" - aborting.",string); SendClientMessage(playerid,COLOR_PERSONAL,output); return -1; } } return id; }