Last active
April 8, 2017 22:00
-
-
Save rk1432/20368ee9630925ff1c1300102d6b0e41 to your computer and use it in GitHub Desktop.
mini gang system
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include < amxmodx > | |
#include <amxmisc > | |
enum _:eLevels | |
{ | |
GANG_OWNER =0, | |
GANG_MANAGER, | |
GANG_MEMBER | |
} | |
enum _: eGangData | |
{ | |
g_iName[32], | |
Array: g_iPlayers | |
} | |
enum _: ePlayerData | |
{ | |
g_iName[32], | |
g_iSteamId[64], | |
g_iDate[45], | |
g_iLevel | |
} | |
new const g_iLevels [][] = { "Owner", "Manager", "Member"}; | |
new Array: g_iGangs; | |
new g_iGang[33]; | |
public plugin_init( ) | |
{ | |
register_plugin( "a", "b", "c" ); | |
register_clcmd( "say", "cmdSay" ); | |
g_iGangs = ArrayCreate(eGangData); | |
} | |
public plugin_end( ) | |
{ | |
ArrayDestroy( g_iGangs ); | |
arrayset(g_iGang, 0, sizeof(g_iGang)); | |
} | |
public cmdSay(const id) | |
{ | |
new szMessage[64], szArgs[2][32]; | |
read_argv(1, szMessage, charsmax(szMessage)); | |
parse(szMessage, szArgs[0], 31, szArgs[1], 32); | |
if(equal(szArgs[0], "/gang")) | |
{ | |
if(szArgs[1][0] == EOS) | |
{ | |
client_print(id, print_chat, "/gang <name>"); | |
return PLUGIN_HANDLED; | |
} | |
else if(g_iGang[id] > 0) | |
{ | |
client_print(id, print_chat, "you already have a gang fucker"); | |
return PLUGIN_HANDLED; | |
} | |
for( new i=0; i<ArraySize(g_iGangs); i++) | |
{ | |
new tempGang[eGangData]; | |
ArrayGetArray(g_iGangs, i, tempGang); | |
if(equali(tempGang[g_iName], szArgs[1])) | |
{ | |
client_print(id, print_chat, "this gang is tafus"); | |
return PLUGIN_HANDLED; | |
} | |
} | |
cmd_CreateGang(id, szArgs[1]); | |
} | |
return PLUGIN_CONTINUE; | |
} | |
public cmd_CreateGang(const id, const gang_Name[]) | |
{ | |
static tempGang[eGangData], tempPlayer[ePlayerData]; | |
//setting gangs info | |
formatex(tempGang[g_iName], charsmax(tempGang[g_iName]), "%s", gang_Name); | |
tempGang[g_iPlayers] = _:ArrayCreate(ePlayerData); | |
//setting players info | |
get_user_name(id, tempPlayer[g_iName], charsmax(tempPlayer[g_iName])); | |
get_user_authid(id, tempPlayer[g_iSteamId], charsmax(tempPlayer[g_iSteamId])); | |
get_time("%Y/%m/%d %H:%M:%S", tempPlayer[g_iDate], charsmax(tempPlayer[g_iDate])); | |
tempPlayer[g_iLevel] = GANG_OWNER; | |
//insert into arries | |
ArrayPushArray(tempGang[g_iPlayers], tempPlayer); | |
ArrayPushArray(g_iGangs, tempGang); | |
client_print(0, print_chat, "%s has opened the gang %s", tempPlayer[g_iName], tempGang[g_iName]); | |
//lets check this shitty | |
for( new i=0; i< ArraySize(g_iGangs); i++) | |
{ | |
new szTemp[eGangData]; | |
ArrayGetArray(g_iGangs, i, szTemp); | |
client_print(0, print_chat, "gang name: %s", szTemp[g_iName]); | |
for( new j=0; j< ArraySize(szTemp[g_iPlayers]); j++) | |
{ | |
static szPlayer[ePlayerData]; | |
ArrayGetArray(szTemp[g_iPlayers], j, szPlayer); | |
client_print(0, print_chat, "[%s] player (%s) %s in date of %s", szPlayer[g_iSteamId], g_iLevels[szPlayer[g_iLevel]], szPlayer[g_iName], szPlayer[g_iDate]); | |
} | |
} | |
g_iGang[id] = ArraySize(g_iGangs); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment