PDA

View Full Version : clan/gang system


s3ek
11/03/2015, 03:35 PM
i want tutorial create a clan/gang system <zcmd> : weapons , Leader , Members , Rank , base,

Kaliber
11/03/2015, 03:38 PM
i want tutorial create a clan/gang system <zcmd> : weapons , Leader , Members , Rank , base,
Look at this topic: http://forum.sa-mp.com/showthread.php?t=243474

Use ****** to find such systems...its not the part of Scripting Help!

SeYziicH
11/03/2015, 03:53 PM
COMMAND:clan(playerid, params[])
{
new cmd[20];
if(sscanf(params, "s[20]", cmd))
{
return SendClientMessage(playerid, COLOR_DGOLD, "CMD: /clan <weapons/leader/members/rank/base>");
}
if(strcmp(cmd, "weapons", true) == 0)
{
//Weapon Code
}
if(strcmp(cmd, "leader", true) == 0)
{
//Leader Code
}
if(strcmp(cmd, "members", true) == 0)
{
//Members Code
}
if(strcmp(cmd, "rank", true) == 0)
{
//Rank Code
}
if(strcmp(cmd, "base", true) == 0)
{
//Base Code
}
return 1;
}

In PlayerInfo array make Member/Leader variable and setup your gangs by making Member = PD (for example)

And use that code for Base entering, car entering, invite code where you set /clan invite [playerid] [id] and PlayerInfo[playerid][Member] = 1 etc...

Or use some finished systems...

s3ek
11/03/2015, 04:03 PM
Look at this topic: http://forum.sa-mp.com/showthread.php?t=243474

Use ****** to find such systems...its not the part of Scripting Help!


OnDialogResponse all dyalog not work !! why

