[Pedido] zcmd para strcmp
#1

Se alguйm ai puder fazer pra mim, eu agradeзo e +++rep vlw flw


pawn Код:
CMD:bbhelp(playerid, params[])
{
    SCM(playerid, -1, "[Boombox Commands]: /placeboombox /pickupboombox /setboombox");
    return 1;
}

CMD:abhelp(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_WHITE, "You are not authorized to use this command");
    SCM(playerid, -1, "[Boombox Commands]: /giveboombox");
    return 1;
}

CMD:giveboombox(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_WHITE, "You are not authorized to use this command");
    new targetid, string[128], pname[MAX_PLAYER_NAME];
    if(sscanf(params,"u", targetid)) return SCM(playerid, COLOR_WHITE, "USAGE:/giveboombox [playerid]");
    Boombox[targetid] = 1;
    GetPlayerName(targetid, pname, sizeof(pname));
    format(string, sizeof(string), "You Have Given %s a Boombox", pname);
    SCM(playerid, COLOR_LIGHTBLUE, string);
    SCM(targetid, COLOR_LIGHTBLUE, "You have been given a boombox by an administrator(/bbhelp)");
    return 1;
}

CMD:placeboombox(playerid, params[])
{
    new string[128], Float:BBCoord[4], pName[MAX_PLAYER_NAME];
    GetPlayerPos(playerid, BBCoord[0], BBCoord[1], BBCoord[2]);
    GetPlayerFacingAngle(playerid, BBCoord[3]);
    SetPVarFloat(playerid, "BBX", BBCoord[0]);
    SetPVarFloat(playerid, "BBY", BBCoord[1]);
    SetPVarFloat(playerid, "BBZ", BBCoord[2]);
    GetPlayerName(playerid, pName, sizeof(pName));
    BBCoord[0] += (2 * floatsin(-BBCoord[3], degrees));
    BBCoord[1] += (2 * floatcos(-BBCoord[3], degrees));
    BBCoord[2] -= 1.0;
    if(Boombox[playerid] == 0) return SCM(playerid, COLOR_WHITE, "You don't have a Boombox - Ask a Admin for one");
    if(GetPVarInt(playerid, "PlacedBB")) return SCM(playerid, -1, "You already placed a Boombox - use /pickupboombox");
    foreach(Player, i)
    {
        if(GetPVarType(i, "PlacedBB"))
        {
            if(IsPlayerInRangeOfPoint(playerid, 30.0, GetPVarFloat(i, "BBX"), GetPVarFloat(i, "BBY"), GetPVarFloat(i, "BBZ")))
            {
                SCM(playerid, COLOR_WHITE, "You cannot put your boombox in this Radius as their is already one placed in this radius");
                return 1;
            }
        }
    }
    new string2[128];
    format(string2, sizeof(string2), "%s has placed down an boombox!", pName);
    SendNearbyMessage(playerid, 15, string2, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
    SetPVarInt(playerid, "PlacedBB", CreateDynamicObject(2226, BBCoord[0], BBCoord[1], BBCoord[2], 0.0, 0.0, 0.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
    format(string, sizeof(string), "Boombox Owner: %s\nUse /setboombox to set your boombox\n/pickupboombox to Pick up your boombox", pName);
    SetPVarInt(playerid, "BBLabel", _:CreateDynamic3DTextLabel(string, -1, BBCoord[0], BBCoord[1], BBCoord[2]+0.6, 5, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
    SetPVarInt(playerid, "BBArea", CreateDynamicSphere(BBCoord[0], BBCoord[1], BBCoord[2], 30.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)));
    SetPVarInt(playerid, "BBInt", GetPlayerInterior(playerid));
    SetPVarInt(playerid, "BBVW", GetPlayerVirtualWorld(playerid));
    ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
    ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
    return 1;
}

CMD:setboombox(playerid, params[])
{
    if(GetPVarType(playerid, "PlacedBB"))
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0, GetPVarFloat(playerid, "BBX"), GetPVarFloat(playerid, "BBY"), GetPVarFloat(playerid, "BBZ")))
        {
            ShowPlayerDialog(playerid,DIALOG_BOOMBOX,DIALOG_STYLE_LIST,"Radio List","Jazz\nPop\nRap\nR&B and Urban\nRock\nCountry\nEnter URL\nTurn Off Boombox","Select", "Cancel");
        }
        else
        {
            return SCM(playerid, -1, "You're not near in your BoomBox!");
        }
    }
    else
    {
        SCM(playerid, -1, " You don't have a boombox placed down!");
    }
    return 1;
}

CMD:pickupboombox(playerid, params [])
{
    if(!GetPVarInt(playerid, "PlacedBB"))
    {
        SCM(playerid, -1, "You haven't placed a Boombox!");
    }
    if(IsPlayerInRangeOfPoint(playerid, 3.0, GetPVarFloat(playerid, "BBX"), GetPVarFloat(playerid, "BBY"), GetPVarFloat(playerid, "BBZ")))
    {
        PickUpBoombox(playerid);
        SCM(playerid, -1, "Boombox picked up successfully.");
    }
    return 1;
}
Reply
#2

Teste ai para vc ver se deu serto!
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/bbhelp", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid,-1,"[Boombox Commands]: /placeboombox /pickupboombox /setboombox");
        return 1;
    }
    if (strcmp("/abhelp", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "You are not authorized to use this command");
        SendClientMessage(playerid, -1, "[Boombox Commands]: /giveboombox");
        return 1;
    }
    if (strcmp("/giveboombox", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "You are not authorized to use this command");
        new targetid, string[128], pname[MAX_PLAYER_NAME];
        if(sscanf(cmdtext,"u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE:/giveboombox [playerid]");
        Boombox[targetid] = 1;
        GetPlayerName(targetid, pname, sizeof(pname));
        format(string, sizeof(string), "You Have Given %s a Boombox", pname);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        SendClientMessage(targetid, COLOR_LIGHTBLUE, "You have been given a boombox by an administrator(/bbhelp)");
        return 1;
    }
    if (strcmp("/placeboombox", cmdtext, true, 10) == 0)
    {
        new string[128], Float:BBCoord[4], pName[MAX_PLAYER_NAME];
        GetPlayerPos(playerid, BBCoord[0], BBCoord[1], BBCoord[2]);
        GetPlayerFacingAngle(playerid, BBCoord[3]);
        SetPVarFloat(playerid, "BBX", BBCoord[0]);
        SetPVarFloat(playerid, "BBY", BBCoord[1]);
        SetPVarFloat(playerid, "BBZ", BBCoord[2]);
        GetPlayerName(playerid, pName, sizeof(pName));
        BBCoord[0] += (2 * floatsin(-BBCoord[3], degrees));
        BBCoord[1] += (2 * floatcos(-BBCoord[3], degrees));
        BBCoord[2] -= 1.0;
        if(Boombox[playerid] == 0) return SendClientMessage(playerid, COLOR_WHITE, "You don't have a Boombox - Ask a Admin for one");
        if(GetPVarInt(playerid, "PlacedBB")) return SendClientMessage(playerid, -1, "You already placed a Boombox - use /pickupboombox");
        foreach(Player, i)
        {
            if(GetPVarType(i, "PlacedBB"))
            {
                if(IsPlayerInRangeOfPoint(playerid, 30.0, GetPVarFloat(i, "BBX"), GetPVarFloat(i, "BBY"), GetPVarFloat(i, "BBZ")))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "You cannot put your boombox in this Radius as their is already one placed in this radius");
                    return 1;
                }
            }
        }
        new string2[128];
        format(string2, sizeof(string2), "%s has placed down an boombox!", pName);
        SendNearbyMessage(playerid, 15, string2, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
        SetPVarInt(playerid, "PlacedBB", CreateDynamicObject(2226, BBCoord[0], BBCoord[1], BBCoord[2], 0.0, 0.0, 0.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
        format(string, sizeof(string), "Boombox Owner: %s\nUse /setboombox to set your boombox\n/pickupboombox to Pick up your boombox", pName);
        SetPVarInt(playerid, "BBLabel", _:CreateDynamic3DTextLabel(string, -1, BBCoord[0], BBCoord[1], BBCoord[2]+0.6, 5, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
        SetPVarInt(playerid, "BBArea", CreateDynamicSphere(BBCoord[0], BBCoord[1], BBCoord[2], 30.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)));
        SetPVarInt(playerid, "BBInt", GetPlayerInterior(playerid));
        SetPVarInt(playerid, "BBVW", GetPlayerVirtualWorld(playerid));
        ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
        ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
        return 1;
    }
    if (strcmp("/setboombox", cmdtext, true, 10) == 0)
    {
        if(GetPVarType(playerid, "PlacedBB"))
        {
            if(IsPlayerInRangeOfPoint(playerid, 3.0, GetPVarFloat(playerid, "BBX"), GetPVarFloat(playerid, "BBY"), GetPVarFloat(playerid, "BBZ")))
            {
                ShowPlayerDialog(playerid,DIALOG_BOOMBOX,DIALOG_STYLE_LIST,"Radio List","Jazz\nPop\nRap\nR&B and Urban\nRock\nCountry\nEnter URL\nTurn Off Boombox","Select", "Cancel");
            }
            else
            {
                return SendClientMessage(playerid, -1, "You're not near in your BoomBox!");
            }
        }
        else
        {
            SendClientMessage(playerid, -1, " You don't have a boombox placed down!");
        }
        return 1;
    }
    if (strcmp("/setboombox", cmdtext, true, 10) == 0)
    {
        if(!GetPVarInt(playerid, "PlacedBB"))
        {
            SendClientMessage(playerid, -1, "You haven't placed a Boombox!");
        }
        if(IsPlayerInRangeOfPoint(playerid, 3.0, GetPVarFloat(playerid, "BBX"), GetPVarFloat(playerid, "BBY"), GetPVarFloat(playerid, "BBZ")))
        {
            PickUpBoombox(playerid);
            SendClientMessage(playerid, -1, "Boombox picked up successfully.");
        }
        return 1;
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)