sscanf inside strcmp
#1

Hello all,

I tried to make a sscanf parameter after the strcmp check but it didn't work

pawn Код:
COMMAND:gang(playerid, params[])
{
    new string[128], gName[128], Query[200], gID[5], DBResult:Result, pName[MAX_PLAYER_NAME];
    if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, Yellow, "Usage: /gang <create>");
    GetPlayerName(playerid, pName, sizeof(pName));
    if (!strcmp("create", params, true))
    {
        if(PlayerInfo[playerid][Gang] != 0) return SendClientMessage(playerid, Red, "..");
        if(sscanf(params, "s[128]", gName)) return SendClientMessage(playerid, Yellow, "Usage: /gang <create> <gangname>");
        if(CheckGangByName(gName)) return SendClientMessage(playerid, Yellow, "..");
        format(Query, sizeof(Query), "INSERT INTO `GANGS` (`ID`, `NAME`, `OWNER`) VALUES (NULL, '%s', '%s');", gName, pName);
        db_query(Database, Query);
        format(Query, sizeof(Query), "SELECT * FROM `USERS` WHERE `NAME` = '%s'", pName);
        Result = db_query(Database, Query);
        db_get_field_assoc(Result, "ID", gID, 5);
        PlayerInfo[playerid][Gang] = strval(gID);
        format(Query, sizeof(Query), "UPDATE `USERS` SET `GANG` = '%d' WHERE `NAME` = '%s'", PlayerInfo[playerid][Gang], pName);
        db_query(Database, Query);
        format(string, sizeof(string), "... Name: %s. ID: %d", gName, PlayerInfo[playerid][Gang]);
        SendClientMessage(playerid, Green, string);
    }
    return 1;
}
If I type /gang create, the gang name will be "create".. How to do it?
Reply


Messages In This Thread
sscanf inside strcmp - by Cowboy - 20.10.2011, 10:43
Re: sscanf inside strcmp - by System64 - 20.10.2011, 10:44
Re: sscanf inside strcmp - by vassilis - 20.10.2011, 10:44
Re: sscanf inside strcmp - by Cowboy - 20.10.2011, 10:45
Re: sscanf inside strcmp - by =WoR=Varth - 20.10.2011, 10:46
Re: sscanf inside strcmp - by Cowboy - 20.10.2011, 10:48
Re: sscanf inside strcmp - by =WoR=Varth - 20.10.2011, 10:51
Re: sscanf inside strcmp - by System64 - 20.10.2011, 10:52
Re: sscanf inside strcmp - by Cowboy - 20.10.2011, 10:54
Re: sscanf inside strcmp - by System64 - 20.10.2011, 10:58

Forum Jump:


Users browsing this thread: 1 Guest(s)