Kaliber
11/03/2015, 04:04 PM
OnDialogResponse all dyalog not work !! why
Sorry, i have no Crystal ball :(

...maybe show us your Code :rolleyes:

s3ek
11/03/2015, 04:06 PM
/*


Script Creator - Crime Life New Scripter Laars
Script Released Date - 03/24/2011 [MM/DD/YYYY]
Script Version - 0.5 [BETA]
Script Lines - 910
Next Script Released Date - 04/02/2011 [MM/DD/YYYY]
Next Script Version - 1.0 [STABLE]
Website - http://crimelife.10001mb.com/

F.A.Q
------

Q.1: Can I Upload it on other site?

Ans: Yes you can. But you have to take our permission first

--

Q.2: Can I Copy/paste the code in my gamemode?

Ans: Ofcourse, you can

--

Q.3: Where were you guys these days?

Ans: We were scripting, so we were busy to share script

--

Q.4: Do you guys need admins in server?

Ans: Ofcourse we do. Please post your application in forum in the STAFF section

--

Q.5: Will you released more scripts?

Ans: Yes we will do, if we have time.

--





*/




// FILTERSCRIPT //

#define fs



//============ INCLUDES ===========//


#include <a_samp>
#include <dini>


//================================//




//========== DIALOGID DEFINITIONS ==========//



#define DIALOGID_GANGCREATE 100
#define DIALOGID_GANGCREATE1 101
#define DIALOGID_GANGCREATE2 102
#define DIALOGID_GANGCREATE3 103
#define DIALOGID_GANGCREATE4 104
#define DIALOGID_GANGCREATE5 105
#define DIALOGID_STATS 106
#define DIALOGID_SKINCHANGE 107
#define DIALOGID_WEAPONCHANGE 108



//=========================================//







//======= CONFIGS =======//




#define MAX_GANGS 100 // Change it to your own
#define GANG_CHASH 25000 // Change it to your own



//======================//





//======= COLORS =======//


#define COLOR_ORANGE2 0xFF8000FF
#define COLOR_DBLUE2 0x2641FEAA
#define COLOR_RED 0xAA333300
#define COLOR_LIGHTRED 0xFF634700
#define COLOR_DARKRED 0x9A000000
#define COLOR_BLUE 0x0000FF00
#define COLOR_LIGHTBLUE 0x33CCFF00
#define COLOR_DARKBLUE 0x00009A00
#define COLOR_WHITE 0xFFFFFF00
#define COLOR_GREEN 0x33AA3300
#define COLOR_LIGHTGREEN 0x9ACD3200
#define COLOR_DARKGREEN 0x40008000
#define COLOR_YELLOW 0xFFFF0000
#define COLOR_YELLOW2 0xF5DEB300
#define COLOR_GREY 0xAFAFAF00
#define COLOR_BROWN 0x99330000
#define COLOR_ORANGE 0xFF993300
#define COLOR_MAGENTA 0xFF00FF00
#define COLOR_PURPLE 0xC2A2DA00
#define COLOR_DBLUE 0x8D8DFF00
#define COLOR_LAWENFORCE 0x8D8DFF00
#define COLOR_LAWENFORCERADAR 0x8D8DFFAA
#define COLOR_DARKPURPLE 0xD900D300
#define COLOR_BLACK 0x02020200
#define COLOR_CYAN 0x99FFFF00
#define COLOR_TAN 0xFFFFCC00
#define COLOR_PINK 0xFF66FF00
#define COLOR_KHAKI 0x99990000
#define COLOR_LIME 0x99FF0000
#define COLOR_TURQ 0x00A3C000
#define COLOR_SYSTEM 0xEFEFF700
#define COLOR_GRAD1 0xB4B5B700
#define COLOR_GRAD2 0xBFC0C200
#define COLOR_GRAD3 0xCBCCCE00
#define COLOR_GRAD4 0xD8D8D800
#define COLOR_GRAD5 0xE3E3E300
#define COLOR_GRAD6 0xF0F0F0FF
#define COLOR_FADE1 0xE6E6E600
#define COLOR_FADE2 0xC8C8C800
#define COLOR_FADE3 0xAAAAAA00
#define COLOR_FADE4 0x8C8C8C00
#define COLOR_FADE5 0x6E6E6E00
#define GELB 0xFF828200
#define ROT 0xFF0000FF
#define GREEN 0x00CC00FF
#define WHITE 0xFFFFFFFF


//====================//




//=========== INTEGERS =============//


enum gInfo
{
Name[128],
ID,
Float:Spawn_X,
Float:Spawn_Y,
Float:Spawn_Z,
Float:Spawn_A,
Spawn_Interior,
Spawn_VirtualWorld,
Gang_Cash,
Gang_Skin,
Gang_Weapon,
Gang_Kills,
Gang_Deaths,
Gang_Rank1[32],
Gang_Rank2[32],
Gang_Rank3[32],
Gang_Rank4[32],
Gang_Rank5[32],
Gang_Rank6[32],
Gang_House,
}

new GangInfo[MAX_GANGS][gInfo];

enum pInfo
{
gang_member,
gang_leader,
gang_rank
}
new fileZ[256];
new assign[MAX_PLAYERS];
new PlayerInfo[MAX_PLAYERS][pInfo];

//==================================//






//=========== FORWARDS ===========//


forward OnGangLogin(playerid);
forward LoadData();


//===============================//













//============= FUNCTION'S AND CALLBACK'S =============//




public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Advance Dynamic Dialog Gang System by Crime Life Team");
print("--------------------------------------\n");
LoadData();
return 1;
}

public OnFilterScriptExit()
{
print("\n--------------------------------------");
print(" Advance Dynamic Dialog Gang System by Crime Life Team");
print("--------------------------------------\n");
return 1;
}

public LoadData()
{
for(new count = 20;count<MAX_GANGS;count++)
{
new Load[256];
format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
if(dini_Exists(fileZ))
{
Load = dini_Get(fileZ,"Name");
strmid(GangInfo[count][Name],Load,0,256,256);
Load = dini_Get(fileZ,"ID");
GangInfo[count][ID] = strval(Load);
Load = dini_Get(fileZ,"Spawn_X");
GangInfo[count][Spawn_X] = strval(Load);
Load = dini_Get(fileZ,"Spawn_Y");
GangInfo[count][Spawn_Y] = strval(Load);
Load = dini_Get(fileZ,"Spawn_Z");
GangInfo[count][Spawn_Z] = strval(Load);
Load = dini_Get(fileZ,"Spawn_A");
GangInfo[count][Spawn_A] = strval(Load);
Load = dini_Get(fileZ,"Spawn_Interior");
GangInfo[count][Spawn_Interior] = strval(Load);
Load = dini_Get(fileZ,"Spawn_VirtualWorld");
GangInfo[count][Spawn_VirtualWorld] = strval(Load);
Load = dini_Get(fileZ,"Gang_Cash");
GangInfo[count][Gang_Cash] = strval(Load);
Load = dini_Get(fileZ,"Gang_Skin");
GangInfo[count][Gang_Skin] = strval(Load);
Load = dini_Get(fileZ,"Gang_Weapon");
GangInfo[count][Gang_Weapon] = strval(Load);
Load = dini_Get(fileZ,"Gang_Kills");
GangInfo[count][Gang_Kills] = strval(Load);
Load = dini_Get(fileZ,"Gang_Deaths");
GangInfo[count][Gang_Deaths] = strval(Load);
format(fileZ, sizeof(fileZ),"Gang : ID = %d | Name = %s Loaded.",count,GangInfo[count][Name]);
printf("%s", fileZ);
}
}
}


