Weird problem.
#1

pawn Код:
stock AddGroupPermission(group, permission)
{
    if(!GroupInfo[group][GroupPermissions][permission])
    {
        new     query[128];
        format(query, sizeof(query), "INSERT INTO group_permissions (permissionid, gid) VALUES (%i, %i)", permission, group);
        mysql_query(query);
        GroupInfo[group][GroupPermissions][permission] = true;
    }
}

COMMAND:addgrouppermission(playerid, params[])
{
    new     group;
    new     permission_id;
    new     str[128];

    if(PlayerHasPermission(playerid, PERMISSION_ADDGROUPPERMISSION) || IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "ui", group, permission_id))
        {
            SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /addgrouppermission <groupid> <permissionid>");
            SendClientMessage(playerid, COLOR_WHITE, "INFO: To view permission id type (/listpermissions) and to view group id's type (/listgroups)");
        }
        else
        {
            format(str, 128, "You have added permission id %i to group %s", permission_id, GroupInfo[group][gName]);
            SendClientMessage(playerid, COLOR_YELLOW, "Group created");
            print("wtfs?");
            AddGroupPermission(group, permission_id);
            print("wtf??");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_YELLOW, "You don't have permission for this command.");
    }
    return true;
}
It stops executing at AddGroupPermission(), what's wrong there?

EDIT: Fixed, in sscanf 'u' needed to be 'i', silly me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)