#1

When I try to compile my group system it shows I am a noob scripter i got that system from ****** search btw

Can you compile this system for me?
Код:
C:\Users\NC\Desktop\sdsad.pwn(69) : warning 217: loose indentation
C:\Users\NC\Desktop\sdsad.pwn(76) : warning 217: loose indentation
C:\Users\NC\Desktop\sdsad.pwn(82) : warning 217: loose indentation
C:\Users\NC\Desktop\sdsad.pwn(94) : warning 217: loose indentation
C:\Users\NC\Desktop\sdsad.pwn(102) : warning 217: loose indentation
C:\Users\NC\Desktop\sdsad.pwn(132) : warning 217: loose indentation
C:\Users\NC\Desktop\sdsad.pwn(146) : warning 217: loose indentation
C:\Users\NC\Desktop\sdsad.pwn(190) : warning 217: loose indentation
C:\Users\NC\Desktop\sdsad.pwn(193) : warning 217: loose indentation
C:\Users\NC\Desktop\sdsad.pwn(199) : warning 217: loose indentation
C:\Users\NC\Desktop\sdsad.pwn(205) : warning 217: loose indentation
C:\Users\NC\Desktop\sdsad.pwn(208) : warning 217: loose indentation
C:\Users\NC\Desktop\sdsad.pwn(256) : warning 217: loose indentation
C:\Users\NC\Desktop\sdsad.pwn(270) : warning 217: loose indentation
C:\Users\NC\Desktop\sdsad.pwn(275) : warning 217: loose indentation
C:\Users\NC\Desktop\sdsad.pwn(286) : warning 217: loose indentation
C:\Users\NC\Desktop\sdsad.pwn(293) : warning 217: loose indentation
C:\Users\NC\Desktop\sdsad.pwn(307) : error 030: compound statement not closed at the end of file (started at line 299)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Group system:

Код:
/*
trablon's Group System with mySQL R7 version
Script coder: trablon(Onur AKAN)
NOTE: Don't forget to check my topic on forum.sa-mp.com

---[INFO FOR SCRIPT]---

table name: groups
columns: gID(int),gName(varchar=128),gLeaderName(varchar=32),gchat(int),gTAG(varchar=5) ...

---[INFO FOR YOUR DATABASE(players)]---
table name: yourplayerstable
columns: grouppid(int),grouprank(varchar=32) ...

*/
//====================================================================[includes]
#include <a_samp>
#include <a_mysql>
#include <zcmd>
#include <sscanf2>
//=================================================================[definitions]
#define COLOR_GREY            0xAFAFAFAA
#define COLOR_RED        0xFF6347AA
#define COLOR_GREEN      0x9ACD32AA

#define MAX_GROUPS       20//you can change it, if you know what you are doing.

enum groupsDATA
{
        gID,
        gName[128],
        gLeaderName[32],
        gchat,
        gTAG
};
new GroupInfo[MAX_GROUPS][groupsDATA];
new mysql=1; // remember..Don't forget to delete it when you are copying the codes to your gamemode
new groupid=-1;
enum playerDATA
{
        grouppid,
        grouprank[32]
};
new pInfo[MAX_PLAYERS][playerDATA];
new groupvariables[MAX_PLAYERS][2];
// =============================================================================
public OnFilterScriptInit()
{
        print("_________________________________________________________________________");
        print("> trablon's Group System - ALPHA");
        print("> Script Name : Group System");
        print("> Script Version : ALPHA");
        print("> Script Coder : trablon");
        print("> Last Update : 22/07/2015");
        print("> mySQL Version : R7 - threaded queries");
        print("_________________________________________________________________________");
        return 1;
}

public OnFilterScriptExit()
{
        return 1;
}

public OnPlayerConnect(playerid)
{
    groupvariables[playerid][0] = -1;
    groupvariables[playerid][1] = 0;
        return 1;
}

public OnPlayerDisconnect(playerid,reason)
{
    groupvariables[playerid][0] = -1;
    groupvariables[playerid][1] = 0;
        return 1;
}

