SA-MP Forums Archive
Some problem with zcmd and sscanf. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Some problem with zcmd and sscanf. (/showthread.php?tid=448393)



Some problem with zcmd and sscanf. - FuznesS - 04.07.2013

Solved, can deleted.


Re: Some problem with zcmd and sscanf. - RedFusion - 04.07.2013

pawn Код:
CMD:clan(playerid, params[])
{
    new param_0[24], param_1[24], string[256];
    if(sscanf(params, "s[10]S[25]", param_0, param_1)) return SendClientMessage(playerid, -1, "[Command] /clan [command]");

    if(!strcmp(param_0, "create", true))
    {
        if(strlen(param_1) == 0) return SendClientMessage(playerid, -1, "[Command] /clan create [name]");
        format(ClanFile, sizeof(ClanFile), "NewDM/Clans/%s.ini",cname);
        if(DOF2_GetInt(UserPath(playerid),"InClan") == 1) return SendClientMessage(playerid, -1, "You are already in clan.");
        if(DOF2_FileExists(ClanFile)) return SendClientMessage(playerid, -1, "This clan name is already exists, please pick another name.");
        if(GetPlayerMoney(playerid) < 150000) return SendClientMessage(playerid, -1, "You don't have enough money to create clan - $150,000.");
        DOF2_CreateFile(ClanFile);
        DOF2_SetString(ClanFile, "ClanName", cname);
        DOF2_SetString(ClanFile, "Leader", GetName(playerid));
        //======================================================================
        DOF2_SetString(UserPath(playerid), "ClanName", cname);
        DOF2_SetInt(UserPath(playerid), "InClan", 1);
        DOF2_SetInt(UserPath(playerid), "ClanLevel", 5);
        GivePlayerMoney(playerid, -150000);
        format(string, sizeof(string),"You successfully create (%s) clan.", cname);
        SendClientMessage(playerid,COLOR_LIGHTGREEN,string);
        SendClientMessage(playerid,COLOR_AQUA,"You are the Founder of the clan.");
        SendClientMessage(playerid,COLOR_WHITE,"you can use /clanhelp for more commands.");
        DOF2_SaveFile();
   }
   
   if(!strcmp(param_0, "invite", true))
    {
        new ID;
        if(strlen(param_1) == 0) return SendClientMessage(playerid, -1, "[Command] /clan invite [ID]");
        ID = strval(param_1);
        if(DOF2_GetInt(UserPath(playerid),"InClan") == 0) return SendClientMessage(playerid, -1, "You not own any clan.");
        if(DOF2_GetInt(UserPath(playerid),"ClanLevel") < 5) return SendClientMessage(playerid, -1, "Your clan level is not high enough.");
        if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,COLOR_RED, "This player is offline.");
        if(ID == playerid)SendClientMessage(playerid,COLOR_RED,"You can't invite yourself to the clan.");
        if(DOF2_GetInt(UserPath(ID), "InClan") == 1) return SendClientMessage(playerid, COLOR_RED, "This player already in clan.");
        format(string, sizeof(string),"You invited (%s) to your clan", GetName(ID));
        SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
        format(string,sizeof(string),"Player (%s) invited you to his clan (%s).", GetName(playerid), PlayerInfo[playerid][pClanName]);
        SendClientMessage(ID,COLOR_LIGHTGREEN,string);
        SendClientMessage(ID,COLOR_GREEN,"If you want to join his clan use /clan join.");
        ClanInviter[ID] = playerid;
        InviteToClan[ID] = 1;

    }
    return 1;
}



Re: Some problem with zcmd and sscanf. - FuznesS - 04.07.2013

Thank you its works good now,
I changed the Big "S" to small "s" and its works fine now.
by the way when I'm typing now /clan create
its reponse back "[command] /clan [command]"
and not "[command] /clan create [name]"