Lil help
#1

Well i make vip chat but when i type in /vchat and talk it works and i could hear my other friend but when i type, he cant see what i typed or what he typed
pawn Код:
CMD:vchat(playerid, params[])
{
    new id,str[128], name[MAX_PLAYER_NAME];
    if(sscanf(params,"s",str)) return SendClientMessage(playerid,0xFF9900AA, "USAGE: /vchat [text]");
    GetPlayerName(playerid,name,sizeof(name));
    format(str, sizeof(str), "[VIPCHAT] %s: %s",name,str);
    {
        if(IsPlayerConnected(id))
        {
            if(PlayerData[playerid][vip] > 0)
            {
            SendClientMessage(id,0xFF9900AA,str);
            }
        }
    }
    return 1;
}
Reply
#2

That's now how you properly create a cmd.
pawn Код:
CMD:vchat(playerid, params[])
{
    new
        pID,
        pName[MAX_PLAYER_NAME],
        iStr[128];

    if(sscanf(params, "us[128]", pID, params)) return SendClientMessage(playerid, 0xFF9900AA, "USAGE: /vchat [text]"); // Assuming you are using sscanf2, if not change to: "us"

    GetPlayerName(pID, pName, sizeof(pName));

    format(iStr, sizeof(iStr), "[VIPCHAT] %s: %s", pName, params);
    if(IsPlayerConnected(pID)) SendClientMessage(pID, 0xFF9900AA, iStr);

    return 1;
}
Reply
#3

it wont work i get USAGE: /vchat [text]
Reply
#4

Ops, my bad. I read it wrong, try this:
pawn Код:
CMD:vchat(playerid, params[])
{
    if(PlayerData[playerid][vip] < 0) return SendClientMessage(playerid, 0xFF9900AA, "You cannot use this command!");

    new
        iName[MAX_PLAYER_NAME],
        iStr[128];

    if(isnull(params)) return SendClientMessage(playerid, 0xFF9900AA, "Usage: /VChat < Message >");

    GetPlayerName(playerid, iName, sizeof(iName));

    for(new i = 0; i < MAX_PLAYERS; ++i)
    {
        if(IsPlayerConnected(i) && !IsPlayerNPC(i))
        {
            if(PlayerData[i][vip] > 0)
            {
                format(iStr, sizeof(iStr), "[VIPCHAT] %s: %s", iName, params);
                SendClientMessage(i, 0xFF9900AA, iStr);
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)