public OnPlayerConnect(playerid)
{
format(fileZ, sizeof(fileZ), "Gangs/Players/%s.ini",Names(playerid));
if(dini_Exists(fileZ)){OnGangLogin(playerid);}
else{
new File: hFile = fopen(fileZ, io_write);
if (hFile)
{
new var[32];
format(var, 32, "gang_member=%d\n", PlayerInfo[playerid][gang_member]);fwrite(hFile, var);
format(var, 32, "gang_leader=%d\n",PlayerInfo[playerid][gang_leader]);fwrite(hFile, var);
format(var, 32, "gang_rank=%d\n",PlayerInfo[playerid][gang_rank]);fwrite(hFile, var);
}
fclose(hFile);
OnGangLogin(playerid);
}
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
format(fileZ, sizeof(fileZ), "Gangs/Players/%s.ini", Names(playerid));
new File: hFile = fopen(fileZ, io_write);
if (hFile)
{
new var[32];
format(var, 32, "gang_member=%d\n", PlayerInfo[playerid][gang_member]);fwrite(hFile, var);
format(var, 32, "gang_leader=%d\n",PlayerInfo[playerid][gang_leader]);fwrite(hFile, var);
format(var, 32, "gang_rank=%d\n",PlayerInfo[playerid][gang_rank]);fwrite(hFile, var);
}
fclose(hFile);
return 1;
}

public OnPlayerSpawn(playerid)
{
for(new count = 20;count<MAX_GANGS;count++)
{
format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
if(dini_Exists(fileZ))
{
if(PlayerInfo[playerid][gang_member] == GangInfo[count][ID])
{
GivePlayerWeapon(playerid, GangInfo[count][Gang_Weapon], 999999);
SetPlayerInterior(playerid,GangInfo[count][Spawn_Interior]);
SetPlayerVirtualWorld(playerid,GangInfo[count][Spawn_VirtualWorld]);
SetPlayerPos(playerid,GangInfo[count][Spawn_X],GangInfo[count][Spawn_Y],GangInfo[count][Spawn_Z]);
SetPlayerSkin(playerid, GangInfo[count][Gang_Skin]);
}
}
break;
}
return 1;
}

public OnGangLogin(playerid)
{
if(IsPlayerNPC(playerid)) return 1;
format(fileZ, sizeof(fileZ), "Gangs/Players/%s.ini", Names(playerid));
new File: UserFile = fopen(fileZ, io_read);
if ( UserFile )
{
new key[ 256 ] , val[ 256 ];
new Data[ 256 ];
while ( fread( UserFile , Data , sizeof( Data ) ) )
{
key = ini_GetKey( Data );
if( strcmp( key , "gang_member" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][gang_member] = strval( val ); }
if( strcmp( key , "gang_leader" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][gang_leader] = strval( val ); }
if( strcmp( key , "gang_rank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][gang_rank] = strval( val ); }
}
fclose(UserFile);
}
return 1;
}



public OnPlayerDeath(playerid, killerid, reason)
{
GangInfo[killerid][Gang_Kills] ++;
GangInfo[playerid][Gang_Deaths] ++;
return 1;
}



public OnPlayerText(playerid, text[])
{
if(IsPlayerConnected(playerid))
{
if(text[0] == '!')
{
SendClientMessage(playerid, 0xAA0000AA, "You are sending a gang message");
new name[24], string[128];
GetPlayerName(playerid, name, 24);
format(string, sizeof(string), "[Team Chat]%s: %s", name, text[1]);
printf("%s", string);

for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][gang_member] || PlayerInfo[i][gang_leader] == PlayerInfo[playerid][gang_member] || PlayerInfo[playerid][gang_leader])
SendClientMessage(i, GetPlayerColor(playerid), string);
}
}
return 0;
}

}
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new tmp[256];
new idx;
cmd = strtok(cmdtext, idx);