public OnPlayerSpawn(playerid)
{
    SetTagforPlayer(playerid,GroupInfo[pInfo[playerid][grouppid]][gTAG]);
        return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        if(dialogid == 1)
        {
            new str[128];
            if(!response)
            {
                format(str,sizeof(str),"[SYSTEM]: '%s' has declined your invite.",GetPlayerNamee(playerid));
                SendClientMessage(groupvariables[playerid][0],COLOR_RED,str);
                        SendClientMessage(playerid,COLOR_RED,"[SYSTEM]: You have declined the invite.");
                        groupvariables[playerid][0] = -1;
                        groupvariables[playerid][1] = 0;
            }
            if(response)
            {
                format(str,sizeof(str),"[SYSTEM]: '%s' has accepted your invite.",GetPlayerNamee(playerid));
                SendClientMessage(groupvariables[playerid][0],COLOR_GREEN,str);
                        SendClientMessage(playerid,COLOR_RED,"[SYSTEM]: You have accepted the invite.");
                        pInfo[playerid][grouppid] = pInfo[groupvariables[playerid][0]][grouppid];
                        groupvariables[playerid][0] = -1;
                        groupvariables[playerid][1] = 0;
            }
        }
        return 1;
}

stock LoadGroups()
{
        return mysql_function_query(mysql, "SELECT * FROM `groups`", true, "GroupsInformation", "");
}

stock SendGroupMessage(color, groupID, string[])
{
        for(new i;i<MAX_PLAYERS;i++)
        {
                if(pInfo[i][grouppid] == groupID)
                {
                    SendClientMessage(i, color, string);
                }
        }
        return 1;
}

forward GroupsInformation();
public GroupsInformation()
{
        new rows,fields,szQueryOutput[128];
    cache_get_data(rows, fields);

    if(rows)
        {
        for(new x = 0; x < rows; x++)
                {
            cache_get_row(x, 0, szQueryOutput); // gID
            GroupInfo[x][gID] = strval(szQueryOutput);
            cache_get_field_content(x, "gName", szQueryOutput); // group name
            format(GroupInfo[x][gName],sizeof(szQueryOutput),szQueryOutput);
            cache_get_field_content(x, "gLeaderName", szQueryOutput);
            format(GroupInfo[x][gLeaderName],sizeof(szQueryOutput),szQueryOutput);
              }
    }
        return 1;
}

forward MYSQL_SaveGroups(b);
public MYSQL_SaveGroups(b)
{
        new query[128];
        mysql_format(mysql,query, sizeof(query), "UPDATE `groups` SET `gchat` = %d, `gTAG` = %d,`gName` = '%s', `gLeaderName` = '%s' WHERE `gID` = %d",
        GroupInfo[b][gchat],GroupInfo[b][gTAG],GroupInfo[b][gName],GroupInfo[b][gLeaderName],GroupInfo[b][gID]);
        mysql_tquery(mysql, query, "", "");
        return 1;
}

forward GroupCreated(b);
public GroupCreated(b)
{

    GroupInfo[b][gID] = cache_insert_id();
    groupid++;
    printf("New Group is created: [%d]", groupid );
}

stock GetPlayerNamee(playerid)
{
      new name[MAX_PLAYER_NAME];
      GetPlayerName(playerid, name, MAX_PLAYER_NAME);
      return name;
}

stock SetTagforPlayer(playerid,tag[])
{
  new name[MAX_PLAYER_NAME];
  new newname[30];
  GetPlayerName(playerid,name,MAX_PLAYER_NAME);
  format(newname,sizeof(newname),"[%s]%s",tag,name);
  SetPlayerName(playerid,newname);
  return 1;
}

