04.08.2013, 22:28
Код:
if (strcmp(cmd, "/gang", 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;
}
Here's the options:
Код:
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;
}