if (strcmp(cmd, "/ggang", true) ==0 )
{
new showstring[256];
format(showstring,sizeof(showstring),"Gang Create\nGang Change");
ShowPlayerDialog(playerid, DIALOGID_GANGCREATE, DIALOG_STYLE_LIST, "Gang-Display",showstring, "ACCEPT", "EXIT");
return 1;
}

if (strcmp(cmd, "/gganghelp", true) ==0 )
{
SendClientMessage(playerid, COLOR_RED, "Type in ! for gang chat.");
SendClientMessage(playerid, COLOR_RED, "COMMANDS:");
SendClientMessage(playerid, COLOR_RED, "------------");
SendClientMessage(playerid, COLOR_RED, "/gang | /ganghelp | /gangs | /invite | /kick |");
SendClientMessage(playerid, COLOR_RED, "/promote | /denote | /gstats | /credits |");
return 1;
}
if(!strcmp(cmd, "/ggangs", true))
{
new str5[128];
SendClientMessage(playerid, COLOR_RED, "Available Gangs:");
for(new count; count <MAX_GANGS; count++)
{
if(GangInfo[count][ID] || GangInfo[count][Name])
{
format(str5, sizeof(str5), "%s", GangInfo[count][Name]);
SendClientMessage(playerid, COLOR_RED, str5);
}
}
return 1;
}

if (strcmp(cmd, "/ginvite", true) ==0 )
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /invite [PartofName/ID]");
new inviteid = strval(tmp);
if(inviteid == playerid)return SendClientMessage(playerid, COLOR_RED, "You cannot invite yourself");
else if(PlayerInfo[playerid][gang_member] != 0 || PlayerInfo[playerid][gang_leader] != 0)SendClientMessage(playerid, COLOR_GRAD1, "Player is already in other gang.");
else{
for(new count = 20;count<MAX_GANGS;count++){
format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
if(dini_Exists(fileZ)){
if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID]){
PlayerInfo[playerid][gang_member] = PlayerInfo[playerid][gang_member];
format(fileZ,sizeof(fileZ)," %s(%d) invited you to his Gang: %s(%d) ",Names(playerid),playerid,GangInfo[count][Name],GangInfo[count][ID]);
SendClientMessage(playerid, COLOR_RED, fileZ);
SendClientMessage(playerid, COLOR_RED, "You invited a Player to your Gang");}}}}
return 1;
}

if (strcmp(cmd, "/gkick", true) ==0 )
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /kick [PartofName/ID]");
new kickid = strval(tmp);
if(kickid == playerid)return SendClientMessage(playerid, ROT, "You cannot kick yourself");
else if(PlayerInfo[playerid][gang_member] != PlayerInfo[playerid][gang_leader])SendClientMessage(playerid, COLOR_GRAD1, "The person must be in your gang.");
else if(PlayerInfo[playerid][gang_leader] == 0)SendClientMessage(playerid, COLOR_GRAD1, "You are not the Leader.");
else{
for(new count = 20;count<MAX_GANGS;count++){
format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
if(dini_Exists(fileZ)){
if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID]){
PlayerInfo[playerid][gang_member] = 0;
format(fileZ,sizeof(fileZ)," %s(%d) removed you from his Gang: %s(%d) ",Names(playerid),playerid,GangInfo[count][Name],GangInfo[count][ID]);
SendClientMessage(playerid, COLOR_RED, fileZ);
SendClientMessage(playerid, COLOR_RED, "You removed a Player from your Gang.");}}}}
return 1;
}

