Szerző Téma: Parancsok írása, hogyan?  (Megtekintve 469 alkalommal)

Parancsok írása, hogyan?
« Dátum: 2013. január 16. - 16:43:58 »
0 Show voters
Sziasztok!
Van ez a script:
 

#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 forditotta Feriii \");
print(\"--------------------------------------\\n\");
    LoadData();
return 1;
}
public OnFilterScriptExit()
{
    print(\"\\n--------------------------------------\");
print(\" Advance Dynamic Dialog Gang System by Crime Life Team forditotta Feriii\");
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, \"Üzenetet küldtél a bandának\");
        new name[24], string[128];
        GetPlayerName(playerid, name, 24);
        format(string, sizeof(string), \"[banda Chat]%s: %s\", name, text[1]);
       printf(\"%s\", string);
        for(new i = 0; i < MAX_PLAYERS; i++)
       {
          if(IsPlayerConnected(i))
          {
             if(PlayerInfo[gang_member] || PlayerInfo[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, \"/gang\", true) ==0 )
{
    new showstring[256];
format(showstring,sizeof(showstring),\"Gang Létrehozás\\nGang Változtatások\");
ShowPlayerDialog(playerid, DIALOGID_GANGCREATE, DIALOG_STYLE_LIST, \"Gang-Menü\",showstring, \"Elfogad\", \"Kilép\");
return 1;
}
if (strcmp(cmd, \"/ganghelp\", true) ==0 )
{
    SendClientMessage(playerid, COLOR_RED, \"!<szöveg> a banda chathez.\");
        SendClientMessage(playerid, COLOR_RED, \"Parancsok:\");
        SendClientMessage(playerid, COLOR_RED, \"------------\");
          SendClientMessage(playerid, COLOR_RED, \"/gang | /ganghelp | /gangs | /gang-invite | /gang-kick |\");
         SendClientMessage(playerid, COLOR_RED, \"/gang-promote | /gang-denote | /gstats | /credits |\");
return 1;
}
 
if(!strcmp(cmd, \"/gangs\", true))
{
    new str5[128];
    SendClientMessage(playerid, COLOR_RED, \"A rendelkezésre álló bandák:\");
    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, \"/gang-invite\", true) ==0 )
{
        cmd = strtok(cmdtext, idx);
if(!strlen(tmp))return SendClientMessage(playerid, COLOR_GRAD1, \"Használata: /gang-invite [playerID]\");
new inviteid = strval(tmp);
if(inviteid == playerid)return SendClientMessage(playerid, COLOR_RED, \"Magadat nem hívhatod meg!\");
else if(PlayerInfo[playerid][gang_member] != 0 || PlayerInfo[playerid][gang_leader] != 0)SendClientMessage(playerid, COLOR_GRAD1, \"Játékos márt egy másik bandába van!\");
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) meghivott a bandába: %s(%d) \",Names(playerid),playerid,GangInfo[count][Name],GangInfo[count][iD]);
SendClientMessage(playerid, COLOR_RED, fileZ);
SendClientMessage(playerid, COLOR_RED, \"Te meghivtad a bandába a játékost\");}}}}
return 1;
}
if (strcmp(cmd, \"/gang-kick\", true) ==0 )
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))return SendClientMessage(playerid, COLOR_GRAD1, \"Használata: /gang-kick [playerID]\");
new kickid = strval(tmp);
if(kickid == playerid)return SendClientMessage(playerid, ROT, \"Magadat nem rúghatod ki!\");
else if(PlayerInfo[playerid][gang_member] != PlayerInfo[playerid][gang_leader])SendClientMessage(playerid, COLOR_GRAD1, \"Játékos nincs a bandádba\");
else if(PlayerInfo[playerid][gang_leader] ==  0)SendClientMessage(playerid, COLOR_GRAD1, \"Nem vagy 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) eltávolitott téged a bandábol: %s(%d) \",Names(playerid),playerid,GangInfo[count][Name],GangInfo[count][iD]);
SendClientMessage(playerid, COLOR_RED, fileZ);
SendClientMessage(playerid, COLOR_RED, \"Eltávolitottak egy játékost a bandából\");}}}}
return 1;
}
if (strcmp(cmd, \"/gang-promote\", 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, \"Magadnak nem emelhetsz szintet!\");
else if(PlayerInfo[playerid][gang_member] != PlayerInfo[playerid][gang_leader])SendClientMessage(playerid, COLOR_GRAD1, \"Játékos nincs a bandádba!\");
else if(PlayerInfo[playerid][gang_leader] ==  0)SendClientMessage(playerid, COLOR_GRAD1, \"Nem vagy 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, \"Játékosnak márt megvan a rangja!\");
PlayerInfo[playerid][gang_rank] += 1;
if(PlayerInfo[playerid][gang_rank] == 1){format(fileZ,sizeof(fileZ),\" %s(%d) emelte a rangod %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) emelte a rangod %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) emelte a rangod %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) emelte a rangod %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) emelte a rangod %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) emelte a rangod %s(%d)\",Names(playerid),playerid,GangInfo[count][Gang_Rank6],PlayerInfo[playerid][gang_rank]);}
SendClientMessage(playerid, COLOR_RED, fileZ);
SendClientMessage(playerid, COLOR_RED, \"Emelted a játékos szintjét\");}}}}
return 1;
}
if (strcmp(cmd, \"/gang-denote\", true) ==0 )
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))return SendClientMessage(playerid, COLOR_GRAD1, \"Használata: /gang-denote [playerid]\");
new denoteid = strval(tmp);
if(denoteid == playerid)return SendClientMessage(playerid, ROT, \"Saját rangodat nem tudod levenni!\");
else if(PlayerInfo[playerid][gang_member] != PlayerInfo[playerid][gang_leader])SendClientMessage(playerid, COLOR_GRAD1, \"Játékos nincs a bandádba!\");
else if(PlayerInfo[playerid][gang_leader] ==  0)SendClientMessage(playerid, COLOR_GRAD1, \"Nem vagy bandavezér\");
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, \"Játékosnak márt megvan a legkisebb rangja!.\");
PlayerInfo[playerid][gang_rank] -= 1;
if(PlayerInfo[playerid][gang_rank] == 1){format(fileZ,sizeof(fileZ),\" %s(%d) csökkentette a rangod %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) csökkentette a rangod %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) csökkentette a rangod %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) csökkentette a rangod %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) csökkentette a rangod %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) csökkentette a rangod %s(%d)\",Names(playerid),playerid,GangInfo[count][Gang_Rank6],PlayerInfo[playerid][gang_rank]);}
SendClientMessage(playerid, ROT, fileZ);
SendClientMessage(playerid, ROT, \"Csökkentették a rangod\");}}}}
return 1;
}
if (strcmp(cmd, \"/gstats\", 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_Pénze: %d\",GangInfo[count][Name],GangInfo[count][iD],rstring,GangInfo[count][Gang_Cash]);
   ShowPlayerDialog(playerid, DIALOGID_STATS, DIALOG_STYLE_MSGBOX, \"Stats-Menü\",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), \"Írd be a nevét a bandádnak\");
      ShowPlayerDialog(playerid, DIALOGID_GANGCREATE3, DIALOG_STYLE_INPUT, \"Banda létrehozása\", fileZ, \"Létrehoz\", \"Kilép\");
    }
    if(listitem == 1)
    {
      format(fileZ, sizeof(fileZ), \"Spawn hely csere\\nBanda név csere\\nRang csere\\nSkin csere\\nFegyver csere\");
      ShowPlayerDialog(playerid, DIALOGID_GANGCREATE2, DIALOG_STYLE_LIST, \"Spawn csere\\nNév csere\\nRang csere\", fileZ, \"Oké\", \"Kilép\");
    }
}
}
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), \"Neve a bandádnak : (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), \"A spawn helyetek megváltoztatva \",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, \"Banda Név\", fileZ, \"Cserél\", \"Kilép\");
   }
    if(listitem == 2)
    {
      format(fileZ, sizeof(fileZ), \"Rank1\\nRank2\\nRank3\\nRank4\\nRank5\");
      ShowPlayerDialog(playerid, DIALOGID_GANGCREATE4, DIALOG_STYLE_LIST, \"Rang csere\", fileZ, \"Oké\", \"Kilép\");
   }
            if(listitem == 3)
    {
      format(fileZ, sizeof(fileZ), \"Kérlek írd be a skin id-t\");
      ShowPlayerDialog(playerid, DIALOGID_SKINCHANGE, DIALOG_STYLE_INPUT, \"Skin csere\", fileZ, \"Oké\", \"Kilép\");
   }
   if(listitem == 4)
    {
      format(fileZ, sizeof(fileZ), \"Kérlek írd be a fegyver id-t\");
      ShowPlayerDialog(playerid, DIALOGID_WEAPONCHANGE, DIALOG_STYLE_INPUT, \"Fegyver Csere\", fileZ, \"Oké\", \"Kilép\");
   }
}
}
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), \"A banda skinje a következö %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), \"A banda fegyvere a következö %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), \"Játékos : %s(%d) létrehozta a  : %s bandát\", Names(playerid),playerid,inputtext);
      SendClientMessageToAll(GELB,fileZ);
      format(fileZ, sizeof(fileZ), \"Te létrehoztad a bandád. Meghivtad a bandába %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), \"Kérjük, válasszon egy nevet a tagok  1. rangjának\");
               ShowPlayerDialog(playerid, DIALOGID_GANGCREATE5, DIALOG_STYLE_INPUT, \"Rank 1 -name\", fileZ, \"Cserél\", \"Kilép\");
             }
             if(listitem == 1) // Rank 2
             {
                 assign[playerid] = 2;
               format(fileZ, sizeof(fileZ), \"Kérjük, válasszon egy nevet a tagok  2. rangjának\");
               ShowPlayerDialog(playerid, DIALOGID_GANGCREATE5, DIALOG_STYLE_INPUT, \"Rank 2 -name\", fileZ, \"Cserél\", \"Kilép\");
             }
             if(listitem == 2) // Rank 3
             {
                 assign[playerid] = 3;
               format(fileZ, sizeof(fileZ), \"Kérjük, válasszon egy nevet a tagok  3. rangjának\");
               ShowPlayerDialog(playerid, DIALOGID_GANGCREATE5, DIALOG_STYLE_INPUT, \"Rank 3 -name\", fileZ, \"Cserél\", \"Kilép\");
             }
             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), \"Kérjük, válasszon egy nevet a Leader 5. rangjának\");
               ShowPlayerDialog(playerid, DIALOGID_GANGCREATE5, DIALOG_STYLE_INPUT, \"Rank 5 -name\", fileZ, \"Cserél\", \"Kilép\");
             }
         }
      }
   }
}
}
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), \"Új rang név : %s\",inputtext);
               SendClientMessage(playerid, GREEN,fileZ);
            }
            if(assign[playerid] == 2)
            {
               dini_Set(fileZ,\"Gang_Rank2\",inputtext);
               assign[playerid] = 0;
               format(fileZ, sizeof(fileZ), \"Új rang név : %s\",inputtext);
               SendClientMessage(playerid, GREEN,fileZ);
            }
            if(assign[playerid] == 3)
            {
               dini_Set(fileZ,\"Gang_Rank3\",inputtext);
               assign[playerid] = 0;
               format(fileZ, sizeof(fileZ), \"Új rang név : %s\",inputtext);
               SendClientMessage(playerid, GREEN,fileZ);
            }
            if(assign[playerid] == 4)
            {
               dini_Set(fileZ,\"Gang_Rank4\",inputtext);
               assign[playerid] = 0;
               format(fileZ, sizeof(fileZ), \"Új rang név: %s\",inputtext);
               SendClientMessage(playerid, GREEN,fileZ);
            }
            if(assign[playerid] == 5)
            {
               dini_Set(fileZ,\"Gang_Rank5\",inputtext);
               assign[playerid] = 0;
               format(fileZ, sizeof(fileZ), \"Új rang név : %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;
}
 
 
//------------------------------- END ----------------------------------------//

 
És ebbõl kéne nekem egy olyan,hogy egy parancsot kéne hozzá adni :   
/asd -> csak lvl1-es bandatag használhatja
/asd2 -> csak fõ bandatag (leader) használhatja
Köszike :D
« Utoljára szerkesztve: 2013. január 16. - 17:01:07 írta Rupert »

Nem elérhető Rupert

  • 2301
    • Profil megtekintése
Parancsok írása, hogyan?
« Válasz #1 Dátum: 2013. január 16. - 16:58:43 »
0 Show voters
[mod]Legközelebb valami konkrétabb nevet adj a témának...[/mod]
 
if(!strcmp(cmdtext, \"/asd\", true))
{
if(PlayerInfo[playerid][gang_rank] != 1) return SendClientMessage(playerid, -1, \"Nem vagy level 1-es banda tag.\");
return 1;
}
if(!strcmp(cmdtext, \"/asd2\", true))
{
if(PlayerInfo[playerid][gang_leader] != 1) return SendClientMessage(playerid, -1, \"Nem vagy banda leader.\");
return 1;
}

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal