SA-MP Forums Archive
Weird problem. - 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: Weird problem. (/showthread.php?tid=262294)



Weird problem. - WooTFTW - 17.06.2011

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