Jump to content
  • 0

Problema /createclan


Invictus

Question

Problema intalnita (descriere): As vrea o solutie despre cum as putea sa ia leader cel care a creat clanul
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul(obligatoriu):  
 

CMD:createclan(playerid, params[])
{
    new cname[64], tag[24], tagtype;
    if(gLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "You are not logged in.");
    if(PlayerInfo[playerid][pCoins] < 1000) return SendClientMessage(playerid, COLOR_ERROR, "You don't have enough Gold. To create a clan you need to have 1000 gold.");
    if(PlayerInfo[playerid][pCMember] + PlayerInfo[playerid][pCLeader] != 0) return SendClientMessage(playerid, COLOR_ERROR, "You already are in a clan. You can't create one.");
    if(sscanf(params,"s[24]iis[64]",tag,tagtype,cname)) return SendClientMessage(playerid, COLOR_SYN, "Synthax:{FFFFFF} /createclan <tag> <tagtype (0 before / 1 after)> <name> | (!)Cost: 1000 gold");
    {
        if(ExistClan(tag)) return SendClientMessage(playerid, COLOR_ERROR, "Clan already exist.");
        if(strlen(tag) > 10) return SendClientMessage(playerid, COLOR_ERROR, "Clan tag is to long.");
        if(strlen(cname) > 32) return SendClientMessage(playerid, COLOR_ERROR, "Clan name is to long.");

        TotalClans ++;

        strmid(ClanInfo[TotalClans][cName], cname, 0, 32, 32);
        strmid(ClanInfo[TotalClans][cTag], tag, 0, 10, 10);
        ClanInfo[TotalClans][cTagType] = tagtype;
        ClanInfo[TotalClans][cSlots] = 10;

        gQuery[0] = (EOS);
        mysql_format(handle, gQuery, sizeof(gQuery) ,"INSERT INTO `clans` (`Name`,`Tag`,`TagType`,`Slots`) VALUES ('%e','%e',%d,%d)",
        ClanInfo[TotalClans][cName],
        ClanInfo[TotalClans][cTag],
        ClanInfo[TotalClans][cTagType],
        ClanInfo[TotalClans][cSlots]);
        mysql_query(handle ,gQuery);

        format(gString,sizeof(gString),"Clan - %s - (ID:%d) with tag: %s and %d slots was created. Type [/shop] to buy more slots.", ClanInfo[TotalClans][cName], TotalClans, ClanInfo[TotalClans][cTag], ClanInfo[TotalClans][cSlots]);
        SendClientMessage(playerid, COLOR_SYN2,gString);

        format(gString, sizeof(gString), "%s created a clan: %s - (ID:%d) with tag: %s and %d slots.",GetName(playerid),ClanInfo[TotalClans][cName], TotalClans, ClanInfo[TotalClans][cTag], ClanInfo[TotalClans][cSlots]);
        CMDRaport(gString, 5, 0);
        PlayerInfo[playerid][pCoins] -= 1000;
        Update(playerid, pCoinsx);
    }
    return 1;
}


Imagini / Video (optional): -
Ati incercat sa rezolvati singur?: Da, am incercat mai multe variante dar mereu imi dadeau erori.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Try this.

CMD:createclan(playerid, params[])
{
    new cname[64], tag[24], tagtype;
    if(gLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "You are not logged in.");
    if(PlayerInfo[playerid][pCoins] < 1000) return SendClientMessage(playerid, COLOR_ERROR, "You don't have enough Gold. To create a clan you need to have 1000 gold.");
    if(PlayerInfo[playerid][pCMember] + PlayerInfo[playerid][pCLeader] != 0) return SendClientMessage(playerid, COLOR_ERROR, "You already are in a clan. You can't create one.");
    if(sscanf(params,"s[24]iis[64]",tag,tagtype,cname)) return SendClientMessage(playerid, COLOR_SYN, "Synthax:{FFFFFF} /createclan <tag> <tagtype (0 before / 1 after)> <name> | (!)Cost: 1000 gold");
    {
        if(ExistClan(tag)) return SendClientMessage(playerid, COLOR_ERROR, "Clan already exist.");
        if(strlen(tag) > 10) return SendClientMessage(playerid, COLOR_ERROR, "Clan tag is to long.");
        if(strlen(cname) > 32) return SendClientMessage(playerid, COLOR_ERROR, "Clan name is to long.");

        TotalClans ++;

        strmid(ClanInfo[TotalClans][cName], cname, 0, 32, 32);
        strmid(ClanInfo[TotalClans][cTag], tag, 0, 10, 10);
        ClanInfo[TotalClans][cTagType] = tagtype;
        ClanInfo[TotalClans][cSlots] = 10;

        gQuery[0] = (EOS);
        mysql_format(handle, gQuery, sizeof(gQuery) ,"INSERT INTO `clans` (`Name`,`Tag`,`TagType`,`Slots`) VALUES ('%e','%e',%d,%d)",
        ClanInfo[TotalClans][cName],
        ClanInfo[TotalClans][cTag],
        ClanInfo[TotalClans][cTagType],
        ClanInfo[TotalClans][cSlots]);
        mysql_query(handle ,gQuery);
        new i = cache_insert_id();

        format(gString,sizeof(gString),"Clan - %s - (ID:%d) with tag: %s and %d slots was created. Type [/shop] to buy more slots.", ClanInfo[TotalClans][cName], TotalClans, ClanInfo[TotalClans][cTag], ClanInfo[TotalClans][cSlots]);
        SendClientMessage(playerid, COLOR_SYN2,gString);

        format(gString, sizeof(gString), "%s created a clan: %s - (ID:%d) with tag: %s and %d slots.",GetName(playerid),ClanInfo[TotalClans][cName], TotalClans, ClanInfo[TotalClans][cTag], ClanInfo[TotalClans][cSlots]);
        CMDRaport(gString, 5, 0);
        PlayerInfo[playerid][pCoins] -= 1000;
        PlayerInfo[playerid][pCLeader] = i;
        Update(playerid, pCoinsx);
    }
    return 1;
}

 

j3V8Znq.png

5IGyOAw.png

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.