problem with two commands
#2

Hmm, about the else if(sscanf the way you create sscanf is wrong. always start with if when making sscanf (( sorry if im bad in explaining ))

pawn Код:
CMD:hire(playerid,params[])
{
    new
        string[256],
        id,
        faction[64],
        targetid;
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /hire [id/name]");
    if(ProxDetectorS(6.0, playerid, targetid))
    {
        if(plInfo[playerid][pRank] == 6 && plInfo[playerid][pMember] != TEAM_CIVILIAN) return 1;
        if(id == INVALID_PLAYER_ID) return GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~Player is not connected.", 3000, 5);
        if(plInfo[id][pMember] != TEAM_CIVILIAN) return  GameTextForPlayer(playerid, "The player is hired already.", 3000, 5);

        format(faction, sizeof(faction), TeamInfo[plInfo[playerid][pMember]][TeamName]);
        format(string, sizeof(string), "You have been hired in %s", faction);
        SendClientMessage(playerid, COLOR_BLUE, string);
        plInfo[playerid][pRank] = 1;
        plInfo[playerid][pMember] = plInfo[playerid][pMember];
        gTeam[playerid] = plInfo[playerid][pMember];
        SetPlayerSpawn(playerid);
        SaveFactions();
    }
    else
    {
        GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~You aren't enough nearly to him", 3000, 5);
    }
    return 1;
}
CMD:fire(playerid,params[])
{
    new
        string[256],
        id,
        faction[64],
        targetid
    ;
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /fire [id/name]");

    if(ProxDetectorS(6.0, playerid, targetid))
    {
        if(plInfo[playerid][pRank] == 6 && plInfo[playerid][pMember] != TEAM_CIVILIAN) return 1;
        if(id == INVALID_PLAYER_ID) return GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~Player is not connected.", 3000, 5);

        format(faction, sizeof(faction), TeamInfo[plInfo[playerid][pMember]][TeamName]);
        format(string, sizeof(string), "You have been fired from %s", faction);
        SendClientMessage(playerid, COLOR_BLUE, string);
        plInfo[playerid][pRank] = 0;
        plInfo[playerid][pMember] = TEAM_CIVILIAN;
        gTeam[playerid] = TEAM_CIVILIAN;
        SetPlayerSpawn(playerid);
        SaveFactions();
    }
    else
    {
        GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~You aren't enough nearly to him", 3000, 5);
    }
    return 1;
}
Reply


Messages In This Thread
problem with two commands - by cecko1235 - 05.07.2013, 18:20
Re: problem with two commands - by ToiletDuck - 05.07.2013, 18:30
Re: problem with two commands - by cecko1235 - 05.07.2013, 21:05

Forum Jump:


Users browsing this thread: 1 Guest(s)