if (strcmp(cmd, "/gpromote", true) ==0 )
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))return SendClientMessage(playerid, COLOR_GRAD1, "Use: /promote [playerid]");
new promoteid = strval(tmp);
if(promoteid == playerid)return SendClientMessage(playerid, ROT, "You cannot promote yourself");
else if(PlayerInfo[playerid][gang_member] != PlayerInfo[playerid][gang_leader])SendClientMessage(playerid, COLOR_GRAD1, "Players must be in your gang");
else if(PlayerInfo[playerid][gang_leader] == 0)SendClientMessage(playerid, COLOR_GRAD1, "You are not the Leader.");
else{
for(new count = 20;count<MAX_GANGS;count++){
format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
if(dini_Exists(fileZ)){
if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID]){
if(PlayerInfo[playerid][gang_rank] == 6)return SendClientMessage(playerid, COLOR_RED, "Player already got highest Rank");
PlayerInfo[playerid][gang_rank] += 1;
if(PlayerInfo[playerid][gang_rank] == 1){format(fileZ,sizeof(fileZ)," %s(%d) put you to Rank %s(%d) ",Names(playerid),playerid,GangInfo[count][Gang_Rank1],PlayerInfo[playerid][gang_rank]);}
if(PlayerInfo[playerid][gang_rank] == 2){format(fileZ,sizeof(fileZ)," %s(%d) put you to Rank %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank2],PlayerInfo[playerid][gang_rank]);}
if(PlayerInfo[playerid][gang_rank] == 3){format(fileZ,sizeof(fileZ)," %s(%d) put you to Rank %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank3],PlayerInfo[playerid][gang_rank]);}
if(PlayerInfo[playerid][gang_rank] == 4){format(fileZ,sizeof(fileZ)," %s(%d) put you to Rank %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank4],PlayerInfo[playerid][gang_rank]);}
if(PlayerInfo[playerid][gang_rank] == 5){format(fileZ,sizeof(fileZ)," %s(%d) put you to Rank %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank5],PlayerInfo[playerid][gang_rank]);}
if(PlayerInfo[playerid][gang_rank] == 6){format(fileZ,sizeof(fileZ)," %s(%d) put you to Rank %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank6],PlayerInfo[playerid][gang_rank]);}
SendClientMessage(playerid, COLOR_RED, fileZ);
SendClientMessage(playerid, COLOR_RED, "You have Promote the player");}}}}
return 1;
}

if (strcmp(cmd, "/gdenote", true) ==0 )
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /denote [playerid]");
new denoteid = strval(tmp);
if(denoteid == playerid)return SendClientMessage(playerid, ROT, "You cannot denote yourself");
else if(PlayerInfo[playerid][gang_member] != PlayerInfo[playerid][gang_leader])SendClientMessage(playerid, COLOR_GRAD1, "Player must be in your Gang.");
else if(PlayerInfo[playerid][gang_leader] == 0)SendClientMessage(playerid, COLOR_GRAD1, "You are not Leader.");
else{
for(new count = 20;count<MAX_GANGS;count++){
format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
if(dini_Exists(fileZ)){
if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID]){
if(PlayerInfo[playerid][gang_rank] == 1)return SendClientMessage(playerid, ROT, "Player got lowest Rank.");
PlayerInfo[playerid][gang_rank] -= 1;
if(PlayerInfo[playerid][gang_rank] == 1){format(fileZ,sizeof(fileZ)," %s(%d) decreased you to Rank %s(%d) ",Names(playerid),playerid,GangInfo[count][Gang_Rank1],PlayerInfo[playerid][gang_rank]);}
if(PlayerInfo[playerid][gang_rank] == 2){format(fileZ,sizeof(fileZ)," %s(%d) decreased you to Rank %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank2],PlayerInfo[playerid][gang_rank]);}
if(PlayerInfo[playerid][gang_rank] == 3){format(fileZ,sizeof(fileZ)," %s(%d) decreased you to Rank %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank3],PlayerInfo[playerid][gang_rank]);}
if(PlayerInfo[playerid][gang_rank] == 4){format(fileZ,sizeof(fileZ)," %s(%d) decreased you to Rank %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank4],PlayerInfo[playerid][gang_rank]);}
if(PlayerInfo[playerid][gang_rank] == 5){format(fileZ,sizeof(fileZ)," %s(%d) decreased you to Rank %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank5],PlayerInfo[playerid][gang_rank]);}
if(PlayerInfo[playerid][gang_rank] == 6){format(fileZ,sizeof(fileZ)," %s(%d) decreased you to Rank %s(%d)",Names(playerid),playerid,GangInfo[count][Gang_Rank6],PlayerInfo[playerid][gang_rank]);}
SendClientMessage(playerid, ROT, fileZ);
SendClientMessage(playerid, ROT, "You decreased a Player Rank.");}}}}
return 1;
}

if (strcmp(cmd, "/ggstats", true) ==0 )
{
new showstring[256];
new rstring[256];
new nmember = PlayerInfo[playerid][gang_member];
new nrank;
for(new count = 20;count<MAX_GANGS;count++)
{
format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
if(dini_Exists(fileZ)){
if(nmember == GangInfo[count][ID]){
if(nrank == 0){rstring = "N.A";}
format(fileZ, sizeof(fileZ),"%s",GangInfo[count][Gang_Rank1]);
if(nrank == 1){rstring = fileZ;}
format(fileZ, sizeof(fileZ),"%s",GangInfo[count][Gang_Rank2]);
if(nrank == 2){rstring = fileZ;}
format(fileZ, sizeof(fileZ),"%s",GangInfo[count][Gang_Rank3]);
if(nrank == 3){rstring = fileZ;}
format(fileZ, sizeof(fileZ),"%s",GangInfo[count][Gang_Rank4]);
if(nrank == 4){rstring = fileZ;}
format(fileZ, sizeof(fileZ),"%s",GangInfo[count][Gang_Rank5]);
if(nrank == 5){rstring = fileZ;}
format(fileZ, sizeof(fileZ),"%s",GangInfo[count][Gang_Rank6]);
if(nrank == 6){rstring = fileZ;}
if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID]){rstring = "Leader";}
format(showstring,sizeof(showstring),"Gang: %s\nGang_ID: %d\nGang_Rank: %s\nGang_checkout: %d",GangInfo[count][Name],GangInfo[count][ID],rstring,GangInfo[count][Gang_Cash]);
ShowPlayerDialog(playerid, DIALOGID_STATS, DIALOG_STYLE_MSGBOX, "Stats-Display",showstring, "-OK-", "--");}}
}
return 1;
}
return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOGID_GANGCREATE)
{
if(response == 1)
{
if(listitem == 0)
{
format(fileZ, sizeof(fileZ), "Please choose a name for your gang.");
ShowPlayerDialog(playerid, DIALOGID_GANGCREATE3, DIALOG_STYLE_INPUT, "Create Gang", fileZ, "Create", "exit");
}
if(listitem == 1)
{
format(fileZ, sizeof(fileZ), "Change Spawn\nChange Name\nChange Ranks\nChange Skin\nChange Weapon");
ShowPlayerDialog(playerid, DIALOGID_GANGCREATE2, DIALOG_STYLE_LIST, "Change Spawn\nChange Name\nChange Ranks", fileZ, "O.K.", "exit");
}
}
}
if(dialogid == DIALOGID_GANGCREATE1)
{
if(response == 1)
{
for(new count = 20;count<MAX_GANGS;count++)
{
format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
if(dini_Exists(fileZ)){
if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID]){
dini_Set(fileZ,"Name",inputtext);
format(fileZ, sizeof(fileZ), "New name of the gang : (ID:%d) %s",GangInfo[count][ID],inputtext);
SendClientMessage(playerid,ROT,fileZ);
break;}}
}
}
}
if(dialogid == DIALOGID_GANGCREATE2)
{
if(response == 1)
{
if(listitem == 0)
{
for(new count = 20;count<MAX_GANGS;count++)
{
format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
if(dini_Exists(fileZ))
{
if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID])
{

//new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,GangInfo[count][Spawn_X],GangInfo[count][Spawn_Y],GangInfo[count][Spawn_Z]);
dini_FloatSet(fileZ,"Spawn_X",GangInfo[count][Spawn_X]);
dini_FloatSet(fileZ,"Spawn_Y",GangInfo[count][Spawn_Y]);
dini_FloatSet(fileZ,"Spawn_Z",GangInfo[count][Spawn_Z]);
dini_IntSet(fileZ,"Spawn_Interior",GetPlayerInterior(playerid));
dini_IntSet(fileZ,"Spawn_VirtualWorld",GetPlayerVirtualWorld(playerid));
format(fileZ, sizeof(fileZ), "The spawn point of %s has been set ",GangInfo[count][Name]);
SendClientMessage(playerid,ROT,fileZ);

}
}
}
}
if(listitem == 1)
{
format(fileZ, sizeof(fileZ), "Please Choose a name for your Gang.");
ShowPlayerDialog(playerid, DIALOGID_GANGCREATE1, DIALOG_STYLE_INPUT, "Gang Name", fileZ, "Change", "exit");
}
if(listitem == 2)
{
format(fileZ, sizeof(fileZ), "Rank1\nRank2\nRank3\nRank4\nRank5");
ShowPlayerDialog(playerid, DIALOGID_GANGCREATE4, DIALOG_STYLE_LIST, "Change Rank", fileZ, "O.K.", "exit");
}
if(listitem == 3)
{
format(fileZ, sizeof(fileZ), "Type in the id of the skin");
ShowPlayerDialog(playerid, DIALOGID_SKINCHANGE, DIALOG_STYLE_INPUT, "Change Skin", fileZ, "O.K.", "exit");
}
if(listitem == 4)
{
format(fileZ, sizeof(fileZ), "Type in the id of the weapon");
ShowPlayerDialog(playerid, DIALOGID_WEAPONCHANGE, DIALOG_STYLE_INPUT, "Change Weapon", fileZ, "O.K.", "exit");
}
}
}

if(dialogid == DIALOGID_SKINCHANGE)
{
if(response == 1)
{
for(new count = 20;count<MAX_GANGS;count++)
{
new str3[128];
GangInfo[count][Gang_Skin] = strval(inputtext);
dini_IntSet(fileZ,"Skin",GangInfo[count][Gang_Skin]);
SetPlayerSkin(playerid, GangInfo[count][Gang_Skin]);
format(str3, sizeof(str3), "Your gang skin has been set to %d", GangInfo[count][Gang_Skin]);
}
}
}

if(dialogid == DIALOGID_WEAPONCHANGE)
{
if(response == 1)
{
for(new count = 20;count<MAX_GANGS;count++)
{
new str3[128];
GangInfo[count][Gang_Weapon] = strval(inputtext);
dini_IntSet(fileZ,"Weapon",GangInfo[count][Gang_Weapon]);
GivePlayerWeapon(playerid, GangInfo[count][Gang_Weapon], 999999);
format(str3, sizeof(str3), "Your gang weapon has been set to %d", GangInfo[count][Gang_Weapon]);
}
}
}


if(dialogid == DIALOGID_GANGCREATE3)
{
if(response == 1)
{
for(new count = 20;count<MAX_GANGS;count++)
{
format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
if(dini_Exists(fileZ)){}
else{
dini_Create(fileZ);
dini_Set(fileZ,"Name",inputtext);
dini_IntSet(fileZ,"ID",count);
dini_FloatSet(fileZ,"Spawn_X",-304.7875);
dini_FloatSet(fileZ,"Spawn_Y",1298.8138);
dini_FloatSet(fileZ,"Spawn_Z",53.4743);
dini_FloatSet(fileZ,"Spawn_A",53.4743);
dini_IntSet(fileZ,"Spawn_Interior",0);
dini_IntSet(fileZ,"Spawn_VirtualWorld",0);
dini_IntSet(fileZ,"Gang_Cash",Gang_Cash);
dini_IntSet(fileZ,"Gang_Skin",GangInfo[count][Gang_Skin]);
dini_IntSet(fileZ,"Gang_Weapon",GangInfo[count][Gang_Weapon]);
dini_IntSet(fileZ,"Gang_Kills",GangInfo[count][Gang_Kills]);
dini_IntSet(fileZ,"Gang_Deaths",GangInfo[count][Gang_Deaths]);
dini_Set(fileZ,"Gang_Rank1","No Rank");
dini_Set(fileZ,"Gang_Rank2","No Rank");
dini_Set(fileZ,"Gang_Rank3","No Rank");
dini_Set(fileZ,"Gang_Rank4","No Rank");
dini_Set(fileZ,"Gang_Rank5","No Rank");
dini_IntSet(fileZ,"Gang_House",-1);
format(fileZ, sizeof(fileZ), "Player : %s(%d) Created the Gang : %s", Names(playerid),playerid,inputtext);
SendClientMessageToAll(GELB,fileZ);
format(fileZ, sizeof(fileZ), "Your Gang has been created. The id to invite People is %d",count);
SendClientMessage(playerid,ROT,fileZ);
PlayerInfo[playerid][gang_leader] = count;
PlayerInfo[playerid][gang_member] = count;
break;
}
}
}
}
if(dialogid == DIALOGID_GANGCREATE4)
{
if(response == 1)
{
for(new count = 20;count<MAX_GANGS;count++)
{
format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
if(dini_Exists(fileZ))
{
if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID])
{
if(listitem == 0) // Rank 1
{
assign[playerid] = 1;
format(fileZ, sizeof(fileZ), "Please Choose a name for Members Rank 1.");
ShowPlayerDialog(playerid, DIALOGID_GANGCREATE5, DIALOG_STYLE_INPUT, "Rank 1 -name", fileZ, "Change", "exit");
}
if(listitem == 1) // Rank 2
{
assign[playerid] = 2;
format(fileZ, sizeof(fileZ), "Please Choose a name for Members Rank 2.");
ShowPlayerDialog(playerid, DIALOGID_GANGCREATE5, DIALOG_STYLE_INPUT, "Rank 2 -name", fileZ, "Change", "exit");
}
if(listitem == 2) // Rank 3
{
assign[playerid] = 3;
format(fileZ, sizeof(fileZ), "Please Choose a name for Members Rank 3.");
ShowPlayerDialog(playerid, DIALOGID_GANGCREATE5, DIALOG_STYLE_INPUT, "Rank 3 -name", fileZ, "Change", "exit");
}
if(listitem == 3) // Rank 4
{
assign[playerid] = 4;
format(fileZ, sizeof(fileZ), "Please Choose a name for Members Rank 4.");
ShowPlayerDialog(playerid, DIALOGID_GANGCREATE5, DIALOG_STYLE_INPUT, "Rank 4 -name", fileZ, "Change", "exit");
}
if(listitem == 4) // Rank 5
{
assign[playerid] = 5;
format(fileZ, sizeof(fileZ), "Please Choose a name for Leader Rank 5.");
ShowPlayerDialog(playerid, DIALOGID_GANGCREATE5, DIALOG_STYLE_INPUT, "Rank 5 -name", fileZ, "Change", "exit");
}
}
}
}
}
}
if(dialogid == DIALOGID_GANGCREATE5)
{
if(response == 1)
{
for(new count = 20;count<MAX_GANGS;count++)
{
format(fileZ, sizeof(fileZ),"Gangs/GANG_%d.ini",count);
if(dini_Exists(fileZ))
{
if(PlayerInfo[playerid][gang_leader] == GangInfo[count][ID])
{
if(assign[playerid] == 1)
{
dini_Set(fileZ,"Gang_Rank1",inputtext);
assign[playerid] = 0;
format(fileZ, sizeof(fileZ), "new Rank name : %s",inputtext);
SendClientMessage(playerid, GREEN,fileZ);
}
if(assign[playerid] == 2)
{
dini_Set(fileZ,"Gang_Rank2",inputtext);
assign[playerid] = 0;
format(fileZ, sizeof(fileZ), "new Rank name : %s",inputtext);
SendClientMessage(playerid, GREEN,fileZ);
}
if(assign[playerid] == 3)
{
dini_Set(fileZ,"Gang_Rank3",inputtext);
assign[playerid] = 0;
format(fileZ, sizeof(fileZ), "new Rank name : %s",inputtext);
SendClientMessage(playerid, GREEN,fileZ);
}
if(assign[playerid] == 4)
{
dini_Set(fileZ,"Gang_Rank4",inputtext);
assign[playerid] = 0;
format(fileZ, sizeof(fileZ), "new Rank name : %s",inputtext);
SendClientMessage(playerid, GREEN,fileZ);
}
if(assign[playerid] == 5)
{
dini_Set(fileZ,"Gang_Rank5",inputtext);
assign[playerid] = 0;
format(fileZ, sizeof(fileZ), "new Rank name : %s",inputtext);
SendClientMessage(playerid, GREEN,fileZ);
}
}
}
}
}
}
return 1;
}

//==================================================//







//======== STOCKS ========//




stock Names(playerid)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
return pname;
}





stock ini_GetKey( line[] )
{
new keyRes[256];
keyRes[0] = 0;
if ( strfind( line , "=" , true ) == -1 ) return keyRes;
strmid( keyRes , line , 0 , strfind( line , "=" , true ) , sizeof( keyRes) );
return keyRes;
}



stock ini_GetValue( line[] )
{
new valRes[256];
valRes[0]=0;
if ( strfind( line , "=" , true ) == -1 ) return valRes;
strmid( valRes , line , strfind( line , "=" , true )+1 , strlen( line ) , sizeof( valRes ) );
return valRes;
}



strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}

new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}


//------------------------------- END ----------------------------------------//