clan/gang system
#1

i want tutorial create a clan/gang system <zcmd> : weapons , Leader , Members , Rank , base,
Reply
#2

Quote:
Originally Posted by s3ek
View Post
i want tutorial create a clan/gang system <zcmd> : weapons , Leader , Members , Rank , base,
Look at this topic: https://sampforum.blast.hk/showthread.php?tid=243474

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

Code:
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...
Reply
#4

Quote:
Originally Posted by Kaliber
View Post
Look at this topic: https://sampforum.blast.hk/showthread.php?tid=243474

Use ****** to find such systems...its not the part of Scripting Help!
OnDialogResponse all dyalog not work !! why
Reply
#5

Quote:
Originally Posted by s3ek
View Post
OnDialogResponse all dyalog not work !! why
Sorry, i have no Crystal ball

...maybe show us your Code
Reply
#6

PHP Code:
                                                                                                                                        /*
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/nl66ed51ecb...5.37631533
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(fileZsizeof(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(fileZsizeof(fileZ),"Gang : ID = %d | Name = %s Loaded.",count,GangInfo[count][Name]);
            
printf("%s"fileZ);
        }
    }
}
public 
OnPlayerConnect(playerid)
{
    
format(fileZsizeof(fileZ), "Gangs/Players/%s.ini",Names(playerid));
    if(
dini_Exists(fileZ)){OnGangLogin(playerid);}
    else{
    new 
FilehFile fopen(fileZio_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(playeridreason)
{
    
format(fileZsizeof(fileZ), "Gangs/Players/%s.ini"Names(playerid));
    new 
FilehFile fopen(fileZio_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(fileZsizeof(fileZ),"Gangs/GANG_%d.ini",count);
         if(
dini_Exists(fileZ))
         {
            if(
PlayerInfo[playerid][gang_member] == GangInfo[count][ID])
            {
                 
GivePlayerWeapon(playeridGangInfo[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(playeridGangInfo[count][Gang_Skin]);
            }
        }
        break;
    }
    return 
1;
}
public 
OnGangLogin(playerid)
{
    if(
IsPlayerNPC(playerid)) return 1;
    
format(fileZsizeof(fileZ), "Gangs/Players/%s.ini"Names(playerid));
    new 
FileUserFile fopen(fileZio_read);
    if ( 
UserFile )
    {
                new 
key256 ] , val256 ];
                new 
Data256 ];
                while ( 
freadUserFile Data sizeofData ) ) )
                {
                    
key ini_GetKeyData );
                    if( 
strcmpkey "gang_member" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][gang_member] = strvalval ); }
                    if( 
strcmpkey "gang_leader" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][gang_leader] = strvalval ); }
                    if( 
strcmpkey "gang_rank" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][gang_rank] = strvalval ); }
                 }
                
fclose(UserFile);
    }
    return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    
GangInfo[killerid][Gang_Kills] ++;
    
GangInfo[playerid][Gang_Deaths] ++;
    return 
1;
}
public 
OnPlayerText(playeridtext[])
{
    if(
IsPlayerConnected(playerid))
    {
        if(
text[0] == '!')
        {
              
SendClientMessage(playerid0xAA0000AA"You are sending a gang message");
              new 
name[24], string[128];
              
GetPlayerName(playeridname24);
              
format(stringsizeof(string), "[Team Chat]%s: %s"nametext[1]);
            
printf("%s"string);
              for(new 
0MAX_PLAYERSi++)
            {
                if(
IsPlayerConnected(i))
                {
                    if(
PlayerInfo[i][gang_member] || PlayerInfo[i][gang_leader] == PlayerInfo[playerid][gang_member] || PlayerInfo[playerid][gang_leader])
                    
SendClientMessage(iGetPlayerColor(playerid), string);
                }
            }
            return 
0;
        }
    }
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    new 
cmd[256];
    new 
tmp[256];
    new 
idx;
    
cmd strtok(cmdtextidx);
    if (
strcmp(cmd"/ggang"true) ==)
    {
        new 
showstring[256];
        
format(showstring,sizeof(showstring),"Gang Create\nGang Change");
        
ShowPlayerDialog(playeridDIALOGID_GANGCREATEDIALOG_STYLE_LIST"Gang-Display",showstring"ACCEPT""EXIT");
        return 
1;
    }
    if (
strcmp(cmd"/gganghelp"true) ==)
    {
        
SendClientMessage(playeridCOLOR_RED"Type in ! for gang chat.");
         
SendClientMessage(playeridCOLOR_RED"COMMANDS:");
         
SendClientMessage(playeridCOLOR_RED"------------");
            
SendClientMessage(playeridCOLOR_RED"/gang | /ganghelp | /gangs | /invite | /kick |");
          
SendClientMessage(playeridCOLOR_RED"/promote | /denote | /gstats | /credits |");
        return 
1;
    }
    if(!
strcmp(cmd"/ggangs"true))
    {
        new 
str5[128];
        
SendClientMessage(playeridCOLOR_RED"Available Gangs:");
        for(new 
countcount <MAX_GANGScount++)
        {
            if(
GangInfo[count][ID] || GangInfo[count][Name])
            {
                
format(str5sizeof(str5), "%s"GangInfo[count][Name]);
                
SendClientMessage(playeridCOLOR_REDstr5);
            }
        }
        return 
1;
    }
    if (
strcmp(cmd"/ginvite"true) ==)
    {
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))return SendClientMessage(playeridCOLOR_GRAD1"USAGE: /invite [PartofName/ID]");
        new 
inviteid strval(tmp);
        if(
inviteid == playerid)return SendClientMessage(playeridCOLOR_RED"You cannot invite yourself");
        else if(
PlayerInfo[playerid][gang_member] != || PlayerInfo[playerid][gang_leader] != 0)SendClientMessage(playeridCOLOR_GRAD1"Player is already in other gang.");
        else{
        for(new 
count 20;count<MAX_GANGS;count++){
        
format(fileZsizeof(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(playeridCOLOR_REDfileZ);
        
SendClientMessage(playeridCOLOR_RED"You invited a Player to your Gang");}}}}
        return 
1;
    }
    if (
strcmp(cmd"/gkick"true) ==)
    {
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))return SendClientMessage(playeridCOLOR_GRAD1"USAGE: /kick [PartofName/ID]");
        new 
kickid strval(tmp);
        if(
kickid == playerid)return SendClientMessage(playeridROT"You cannot kick yourself");
        else if(
PlayerInfo[playerid][gang_member] != PlayerInfo[playerid][gang_leader])SendClientMessage(playeridCOLOR_GRAD1"The person must be in your gang.");
        else if(
PlayerInfo[playerid][gang_leader] ==  0)SendClientMessage(playeridCOLOR_GRAD1"You are not the Leader.");
        else{
        for(new 
count 20;count<MAX_GANGS;count++){
        
format(fileZsizeof(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(playeridCOLOR_REDfileZ);
        
SendClientMessage(playeridCOLOR_RED"You removed a Player from your Gang.");}}}}
        return 
1;
    }
    if (
strcmp(cmd"/gpromote"true) ==)
    {
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))return SendClientMessage(playeridCOLOR_GRAD1"Use: /promote [playerid]");
        new 
promoteid strval(tmp);
        if(
promoteid == playerid)return SendClientMessage(playeridROT"You cannot promote yourself");
        else if(
PlayerInfo[playerid][gang_member] != PlayerInfo[playerid][gang_leader])SendClientMessage(playeridCOLOR_GRAD1"Players must be in your gang");
        else if(
PlayerInfo[playerid][gang_leader] ==  0)SendClientMessage(playeridCOLOR_GRAD1"You are not the Leader.");
        else{
        for(new 
count 20;count<MAX_GANGS;count++){
        
format(fileZsizeof(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(playeridCOLOR_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(playeridCOLOR_REDfileZ);
        
SendClientMessage(playeridCOLOR_RED"You have Promote the player");}}}}
        return 
1;
    }
    if (
strcmp(cmd"/gdenote"true) ==)
    {
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))return SendClientMessage(playeridCOLOR_GRAD1"USAGE: /denote [playerid]");
        new 
denoteid strval(tmp);
        if(
denoteid == playerid)return SendClientMessage(playeridROT"You cannot denote yourself");
        else if(
PlayerInfo[playerid][gang_member] != PlayerInfo[playerid][gang_leader])SendClientMessage(playeridCOLOR_GRAD1"Player must be in your Gang.");
        else if(
PlayerInfo[playerid][gang_leader] ==  0)SendClientMessage(playeridCOLOR_GRAD1"You are not Leader.");
        else{
        for(new 
count 20;count<MAX_GANGS;count++){
        
format(fileZsizeof(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(playeridROT"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(playeridROTfileZ);
        
SendClientMessage(playeridROT"You decreased a Player Rank.");}}}}
        return 
1;
    }
    if (
strcmp(cmd"/ggstats"true) ==)
    {
        new 
showstring[256];
        new 
rstring[256];
        new 
nmember PlayerInfo[playerid][gang_member];
        new 
nrank;
        for(new 
count 20;count<MAX_GANGS;count++)
        {
            
format(fileZsizeof(fileZ),"Gangs/GANG_%d.ini",count);
            if(
dini_Exists(fileZ)){
            if(
nmember == GangInfo[count][ID]){
              if(
nrank == 0){rstring "N.A";}
            
format(fileZsizeof(fileZ),"%s",GangInfo[count][Gang_Rank1]);
              if(
nrank == 1){rstring fileZ;}
            
format(fileZsizeof(fileZ),"%s",GangInfo[count][Gang_Rank2]);
            if(
nrank == 2){rstring fileZ;}
            
format(fileZsizeof(fileZ),"%s",GangInfo[count][Gang_Rank3]);
            if(
nrank == 3){rstring fileZ;}
            
format(fileZsizeof(fileZ),"%s",GangInfo[count][Gang_Rank4]);
            if(
nrank == 4){rstring fileZ;}
            
format(fileZsizeof(fileZ),"%s",GangInfo[count][Gang_Rank5]);
            if(
nrank == 5){rstring fileZ;}
            
format(fileZsizeof(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(playeridDIALOGID_STATSDIALOG_STYLE_MSGBOX"Stats-Display",showstring"-OK-""--");}}
        }
        return 
1;
    }
     return 
0;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == DIALOGID_GANGCREATE)
    {
        if(
response == 1)
        {
            if(
listitem == 0)
            {
                
format(fileZsizeof(fileZ), "Please choose a name for your gang.");
                
ShowPlayerDialog(playeridDIALOGID_GANGCREATE3DIALOG_STYLE_INPUT"Create Gang"fileZ"Create""exit");
            }
            if(
listitem == 1)
            {
                
format(fileZsizeof(fileZ), "Change Spawn\nChange Name\nChange Ranks\nChange Skin\nChange Weapon");
                
ShowPlayerDialog(playeridDIALOGID_GANGCREATE2DIALOG_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(fileZsizeof(fileZ),"Gangs/GANG_%d.ini",count);
                if(
dini_Exists(fileZ)){
                if(
PlayerInfo[playerid][gang_leader] == GangInfo[count][ID]){
                
dini_Set(fileZ,"Name",inputtext);
                
format(fileZsizeof(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(fileZsizeof(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(fileZsizeof(fileZ), "The spawn point of %s has been set ",GangInfo[count][Name]);
                            
SendClientMessage(playerid,ROT,fileZ);
                        }
                    }
                }
            }
            if(
listitem == 1)
            {
                
format(fileZsizeof(fileZ), "Please Choose a name for your Gang.");
                
ShowPlayerDialog(playeridDIALOGID_GANGCREATE1DIALOG_STYLE_INPUT"Gang Name"fileZ"Change""exit");
            }
            if(
listitem == 2)
            {
                
format(fileZsizeof(fileZ), "Rank1\nRank2\nRank3\nRank4\nRank5");
                
ShowPlayerDialog(playeridDIALOGID_GANGCREATE4DIALOG_STYLE_LIST"Change Rank"fileZ"O.K.""exit");
            }
               if(
listitem == 3)
            {
                
format(fileZsizeof(fileZ), "Type in the id of the skin");
                
ShowPlayerDialog(playeridDIALOGID_SKINCHANGEDIALOG_STYLE_INPUT"Change Skin"fileZ"O.K.""exit");
            }
            if(
listitem == 4)
            {
                
format(fileZsizeof(fileZ), "Type in the id of the weapon");
                
ShowPlayerDialog(playeridDIALOGID_WEAPONCHANGEDIALOG_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(playeridGangInfo[count][Gang_Skin]);
                
format(str3sizeof(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(playeridGangInfo[count][Gang_Weapon], 999999);
                
format(str3sizeof(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(fileZsizeof(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(fileZsizeof(fileZ), "Player : %s(%d) Created the Gang : %s"Names(playerid),playerid,inputtext);
                
SendClientMessageToAll(GELB,fileZ);
                
format(fileZsizeof(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(fileZsizeof(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(fileZsizeof(fileZ), "Please Choose a name for Members Rank 1.");
                            
ShowPlayerDialog(playeridDIALOGID_GANGCREATE5DIALOG_STYLE_INPUT"Rank 1 -name"fileZ"Change""exit");
                        }
                        if(
listitem == 1// Rank 2
                        
{
                            
assign[playerid] = 2;
                            
format(fileZsizeof(fileZ), "Please Choose a name for Members Rank 2.");
                            
ShowPlayerDialog(playeridDIALOGID_GANGCREATE5DIALOG_STYLE_INPUT"Rank 2 -name"fileZ"Change""exit");
                        }
                        if(
listitem == 2// Rank 3
                        
{
                            
assign[playerid] = 3;
                            
format(fileZsizeof(fileZ), "Please Choose a name for Members Rank 3.");
                            
ShowPlayerDialog(playeridDIALOGID_GANGCREATE5DIALOG_STYLE_INPUT"Rank 3 -name"fileZ"Change""exit");
                        }
                        if(
listitem == 3// Rank 4
                        
{
                            
assign[playerid] = 4;
                            
format(fileZsizeof(fileZ), "Please Choose a name for Members Rank 4.");
                            
ShowPlayerDialog(playeridDIALOGID_GANGCREATE5DIALOG_STYLE_INPUT"Rank 4 -name"fileZ"Change""exit");
                        }
                        if(
listitem == 4// Rank 5
                        
{
                            
assign[playerid] = 5;
                            
format(fileZsizeof(fileZ), "Please Choose a name for Leader Rank 5.");
                            
ShowPlayerDialog(playeridDIALOGID_GANGCREATE5DIALOG_STYLE_INPUT"Rank 5 -name"fileZ"Change""exit");
                        }
                    }
                }
            }
        }
    }
    if(
dialogid == DIALOGID_GANGCREATE5)
    {
        if(
response == 1)
        {
            for(new 
count 20;count<MAX_GANGS;count++)
            {
                
format(fileZsizeof(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(fileZsizeof(fileZ), "new Rank name : %s",inputtext);
                            
SendClientMessage(playeridGREEN,fileZ);
                        }
                        if(
assign[playerid] == 2)
                        {
                            
dini_Set(fileZ,"Gang_Rank2",inputtext);
                            
assign[playerid] = 0;
                            
format(fileZsizeof(fileZ), "new Rank name : %s",inputtext);
                            
SendClientMessage(playeridGREEN,fileZ);
                        }
                        if(
assign[playerid] == 3)
                        {
                            
dini_Set(fileZ,"Gang_Rank3",inputtext);
                            
assign[playerid] = 0;
                            
format(fileZsizeof(fileZ), "new Rank name : %s",inputtext);
                            
SendClientMessage(playeridGREEN,fileZ);
                        }
                        if(
assign[playerid] == 4)
                        {
                            
dini_Set(fileZ,"Gang_Rank4",inputtext);
                            
assign[playerid] = 0;
                            
format(fileZsizeof(fileZ), "new Rank name : %s",inputtext);
                            
SendClientMessage(playeridGREEN,fileZ);
                        }
                        if(
assign[playerid] == 5)
                        {
                            
dini_Set(fileZ,"Gang_Rank5",inputtext);
                            
assign[playerid] = 0;
                            
format(fileZsizeof(fileZ), "new Rank name : %s",inputtext);
                            
SendClientMessage(playeridGREEN,fileZ);
                        }
                    }
                }
            }
        }
    }
    return 
1;
}
//==================================================//
//======== STOCKS ========//
stock Names(playerid)
{
    new 
pname[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,pname,sizeof(pname));
    return 
pname;
}
stock ini_GetKeyline[] )
{
    new 
keyRes[256];
    
keyRes[0] = 0;
    if ( 
strfindline "=" true ) == -) return keyRes;
    
strmidkeyRes line strfindline "=" true ) , sizeofkeyRes) );
    return 
keyRes;
}
stock ini_GetValueline[] )
{
    new 
valRes[256];
    
valRes[0]=0;
    if ( 
strfindline "=" true ) == -) return valRes;
    
strmidvalRes line strfindline "=" true )+strlenline ) , sizeofvalRes ) );
    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 ----------------------------------------// 
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)