SA-MP Forums Archive
[Solved] Problem with /factionname - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Solved] Problem with /factionname (/showthread.php?tid=106892)



[Solved] Problem with /factionname - Benne - 06.11.2009

Hello there, I got a problem with the commands /factionname and /factionrank, I will post the first few lines, cause rest is the same.
Errors are posted in the pawn code.

pawn Код:
if(strcmp(cmd, "/factionname", true) == 0) // Dstoft
    {
      if(IsPlayerConnected(playerid))
      {
            if(PlayerInfo[playerid][pAdmin] < 4) { SendClientMessage(playerid, COLOR_RED, "  Acces Denied!"); return 1; }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
              SendClientMessage(playerid, COLOR_WHITE, "Command: /factionname [number] [newname]");
                return 1;
            }
            new File: hFile;
            hFile = fopen("faction.ini", io_write);
            new faction = strval(tmp);
            if(faction == 1)
            {
                GetPlayerName(playerid, sendername, sizeof(sendername));
                new length = strlen(cmdtext);
                while ((idx < length) && (cmdtext[idx] <= ' '))
                {
                    idx++;
                }
                new offset = idx;
                new result[64];
                while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                {
                    result[idx - offset] = cmdtext[idx];
                    idx++;
                }
                result[idx - offset] = EOS;
                if(!strlen(result))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "Command: /factionname [number] [newname]");
                    return 1;
                }
                new FactionName; // \VW-RP.pwn(12555) : warning 203: symbol is never used: "FactionName"
                format(FactionName,sizeof(FactionName), "Faction Name = %s", result); // This error x2 \VW-RP.pwn(12556) : error 035: argument type mismatch (argument 1)
                fwrite(hFile, FactionName); // \VW-RP.pwn(12557) : error 035: argument type mismatch (argument 2)
                fclose(hFile);
                return 1;




Re: [Help] Problem with /factionname - Benne - 06.11.2009

Bumb, second page.


Re: [Help] Problem with /factionname - Hiitch - 06.11.2009

what does factionName equal?

it should be something like

FactionName[64] or FactionName[128]


Re: [Help] Problem with /factionname - Benne - 06.11.2009

God thank you, biggest mistake I've ever done, I should know that.
Thank you for reminding me. xD