SHOW:
|
|
- or go back to the newest paste.
| 1 | #include <a_samp> | |
| 2 | ||
| 3 | // Defines | |
| 4 | #define MAX_SAVE 70 | |
| 5 | - | #define MAX_CLANS 70 |
| 5 | + | #define MAX_CLANS 70 |
| 6 | - | #define MAX_CLAN_MEMBERS 20 |
| 6 | + | #define MAX_CLAN_MEMBERS 20 |
| 7 | - | #define MAX_CLAN_NAME 16 |
| 7 | + | #define MAX_CLAN_NAME 16 |
| 8 | ||
| 9 | // Color Defines | |
| 10 | #define COLOR_ORANGE 0xF97804FF | |
| 11 | #define COLOR_WHITE 0xFFFFFFAA | |
| 12 | #define COLOR_YELLOW 0xDABB3EAA | |
| 13 | #define COLOR_GREEN 0x21DD00FF | |
| 14 | #define COLOR_PINK 0xFFC0CBAA | |
| 15 | #define COLOR_BLACK 0x000000FF | |
| 16 | #define COLOR_RED 0xE60000FF | |
| 17 | ||
| 18 | // Variables | |
| 19 | new clanMembers[MAX_CLANS][MAX_CLAN_MEMBERS]; | |
| 20 | new clanNames[MAX_CLANS][MAX_CLAN_NAME]; | |
| 21 | new clanInfo[MAX_CLANS][3]; //0 created 1-members 2 color | |
| 22 | new playerclan[MAX_PLAYERS]; | |
| 23 | new clanInvite[MAX_PLAYERS]; | |
| 24 | new playerColors[100] = {
| |
| 25 | 0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF,0x6495EDFF,0xf0e68cFF,0x778899FF,0xFF1493FF,0xF4A460FF,0xEE82EEFF,0xFFD720FF, | |
| 26 | 0x8b4513FF,0x4949A0FF,0x148b8bFF,0x14ff7fFF,0x556b2fFF,0x0FD9FAFF,0x10DC29FF,0x534081FF,0x0495CDFF,0xEF6CE8FF,0xBD34DAFF, | |
| 27 | 0x247C1BFF,0x0C8E5DFF,0x635B03FF,0xCB7ED3FF,0x65ADEBFF,0x5C1ACCFF,0xF2F853FF,0x11F891FF,0x7B39AAFF,0x53EB10FF,0x54137DFF, | |
| 28 | 0x275222FF,0xF09F5BFF,0x3D0A4FFF,0x22F767FF,0xD63034FF,0x9A6980FF,0xDFB935FF,0x3793FAFF,0x90239DFF,0xE9AB2FFF,0xAF2FF3FF, | |
| 29 | 0x057F94FF,0xB98519FF,0x388EEAFF,0x028151FF,0xA55043FF,0x0DE018FF,0x93AB1CFF,0x95BAF0FF,0x369976FF,0x18F71FFF,0x4B8987FF, | |
| 30 | 0x491B9EFF,0x829DC7FF,0xBCE635FF,0xCEA6DFFF,0x20D4ADFF,0x2D74FDFF,0x3C1C0DFF,0x12D6D4FF,0x48C000FF,0x2A51E2FF,0xE3AC12FF, | |
| 31 | 0xFC42A8FF,0x2FC827FF,0x1A30BFFF,0xB740C2FF,0x42ACF5FF,0x2FD9DEFF,0xFAFB71FF,0x05D1CDFF,0xC471BDFF,0x94436EFF,0xC1F7ECFF, | |
| 32 | 0xCE79EEFF,0xBD1EF2FF,0x93B7E4FF,0x3214AAFF,0x184D3BFF,0xAE4B99FF,0x7E49D7FF,0x4C436EFF,0xFA24CCFF,0xCE76BEFF,0xA04E0AFF, | |
| 33 | 0x9F945CFF,0xDCDE3DFF,0x10C9C5FF,0x70524DFF,0x0BE472FF,0x8A2CD7FF,0x6152C2FF,0xCF72A9FF,0xE59338FF,0xEEDC2DFF,0xD8C762FF, | |
| 34 | 0x3FE65CFF | |
| 35 | }; | |
| 36 | ||
| 37 | // Forwards | |
| 38 | forward PlayerLeaveClan(playerid); | |
| 39 | ||
| 40 | public OnFilterScriptInit() | |
| 41 | {
| |
| 42 | - | print("\n--------------------------------------");
|
| 42 | + | print("\n--------------------------------------");
|
| 43 | - | print(" World Wide Gaming Clan System Loaded");
|
| 43 | + | print(" World Wide Gaming Clan System Loaded");
|
| 44 | - | print("--------------------------------------\n");
|
| 44 | + | print("--------------------------------------\n");
|
| 45 | - | return 1; |
| 45 | + | return 1; |
| 46 | } | |
| 47 | ||
| 48 | public OnFilterScriptExit() | |
| 49 | {
| |
| 50 | - | print("\n--------------------------------------");
|
| 50 | + | print("\n--------------------------------------");
|
| 51 | - | print(" World-Wide Gaming Clan System Unloaded");
|
| 51 | + | print(" World-Wide Gaming Clan System Unloaded");
|
| 52 | - | print("--------------------------------------\n");
|
| 52 | + | print("--------------------------------------\n");
|
| 53 | - | return 1; |
| 53 | + | return 1; |
| 54 | } | |
| 55 | ||
| 56 | ||
| 57 | public PlayerLeaveClan(playerid) {
| |
| 58 | - | new string[256]; |
| 58 | + | new string[256]; |
| 59 | - | new playername[MAX_PLAYER_NAME]; |
| 59 | + | new playername[MAX_PLAYER_NAME]; |
| 60 | - | new clannum = playerclan[playerid]; |
| 60 | + | new clannum = playerclan[playerid]; |
| 61 | ||
| 62 | - | if(clannum > 0) {
|
| 62 | + | if(clannum > 0) {
|
| 63 | - | for(new i = 0; i < clanInfo[clannum][1]; i++) {
|
| 63 | + | for(new i = 0; i < clanInfo[clannum][1]; i++) {
|
| 64 | - | if(clanMembers[clannum][i]==playerid) {
|
| 64 | + | if(clanMembers[clannum][i]==playerid) {
|
| 65 | - | clanInfo[clannum][1]--; |
| 65 | + | clanInfo[clannum][1]--; |
| 66 | - | for(new j = i; j < clanInfo[clannum][1]; j++) {
|
| 66 | + | for(new j = i; j < clanInfo[clannum][1]; j++) {
|
| 67 | - | clanMembers[clannum][j]=clanMembers[clannum][j+1]; |
| 67 | + | clanMembers[clannum][j]=clanMembers[clannum][j+1]; |
| 68 | - | } |
| 68 | + | } |
| 69 | - | if(clanInfo[clannum][1]<1) {
|
| 69 | + | if(clanInfo[clannum][1]<1) {
|
| 70 | - | clanInfo[clannum][0]=0; |
| 70 | + | clanInfo[clannum][0]=0; |
| 71 | - | clanInfo[clannum][1]=0; |
| 71 | + | clanInfo[clannum][1]=0; |
| 72 | - | } |
| 72 | + | } |
| 73 | - | for(new j = 0; j < clanInfo[clannum][1]; j++) {
|
| 73 | + | for(new j = 0; j < clanInfo[clannum][1]; j++) {
|
| 74 | - | GetPlayerName(playerid, playername, MAX_PLAYER_NAME); |
| 74 | + | GetPlayerName(playerid, playername, MAX_PLAYER_NAME); |
| 75 | - | format(string, sizeof(string),"%s has quit your clan.", playername); |
| 75 | + | format(string, sizeof(string),"%s has quit your clan.", playername); |
| 76 | - | SendClientMessage(clanMembers[clannum][j], COLOR_ORANGE, string); |
| 76 | + | SendClientMessage(clanMembers[clannum][j], COLOR_ORANGE, string); |
| 77 | - | } |
| 77 | + | } |
| 78 | ||
| 79 | - | format(string, sizeof(string),"You have quit the clan '%s' (id: %d)", clanNames[clannum], clannum); |
| 79 | + | format(string, sizeof(string),"You have quit the clan '%s' (id: %d)", clanNames[clannum], clannum); |
| 80 | - | SendClientMessage(playerid, COLOR_ORANGE, string); |
| 80 | + | SendClientMessage(playerid, COLOR_ORANGE, string); |
| 81 | - | playerclan[playerid]=0; |
| 81 | + | playerclan[playerid]=0; |
| 82 | - | SetPlayerColor(playerid,playerColors[playerid]); |
| 82 | + | SetPlayerColor(playerid,playerColors[playerid]); |
| 83 | - | return; |
| 83 | + | return; |
| 84 | - | } |
| 84 | + | } |
| 85 | - | } |
| 85 | + | } |
| 86 | - | } else {
|
| 86 | + | } else {
|
| 87 | - | SendClientMessage(playerid, COLOR_RED, "You are not in a clan."); |
| 87 | + | SendClientMessage(playerid, COLOR_RED, "You are not in a clan."); |
| 88 | - | } |
| 88 | + | } |
| 89 | } | |
| 90 | ||
| 91 | public OnPlayerDisconnect(playerid, reason) | |
| 92 | {
| |
| 93 | - | PlayerLeaveClan(playerid); |
| 93 | + | PlayerLeaveClan(playerid); |
| 94 | - | return 1; |
| 94 | + | return 1; |
| 95 | } | |
| 96 | ||
| 97 | public OnPlayerCommandText(playerid, cmdtext[]) | |
| 98 | {
| |
| 99 | - | new string[256]; |
| 99 | + | new string[256]; |
| 100 | - | new sendername[MAX_PLAYER_NAME]; |
| 100 | + | new sendername[MAX_PLAYER_NAME]; |
| 101 | - | new giveplayer[MAX_PLAYER_NAME]; |
| 101 | + | new giveplayer[MAX_PLAYER_NAME]; |
| 102 | - | new cmd[256]; |
| 102 | + | new cmd[256]; |
| 103 | - | new giveplayerid , idx; |
| 103 | + | new giveplayerid , idx; |
| 104 | - | |
| 104 | + | |
| 105 | - | if(strcmp(cmd, "/ccmds", true) == 0) {
|
| 105 | + | if(strcmp(cmd, "/ccmds", true) == 0) {
|
| 106 | - | SendClientMessage(playerid, COLOR_YELLOW,"/clan create [name]"); |
| 106 | + | SendClientMessage(playerid, COLOR_YELLOW,"/clan create [name]"); |
| 107 | - | SendClientMessage(playerid, COLOR_YELLOW,"/clan join"); |
| 107 | + | SendClientMessage(playerid, COLOR_YELLOW,"/clan join"); |
| 108 | - | SendClientMessage(playerid, COLOR_YELLOW,"/clan invite [playerID]"); |
| 108 | + | SendClientMessage(playerid, COLOR_YELLOW,"/clan invite [playerID]"); |
| 109 | - | SendClientMessage(playerid, COLOR_YELLOW,"/clan quit"); |
| 109 | + | SendClientMessage(playerid, COLOR_YELLOW,"/clan quit"); |
| 110 | - | SendClientMessage(playerid, COLOR_YELLOW,"/claninfo [number]"); |
| 110 | + | SendClientMessage(playerid, COLOR_YELLOW,"/claninfo [number]"); |
| 111 | - | SendClientMessage(playerid, COLOR_YELLOW,"/clans - Displays the current clans"); |
| 111 | + | SendClientMessage(playerid, COLOR_YELLOW,"/clans - Displays the current clans"); |
| 112 | - | return 1; |
| 112 | + | return 1; |
| 113 | - | } |
| 113 | + | } |
| 114 | ||
| 115 | - | if(strcmp(cmd, "/clan", true) == 0) {
|
| 115 | + | if(strcmp(cmd, "/clan", true) == 0) {
|
| 116 | - | new tmp[256]; |
| 116 | + | new tmp[256]; |
| 117 | - | new clancmd, clannum; |
| 117 | + | new clancmd, clannum; |
| 118 | - | tmp = strtok(cmdtext, idx); |
| 118 | + | tmp = strtok(cmdtext, idx); |
| 119 | ||
| 120 | - | if(!strlen(tmp)) {
|
| 120 | + | if(!strlen(tmp)) {
|
| 121 | - | SendClientMessage(playerid, COLOR_WHITE, "USAGE: /clan [create/join/invite/quit] [name/number]"); |
| 121 | + | SendClientMessage(playerid, COLOR_WHITE, "USAGE: /clan [create/join/invite/quit] [name/number]"); |
| 122 | - | return 1; |
| 122 | + | return 1; |
| 123 | - | } |
| 123 | + | } |
| 124 | - | giveplayerid = strval(tmp); |
| 124 | + | giveplayerid = strval(tmp); |
| 125 | ||
| 126 | - | if(strcmp(tmp, "create", true)==0) |
| 126 | + | if(strcmp(tmp, "create", true)==0) |
| 127 | - | clancmd = 1; |
| 127 | + | clancmd = 1; |
| 128 | - | else if(strcmp(tmp, "invite", true)==0) |
| 128 | + | else if(strcmp(tmp, "invite", true)==0) |
| 129 | - | clancmd = 2; |
| 129 | + | clancmd = 2; |
| 130 | - | else if(strcmp(tmp, "join", true)==0) |
| 130 | + | else if(strcmp(tmp, "join", true)==0) |
| 131 | - | clancmd = 3; |
| 131 | + | clancmd = 3; |
| 132 | - | else if(strcmp(tmp, "quit", true)==0) |
| 132 | + | else if(strcmp(tmp, "quit", true)==0) |
| 133 | - | clancmd = 4; |
| 133 | + | clancmd = 4; |
| 134 | ||
| 135 | - | tmp = strtok(cmdtext, idx); |
| 135 | + | tmp = strtok(cmdtext, idx); |
| 136 | - | if(clancmd < 3 && !strlen(tmp)) {
|
| 136 | + | if(clancmd < 3 && !strlen(tmp)) {
|
| 137 | - | if(clancmd==0) |
| 137 | + | if(clancmd==0) |
| 138 | - | SendClientMessage(playerid, COLOR_WHITE, "USAGE: /clan [create/join/invite/quit] [name/number]"); |
| 138 | + | SendClientMessage(playerid, COLOR_WHITE, "USAGE: /clan [create/join/invite/quit] [name/number]"); |
| 139 | - | else if(clancmd==1) |
| 139 | + | else if(clancmd==1) |
| 140 | - | SendClientMessage(playerid, COLOR_WHITE, "USAGE: /clan [create] [name]"); |
| 140 | + | SendClientMessage(playerid, COLOR_WHITE, "USAGE: /clan [create] [name]"); |
| 141 | - | else if(clancmd==2) |
| 141 | + | else if(clancmd==2) |
| 142 | - | SendClientMessage(playerid, COLOR_WHITE, "USAGE: /clan [invite] [playerID]"); |
| 142 | + | SendClientMessage(playerid, COLOR_WHITE, "USAGE: /clan [invite] [playerID]"); |
| 143 | - | return 1; |
| 143 | + | return 1; |
| 144 | - | } |
| 144 | + | } |
| 145 | - | if(clancmd==1) {
|
| 145 | + | if(clancmd==1) {
|
| 146 | - | if(playerclan[playerid]>0) {
|
| 146 | + | if(playerclan[playerid]>0) {
|
| 147 | - | SendClientMessage(playerid, COLOR_RED, "You are already in a clan!"); |
| 147 | + | SendClientMessage(playerid, COLOR_RED, "You are already in a clan!"); |
| 148 | - | return 1; |
| 148 | + | return 1; |
| 149 | - | } |
| 149 | + | } |
| 150 | ||
| 151 | - | for(new i = 1; i < MAX_CLANS; i++) {
|
| 151 | + | for(new i = 1; i < MAX_CLANS; i++) {
|
| 152 | - | if(clanInfo[i][0]==0) {
|
| 152 | + | if(clanInfo[i][0]==0) {
|
| 153 | - | format(clanNames[i], MAX_CLAN_NAME, "%s", tmp); |
| 153 | + | format(clanNames[i], MAX_CLAN_NAME, "%s", tmp); |
| 154 | - | clanInfo[i][0]=1; |
| 154 | + | clanInfo[i][0]=1; |
| 155 | - | clanInfo[i][1]=1; |
| 155 | + | clanInfo[i][1]=1; |
| 156 | - | clanInfo[i][2]=playerColors[playerid]; |
| 156 | + | clanInfo[i][2]=playerColors[playerid]; |
| 157 | - | clanMembers[i][0] = playerid; |
| 157 | + | clanMembers[i][0] = playerid; |
| 158 | - | format(string, sizeof(string),"You have created the clan '%s' (id: %d)", clanNames[i], i); |
| 158 | + | format(string, sizeof(string),"You have created the clan '%s' (id: %d)", clanNames[i], i); |
| 159 | - | SendClientMessage(playerid, COLOR_GREEN, string); |
| 159 | + | SendClientMessage(playerid, COLOR_GREEN, string); |
| 160 | ||
| 161 | - | playerclan[playerid]=i; |
| 161 | + | playerclan[playerid]=i; |
| 162 | ||
| 163 | return 1; | |
| 164 | - | } |
| 164 | + | } |
| 165 | - | } |
| 165 | + | } |
| 166 | ||
| 167 | - | return 1; |
| 167 | + | |
| 168 | - | } else if (clancmd==3) {
|
| 168 | + | } else if (clancmd==3) {
|
| 169 | - | clannum = clanInvite[playerid]; |
| 169 | + | clannum = clanInvite[playerid]; |
| 170 | ||
| 171 | - | if(playerclan[playerid]>0) {
|
| 171 | + | if(playerclan[playerid]>0) {
|
| 172 | - | SendClientMessage(playerid, COLOR_RED, "You are already in a clan!"); |
| 172 | + | SendClientMessage(playerid, COLOR_RED, "You are already in a clan!"); |
| 173 | - | return 1; |
| 173 | + | return 1; |
| 174 | - | } |
| 174 | + | } |
| 175 | - | if(clanInvite[playerid]==0) {
|
| 175 | + | if(clanInvite[playerid]==0) {
|
| 176 | - | SendClientMessage(playerid, COLOR_RED, "You have not been invited to a clan."); |
| 176 | + | SendClientMessage(playerid, COLOR_RED, "You have not been invited to a clan."); |
| 177 | - | return 1; |
| 177 | + | return 1; |
| 178 | - | } |
| 178 | + | } |
| 179 | - | if(clanInfo[clannum][0]==0) {
|
| 179 | + | if(clanInfo[clannum][0]==0) {
|
| 180 | - | SendClientMessage(playerid, COLOR_RED, "That clan does not exist!"); |
| 180 | + | SendClientMessage(playerid, COLOR_RED, "That clan does not exist!"); |
| 181 | - | return 1; |
| 181 | + | return 1; |
| 182 | - | } |
| 182 | + | } |
| 183 | ||
| 184 | - | if(clanInfo[clannum][1] < MAX_CLAN_MEMBERS) {
|
| 184 | + | if(clanInfo[clannum][1] < MAX_CLAN_MEMBERS) {
|
| 185 | - | new i = clanInfo[clannum][1]; |
| 185 | + | new i = clanInfo[clannum][1]; |
| 186 | ||
| 187 | - | clanInvite[playerid]=0; |
| 187 | + | clanInvite[playerid]=0; |
| 188 | ||
| 189 | - | clanMembers[clannum][i] = playerid; |
| 189 | + | clanMembers[clannum][i] = playerid; |
| 190 | ||
| 191 | - | GetPlayerName(playerid, sendername, MAX_PLAYER_NAME); |
| 191 | + | GetPlayerName(playerid, sendername, MAX_PLAYER_NAME); |
| 192 | - | for(new j = 0; j < clanInfo[clannum][1]; j++) {
|
| 192 | + | for(new j = 0; j < clanInfo[clannum][1]; j++) {
|
| 193 | - | format(string, sizeof(string),"%s has joined your clan.", sendername); |
| 193 | + | format(string, sizeof(string),"%s has joined your clan.", sendername); |
| 194 | - | SendClientMessage(clanMembers[clannum][j], COLOR_ORANGE, string); |
| 194 | + | SendClientMessage(clanMembers[clannum][j], COLOR_ORANGE, string); |
| 195 | - | } |
| 195 | + | } |
| 196 | ||
| 197 | - | clanInfo[clannum][1]++; |
| 197 | + | clanInfo[clannum][1]++; |
| 198 | - | playerclan[playerid] = clannum; |
| 198 | + | playerclan[playerid] = clannum; |
| 199 | ||
| 200 | - | SetPlayerColor(playerid,clanInfo[clannum][2]); |
| 200 | + | SetPlayerColor(playerid,clanInfo[clannum][2]); |
| 201 | ||
| 202 | - | format(string, sizeof(string),"You have joined the clan '%s' (id: %d)", clanNames[clannum], clannum); |
| 202 | + | format(string, sizeof(string),"You have joined the clan '%s' (id: %d)", clanNames[clannum], clannum); |
| 203 | - | SendClientMessage(playerid, COLOR_GREEN, string); |
| 203 | + | SendClientMessage(playerid, COLOR_GREEN, string); |
| 204 | ||
| 205 | - | return 1; |
| 205 | + | return 1; |
| 206 | - | } |
| 206 | + | } |
| 207 | ||
| 208 | - | SendClientMessage(playerid, COLOR_RED, "That clan is full."); |
| 208 | + | SendClientMessage(playerid, COLOR_RED, "That clan is full."); |
| 209 | - | return 1; |
| 209 | + | return 1; |
| 210 | - | } else if (clancmd==2) {
|
| 210 | + | } else if (clancmd==2) {
|
| 211 | - | giveplayerid = strval(tmp); |
| 211 | + | giveplayerid = strval(tmp); |
| 212 | ||
| 213 | - | if(playerclan[playerid]==0) {
|
| 213 | + | if(playerclan[playerid]==0) {
|
| 214 | - | SendClientMessage(playerid, COLOR_RED, "You are not in a clan!"); |
| 214 | + | SendClientMessage(playerid, COLOR_RED, "You are not in a clan!"); |
| 215 | - | return 1; |
| 215 | + | return 1; |
| 216 | - | } |
| 216 | + | } |
| 217 | ||
| 218 | - | if(IsPlayerConnected(giveplayerid)) {
|
| 218 | + | if(IsPlayerConnected(giveplayerid)) {
|
| 219 | - | GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); |
| 219 | + | GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); |
| 220 | - | GetPlayerName(playerid, sendername, sizeof(sendername)); |
| 220 | + | GetPlayerName(playerid, sendername, sizeof(sendername)); |
| 221 | ||
| 222 | - | format(string, sizeof(string),"You have sent a clan invite to %s.", giveplayer); |
| 222 | + | format(string, sizeof(string),"You have sent a clan invite to %s.", giveplayer); |
| 223 | - | SendClientMessage(playerid, COLOR_GREEN, string); |
| 223 | + | SendClientMessage(playerid, COLOR_GREEN, string); |
| 224 | - | format(string, sizeof(string),"You have recieved a clan invite from %s to '%s' (id: %d)", sendername, clanNames[playerclan[playerid]],playerclan[playerid]); |
| 224 | + | format(string, sizeof(string),"You have recieved a clan invite from %s to '%s' (id: %d)", sendername, clanNames[playerclan[playerid]],playerclan[playerid]); |
| 225 | - | SendClientMessage(giveplayerid, COLOR_GREEN, string); |
| 225 | + | SendClientMessage(giveplayerid, COLOR_GREEN, string); |
| 226 | ||
| 227 | - | clanInvite[giveplayerid]=playerclan[playerid]; |
| 227 | + | clanInvite[giveplayerid]=playerclan[playerid]; |
| 228 | ||
| 229 | - | } else |
| 229 | + | } else |
| 230 | - | SendClientMessage(playerid, COLOR_RED, "No such player exists!"); |
| 230 | + | SendClientMessage(playerid, COLOR_RED, "No such player exists!"); |
| 231 | ||
| 232 | - | } else if (clancmd==4) {
|
| 232 | + | } else if (clancmd==4) {
|
| 233 | - | PlayerLeaveClan(playerid); |
| 233 | + | PlayerLeaveClan(playerid); |
| 234 | - | } |
| 234 | + | } |
| 235 | - | return 1; |
| 235 | + | return 1; |
| 236 | - | } |
| 236 | + | } |
| 237 | ||
| 238 | - | if(strcmp(cmd, "/claninfo", true) == 0) {
|
| 238 | + | if(strcmp(cmd, "/claninfo", true) == 0) {
|
| 239 | - | new tmp[256]; |
| 239 | + | new tmp[256]; |
| 240 | - | new clannum; |
| 240 | + | new clannum; |
| 241 | - | tmp = strtok(cmdtext, idx); |
| 241 | + | tmp = strtok(cmdtext, idx); |
| 242 | ||
| 243 | - | if(!strlen(tmp) && playerclan[playerid]==0) {
|
| 243 | + | if(!strlen(tmp) && playerclan[playerid]==0) {
|
| 244 | - | SendClientMessage(playerid, COLOR_WHITE, "USAGE: /claninfo [number]"); |
| 244 | + | SendClientMessage(playerid, COLOR_WHITE, "USAGE: /claninfo [number]"); |
| 245 | - | return 1; |
| 245 | + | return 1; |
| 246 | - | } else if (!strlen(tmp)) |
| 246 | + | } else if (!strlen(tmp)) |
| 247 | - | clannum = playerclan[playerid]; |
| 247 | + | clannum = playerclan[playerid]; |
| 248 | - | else |
| 248 | + | else |
| 249 | - | clannum = strval(tmp); |
| 249 | + | clannum = strval(tmp); |
| 250 | ||
| 251 | - | if(clanInfo[clannum][0]==0) {
|
| 251 | + | if(clanInfo[clannum][0]==0) {
|
| 252 | - | SendClientMessage(playerid, COLOR_RED, "No such clan exists!"); |
| 252 | + | SendClientMessage(playerid, COLOR_RED, "No such clan exists!"); |
| 253 | - | return 1; |
| 253 | + | return 1; |
| 254 | - | } |
| 254 | + | } |
| 255 | ||
| 256 | - | format(string, sizeof(string),"'%s' clan Members (id: %d)", clanNames[clannum], clannum); |
| 256 | + | format(string, sizeof(string),"'%s' clan Members (id: %d)", clanNames[clannum], clannum); |
| 257 | - | SendClientMessage(playerid, COLOR_GREEN, string); |
| 257 | + | SendClientMessage(playerid, COLOR_GREEN, string); |
| 258 | ||
| 259 | - | for(new i = 0; i < clanInfo[clannum][1]; i++) {
|
| 259 | + | for(new i = 0; i < clanInfo[clannum][1]; i++) {
|
| 260 | - | GetPlayerName(clanMembers[clannum][i], giveplayer, sizeof(giveplayer)); |
| 260 | + | GetPlayerName(clanMembers[clannum][i], giveplayer, sizeof(giveplayer)); |
| 261 | - | format(string, sizeof(string),"%s (%d)", giveplayer, clanMembers[clannum][i]); |
| 261 | + | format(string, sizeof(string),"%s (%d)", giveplayer, clanMembers[clannum][i]); |
| 262 | - | SendClientMessage(playerid, COLOR_YELLOW, string); |
| 262 | + | SendClientMessage(playerid, COLOR_YELLOW, string); |
| 263 | - | } |
| 263 | + | } |
| 264 | - | return 1; |
| 264 | + | return 1; |
| 265 | - | } |
| 265 | + | } |
| 266 | ||
| 267 | - | if(strcmp(cmd, "/clans", true) == 0) |
| 267 | + | if(strcmp(cmd, "/clans", true) == 0) |
| 268 | - | {
|
| 268 | + | {
|
| 269 | - | new x; |
| 269 | + | new x; |
| 270 | ||
| 271 | - | SendClientMessage(playerid, COLOR_GREEN, "Current clan:"); |
| 271 | + | SendClientMessage(playerid, COLOR_GREEN, "Current clan:"); |
| 272 | - | for(new i=0; i < MAX_CLANS; i++) {
|
| 272 | + | for(new i=0; i < MAX_CLANS; i++) {
|
| 273 | - | if(clanInfo[i][0]==1) {
|
| 273 | + | if(clanInfo[i][0]==1) {
|
| 274 | - | format(string, sizeof(string), "%s%s(%d) - %d members", string,clanNames[i],i,clanInfo[i][1]); |
| 274 | + | format(string, sizeof(string), "%s%s(%d) - %d members", string,clanNames[i],i,clanInfo[i][1]); |
| 275 | ||
| 276 | - | x++; |
| 276 | + | x++; |
| 277 | - | if(x > 2) {
|
| 277 | + | if(x > 2) {
|
| 278 | - | SendClientMessage(playerid, COLOR_YELLOW, string); |
| 278 | + | SendClientMessage(playerid, COLOR_YELLOW, string); |
| 279 | - | x = 0; |
| 279 | + | x = 0; |
| 280 | - | format(string, sizeof(string), ""); |
| 280 | + | format(string, sizeof(string), ""); |
| 281 | - | } else {
|
| 281 | + | } else {
|
| 282 | - | format(string, sizeof(string), "%s, ", string); |
| 282 | + | format(string, sizeof(string), "%s, ", string); |
| 283 | - | } |
| 283 | + | } |
| 284 | - | } |
| 284 | + | } |
| 285 | - | } |
| 285 | + | } |
| 286 | ||
| 287 | - | if(x <= 2 && x > 0) {
|
| 287 | + | if(x <= 2 && x > 0) {
|
| 288 | - | string[strlen(string)-2] = '.'; |
| 288 | + | string[strlen(string)-2] = '.'; |
| 289 | - | SendClientMessage(playerid, COLOR_YELLOW, string); |
| 289 | + | SendClientMessage(playerid, COLOR_YELLOW, string); |
| 290 | - | } |
| 290 | + | } |
| 291 | - | return 1; |
| 291 | + | return 1; |
| 292 | - | } |
| 292 | + | } |
| 293 | - | return 0; |
| 293 | + | return 0; |
| 294 | } | |
| 295 | ||
| 296 | strtok(const string[], &index) | |
| 297 | {
| |
| 298 | - | new length = strlen(string); |
| 298 | + | new length = strlen(string); |
| 299 | - | while ((index < length) && (string[index] <= ' ')) |
| 299 | + | while ((index < length) && (string[index] <= ' ')) |
| 300 | - | {
|
| 300 | + | {
|
| 301 | - | index++; |
| 301 | + | index++; |
| 302 | - | } |
| 302 | + | } |
| 303 | ||
| 304 | - | new offset = index; |
| 304 | + | new offset = index; |
| 305 | - | new result[20]; |
| 305 | + | new result[20]; |
| 306 | - | while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) |
| 306 | + | while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) |
| 307 | - | {
|
| 307 | + | {
|
| 308 | - | result[index - offset] = string[index]; |
| 308 | + | result[index - offset] = string[index]; |
| 309 | - | index++; |
| 309 | + | index++; |
| 310 | - | } |
| 310 | + | } |
| 311 | - | result[index - offset] = EOS; |
| 311 | + | result[index - offset] = EOS; |
| 312 | - | return result; |
| 312 | + | return result; |
| 313 | } |