CMD:creategroup(playerid, params[])
{
    new grID = groupid+1,query[128],player,str[128];
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: You have to log in as a rcon admin.");
    if(sscanf(params, "u", player)) return SendClientMessage(playerid,COLOR_GREY,"[USAGE]: /creategroup [Player ID/Player Name]");
        if(!IsPlayerConnected(player)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: Player hasn't connected to server yet.");
        if(pInfo[player][grouppid] != 0) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: Player already is in a group.");
        if(playerid == player) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: You can't give a group to yourself.");
    GroupInfo[grID][gID] = grID;
    GroupInfo[grID][gchat] = 0;
    format(GroupInfo[grID][gTAG],5,"None");
    pInfo[player][grouppid] = grID; // change this line with your player variable.DONT FORGET IT!
    format(GroupInfo[grID][gName],128,"None");
    format(GroupInfo[grID][gLeaderName],32,GetPlayerNamee(player));
        mysql_format(mysql, query, sizeof(query), "INSERT INTO `groups` (`gID`, `gchat`, `gTAG`, `gName`, `gLeaderName`) VALUES (%d,%d,%d,'%s','%s')",
        grID+1,
        GroupInfo[grID][gchat],
        GroupInfo[grID][gTAG],
        GroupInfo[grID][gName],
        GroupInfo[grID][gLeaderName]);
    mysql_tquery(mysql, query, "GroupCreated", "i",grID);
    format(str,sizeof(str),"[SUCCESS]: '%s' named group has created for '%s'.",GroupInfo[grID][gName],GroupInfo[grID][gLeaderName]);
    SendClientMessage(playerid,COLOR_GREEN,str);
        return 1;
}
CMD:ginvite(playerid,params[])
{
        new player,str[128],id=pInfo[playerid][grouppid];
        if(strcmp(GroupInfo[id][gLeaderName], GetPlayerNamee(playerid)) != 0) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: You are not a leader of any group.");
        if(groupvariables[playerid][1] == 1) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: You need to wait for response of your invite.");
        if(sscanf(params, "u", player)) return SendClientMessage(playerid,COLOR_GREY,"[USAGE]: /creategroup [Player ID/Player Name]");
        if(!IsPlayerConnected(player)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: Player hasn't connected to server yet.");
        if(playerid == player) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: You can't invite yourself.");
        if(pInfo[player][grouppid] == pInfo[playerid][grouppid]) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: Player is already in your group.");
        groupvariables[player][0] = playerid;
        groupvariables[playerid][1] = 1;
        format(str,sizeof(str),"'%s' named group leader is inviting you to '%s' named group, what is your answer?",GroupInfo[id][gLeaderName],GroupInfo[id][gName]);
        ShowPlayerDialog(player, 1, DIALOG_STYLE_MSGBOX, "{808080}trablon's Group System", str, "Accept", "Decline");
        return 1;
}
CMD:g(playerid,params[])
{
        new str[128],string[128],id=pInfo[playerid][grouppid];
        if(pInfo[playerid][grouppid] == 0) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: You are not in any group.");
        if(GroupInfo[id][gchat] == 1) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: Group chat has closed by leader of the group.");
        if(sscanf(params, "s[128]", str)) return SendClientMessage(playerid,COLOR_GREY,"[USAGE]: /g [Group Chat]");
        format(string,sizeof(string),"[GROUP-CHAT(%s)] %s: %s",GroupInfo[id][gName],GetPlayerNamee(playerid),str);
        SendGroupMessage(0x8080FFFF, id, string);
        return 1;
}
CMD:gkick(playerid,params[])
{
        new str[128],id=pInfo[playerid][grouppid],player;
        if(strcmp(GroupInfo[id][gLeaderName], GetPlayerNamee(playerid)) != 0) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: You are not a leader of any group.");
        if(sscanf(params, "u", player)) return SendClientMessage(playerid,COLOR_GREY,"[USAGE]: /gkick [Player ID/Player Name]");
        if(!IsPlayerConnected(player)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: Player hasn't connected to server yet.");
        if(playerid == player) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: You can't kick yourself.");
        if(pInfo[player][grouppid] != pInfo[playerid][grouppid]) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: Player is not in your group.");
        format(str,sizeof(str),"[GROUP-ATTENTION(%s)]: %s named group leader has kicked '%s' named player from your group.",GroupInfo[id][gName],GetPlayerNamee(playerid),GetPlayerNamee(player));
        SendGroupMessage(0x8080FFFF, id, str);
        return 1;
}
CMD:gonline(playerid,params[])
{
        new str[168],string[168 * 4];
        if(pInfo[playerid][grouppid] == 0) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: You are not in any group.");
        for(new i=0; i < MAX_PLAYERS; i++)
        {
            if(pInfo[playerid][grouppid] == pInfo[i][grouppid])
            {
                format(str,sizeof(str),"{FFFFFF}Online Member: %s\tID:%d\tRank:%s\n",GetPlayerNamee(i),i,pInfo[i][grouprank]);
                        strcat(string, str);
            }
        }
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_MSGBOX, "{808080}Buddy's Group System", str, "Close", "");
        return 1;
}
CMD:setrank(playerid,params[])
{
        new str[32],id=pInfo[playerid][grouppid],player,string[128];
        if(strcmp(GroupInfo[id][gLeaderName], GetPlayerNamee(playerid)) != 0) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: You are not a leader of any group.");
        if(sscanf(params, "us[32]", player,str)) return SendClientMessage(playerid,COLOR_GREY,"[USAGE]: /setrank [Player ID/Player Name] [New Rank Name]");
        if(!IsPlayerConnected(player)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: Player hasn't connected to server yet.");
        if(playerid == player) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: You can't kick yourself.");
        if(pInfo[player][grouppid] != pInfo[playerid][grouppid]) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: Player is not in your group.");
    format(pInfo[player][grouprank],32,str);
    format(string,sizeof(string),"[SYSTEM]: '%s' has changed your rank as '%s' in the group.",GetPlayerNamee(playerid),str);
    SendClientMessage(player,COLOR_GREEN,string);
    format(string,sizeof(string),"[SYSTEM]: You have changed '%s' named player's rank as '%s' in the group.",GetPlayerNamee(player),str);
    SendClientMessage(playerid,COLOR_GREEN,string);
        return 1;
}
CMD:gchatlock(playerid,params[])
{
        new str[128],id=pInfo[playerid][grouppid];
        if(strcmp(GroupInfo[id][gLeaderName], GetPlayerNamee(playerid)) != 0) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: You are not a leader of any group.");
        if(GroupInfo[id][gchat] == 0)
        {
                GroupInfo[id][gchat] = 1;
                format(str,sizeof(str),"[GROUP-ATTENTION(%s)]: %s named group leader has locked the group chat.",GroupInfo[id][gName],GetPlayerNamee(playerid));
                SendGroupMessage(0x8080FFFF, id, str);
            return 1;
        }
        if(GroupInfo[id][gchat] == 1)
        {
                GroupInfo[id][gchat] = 0;
                format(str,sizeof(str),"[GROUP-ATTENTION(%s)]: %s named group leader has unlocked the group chat.",GroupInfo[id][gName],GetPlayerNamee(playerid));
                SendGroupMessage(0x8080FFFF, id, str);
            return 1;
        }
        return 1;
}
CMD:gtag(playerid,params[])
{
        new str[5],id=pInfo[playerid][grouppid],string[128];
        if(strcmp(GroupInfo[id][gLeaderName], GetPlayerNamee(playerid)) != 0) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: You are not a leader of any group.");
        if(sscanf(params, "s[5]",str)) return SendClientMessage(playerid,COLOR_GREY,"[USAGE]: /gtag [New Tag for GROUP]");
        if(strlen(str) > 5 || strlen(str) < 5 ) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: Your group tag must be set max. 5 character.");
        format(GroupInfo[id][gTAG],5,str);
        format(string,sizeof(string),"[GROUP-ATTENTION(%s)]: %s named group leader has changed group TAG as '%s'.",GroupInfo[id][gName],GetPlayerNamee(playerid),str);
        SendGroupMessage(0x8080FFFF, id, string);
        return 1;
Reply
#2

Did you put a closing bracket?
PHP код:
CMD:gtag(playerid,params[])
{
        new 
str[5],id=pInfo[playerid][grouppid],string[128];
        if(
strcmp(GroupInfo[id][gLeaderName], GetPlayerNamee(playerid)) != 0) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: You are not a leader of any group.");
        if(
sscanf(params"s[5]",str)) return SendClientMessage(playerid,COLOR_GREY,"[USAGE]: /gtag [New Tag for GROUP]");
        if(
strlen(str) > || strlen(str) < ) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: Your group tag must be set max. 5 character.");
        
format(GroupInfo[id][gTAG],5,str);
        
format(string,sizeof(string),"[GROUP-ATTENTION(%s)]: %s named group leader has changed group TAG as '%s'.",GroupInfo[id][gName],GetPlayerNamee(playerid),str);
        
SendGroupMessage(0x8080FFFFidstring);
        return 
1;

I also really suggest to take care of that loose indentations. Better for you, and better for the script.
Reply
#3

Those errors means that pawn cant read the code correctly because of a shitty placement of the code.

PHP код:
SendClientMessage(...)
    
SendClientMessage (...)//wrong 
PHP код:
SendClientMessage (...)
SendClientMessage (...)//correct 
another example goes

PHP код:
MyFunction(...)
SendClientMessage (...)
    
MySecondFunction(...)//wrong
return true
PHP код:
MyFunction(...)
SendClientMessage (...)
MySecondFunction(...)//correct
return true
Reply
#4

can you just correct it and give me back with the amx file??
Reply
#5

Quote:
Originally Posted by GangstaSunny.
Посмотреть сообщение
Those errors means that pawn cant read the code correctly because of a shitty placement of the code.

PHP код:
SendClientMessage(...)
    
SendClientMessage (...)//wrong 
PHP код:
SendClientMessage (...)
SendClientMessage (...)//correct 
another example goes

PHP код:
MyFunction(...)
SendClientMessage (...)
    
MySecondFunction(...)//wrong
return true
PHP код:
MyFunction(...)
SendClientMessage (...)
MySecondFunction(...)//correct
return true
I actually doubt that, i have seen scripts running with over 300+ loose indentations.
Reply
#6

Quote:
Originally Posted by Electron123
Посмотреть сообщение
can you just correct it and give me back with the amx file??
of course not. If are looking for a scripting service, this is the wrong section.
Reply
#7

Here you go.
Link
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)