another problem with my cmd
#2

pawn Код:
irccmd_plinfo(conn, channel[], user[], params[])
{
    #pragma unused conn , params , user , channel

    if(!IsPlayerOp(conn,channel,user)) return AccessDenied(user);

    new string[284];
    new player1;
    new playerid;
    if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
        new Float:player1health, Float:player1armour, playerip[128], Float:x, Float:y, Float:z;

        GetPlayerHealth(player1,player1health);
        GetPlayerArmour(player1,player1armour);
        GetPlayerIp(player1, playerip, sizeof(playerip));
        GetPlayerPos(player1,x,y,z);

        format(string, sizeof(string),"7,4(Player Info) ---====> Name: %s ID: %d <====---", PlayerName(player1), player1);
        IRC_GroupSay(GroupID[0], EchoChan, string);
        format(string, sizeof(string),"7,4Health: %d Armour: %d | Score: %d | Cash: %d | Skin: %d | IP: %s | Ping: %d | ",floatround(player1health),floatround(player1armour),
        GetPlayerScore(player1),GetPlayerMoney(player1),GetPlayerSkin(player1),playerip,GetPlayerPing(player1));
        IRC_GroupSay(GroupID[0], EchoChan, string);
        format(string, sizeof(string),"7,4Interior: %d | Virtual World: %d | Wanted Level: %d X %0.1f Y %0.1f Z %0.1f", GetPlayerInterior(player1), GetPlayerVirtualWorld(player1), GetPlayerWantedLevel(player1), Float:x,Float:y,Float:z);
        IRC_GroupSay(GroupID[0], EchoChan, string);

        if(IsPlayerInAnyVehicle(player1)) {
            new Float:VHealth, carid = GetPlayerVehicleID(playerid); GetVehicleHealth(carid,VHealth);
            format(string, sizeof(string),"7,4VehicleID: %d | Model: %d | Vehicle Name: %s | Vehicle Health: %d",carid, GetVehicleModel(carid), VehicleNames[GetVehicleModel(carid)-400], floatround(VHealth) );
            IRC_GroupSay(GroupID[0], EchoChan, string);
        }

        new slot, ammo, weap, Count1, WeapName[24], WeapSTR[128], p; WeapSTR = "7,4Weaps: ";
        for (slot = 0; slot < 14; slot++)
        {  
            GetPlayerWeaponData(player1, slot, weap, ammo); if( ammo != 0 && weap != 0) Count1++;
        }
        if(Count1 < 1)
            return SendClientMessage(playerid,lightblue,"7,4Player has no weapons");
        else
        {
            for (slot = 0; slot < 14; slot++)
            {
                GetPlayerWeaponData(player1, slot, weap, ammo);
                if (ammo > 0 && weap > 0)
                {
                    GetWeaponName(weap, WeapName, sizeof(WeapName) );
                    if (ammo == 65535 || ammo == 1) format(WeapSTR,sizeof(WeapSTR),"7,4%s%s (1)",WeapSTR, WeapName);
                    else format(WeapSTR,sizeof(WeapSTR),"7,4%s|%s (%d)",WeapSTR, WeapName, ammo);
                    p++;
                    if(p >= 5)
                    {
                        SendClientMessage(playerid, lightblue, WeapSTR); format(WeapSTR, sizeof(WeapSTR), "7,4Weaps: "); p = 0;
                    } else format(WeapSTR, sizeof(WeapSTR), "7,4%s, ", WeapSTR);
                }
            }
            if(p <= 4 && p > 0) {
                string[strlen(string)-3] = '.';
                IRC_GroupSay(GroupID[0], EchoChan, WeapSTR);
            }
            return 0;
        }
    } else
        return format(string, sizeof(string),"7,4Sorry please enter a vaild id"); IRC_GroupSay(GroupID[0], EchoChan, string);
}
Number 1, please include your comments outside of the actual code tags. Number 2, please use pawn tags when posting pawn code. As to your problems. The first one is just bad indentation, simply fix the spacing on that piece of code (as shown above). Second, unreachable code means it is impossible to reach that piece of code.This is really badly formatted code but something is returned for every if statement and therefore, the final return 1; is not needed, simply because it will never be reached.

Lastly, as the compiler says, they are simply warnings and not errors. Your code should still run and compile fine if thats all you got. You can either take them for what they're worth and correct your code (recommended), or simply ignore them.
Reply


Messages In This Thread
another problem with my cmd - by [HKS]dlegend - 21.11.2009, 02:00
Re: another problem with my cmd - by Calix - 21.11.2009, 02:54
Re: another problem with my cmd - by [HKS]dlegend - 21.11.2009, 04:52

Forum Jump:


Users browsing this thread: 1 Guest(s)