/weaps problem
#1

Can anyone please fix this command:

pawn Код:
CMD:weaps(playerid, params[])
{
    new id,string[128];
    if(PlayerInfo[playerid][Level] < 1)
        return SendClientMessage(playerid, COLOR_RED,"You need to be Basic Moderator to use this command");

    if(sscanf(params,"i",id)) {
        SendClientMessage(playerid, COLOR_RED,""Server_Grey"USAGE: /weaps [id]");
        SendClientMessage(playerid, COLOR_RED,""Server_Grey"Function: This will show what weapon player have");
        return 1;
    }
   
    if(!IsPlayerConnected(id))
        return SendClientMessage(playerid, COLOR_RED,"Player is not connected");

    new Count,w,a,wName[24];

    for(new solt = 0; solt != 12; solt ++) {
   
        GetPlayerWeaponData(id, solt, w, a);
       
        if( w != 0 && a != 0)
            Count ++;
        }
    }
   
    if(Count < 1)
        return SendClientMessage(playerid, COLOR_RED,"This player dont have weapon!");

    if(Count >= 1)
    {
        for(new solt = 0; solt != 12; solt ++)
        {
            new nName[24];
            GetPlayerWeaponData(id, solt, w, a);
           
            if(w != 0 && a != 0)
            {
                GetWeaponName(w, nName, 24);
                format(string,128,"Weapon: %s. Ammo: %d.",wName,a);
                SendClientMessage(playerid, COLOR_WHITE,string);
            }
        }
    }
    return 1;
}
ERRORS:

Код:
D:\DOCUME~1\DR0517~1.LOZ\Desktop\MyServer\GAMEMO~1\gm.pwn(1261) : warning 204: symbol is assigned a value that is never used: "wName"
D:\DOCUME~1\DR0517~1.LOZ\Desktop\MyServer\GAMEMO~1\gm.pwn(1248) : warning 204: symbol is assigned a value that is never used: "string"
D:\DOCUME~1\DR0517~1.LOZ\Desktop\MyServer\GAMEMO~1\gm.pwn(1248 -- 1270) : warning 209: function "cmd_weaps" should return a value
D:\DOCUME~1\DR0517~1.LOZ\Desktop\MyServer\GAMEMO~1\gm.pwn(1248 -- 1272) : error 010: invalid function or declaration
D:\DOCUME~1\DR0517~1.LOZ\Desktop\MyServer\GAMEMO~1\gm.pwn(1248 -- 1273) : error 010: invalid function or declaration
D:\DOCUME~1\DR0517~1.LOZ\Desktop\MyServer\GAMEMO~1\gm.pwn(1248 -- 1275) : error 010: invalid function or declaration
D:\DOCUME~1\DR0517~1.LOZ\Desktop\MyServer\GAMEMO~1\gm.pwn(1248 -- 1275) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#2

try this
pawn Код:
CMD:weaps(playerid, params[])
{
    new id,string[128];
    if(PlayerInfo[playerid][Level] < 1)
        return SendClientMessage(playerid, COLOR_RED,"You need to be Basic Moderator to use this command");

    if(sscanf(params,"i",id)) {
        SendClientMessage(playerid, COLOR_RED,""Server_Grey"USAGE: /weaps [id]");
        SendClientMessage(playerid, COLOR_RED,""Server_Grey"Function: This will show what weapon player have");
        return 1;
    }

    if(!IsPlayerConnected(id))
        return SendClientMessage(playerid, COLOR_RED,"Player is not connected");

    new Count,w,a,wName[24];

    for(new solt = 0; solt != 12; solt ++) {

        GetPlayerWeaponData(id, solt, w, a);

        if( w != 0 && a != 0)
            Count ++;
        }

    if(Count < 1)
        return SendClientMessage(playerid, COLOR_RED,"This player dont have weapon!");

    if(Count >= 1)
    {
        for(new solt = 0; solt != 12; solt ++)
        {
            new nName[24];
            GetPlayerWeaponData(id, solt, w, a);

            if(w != 0 && a != 0)
            {
                GetWeaponName(w, nName, 24);
                format(string,128,"Weapon: %s. Ammo: %d.",wName,a);
                SendClientMessage(playerid, COLOR_WHITE,string);
            }
        }
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Naruto_Emilio
Посмотреть сообщение
try this
pawn Код:
CMD:weaps(playerid, params[])
{
    new id,string[128];
    if(PlayerInfo[playerid][Level] < 1)
        return SendClientMessage(playerid, COLOR_RED,"You need to be Basic Moderator to use this command");

    if(sscanf(params,"i",id)) {
        SendClientMessage(playerid, COLOR_RED,""Server_Grey"USAGE: /weaps [id]");
        SendClientMessage(playerid, COLOR_RED,""Server_Grey"Function: This will show what weapon player have");
        return 1;
    }

    if(!IsPlayerConnected(id))
        return SendClientMessage(playerid, COLOR_RED,"Player is not connected");

    new Count,w,a,wName[24];

    for(new solt = 0; solt != 12; solt ++) {

        GetPlayerWeaponData(id, solt, w, a);

        if( w != 0 && a != 0)
            Count ++;
        }

    if(Count < 1)
        return SendClientMessage(playerid, COLOR_RED,"This player dont have weapon!");

    if(Count >= 1)
    {
        for(new solt = 0; solt != 12; solt ++)
        {
            new nName[24];
            GetPlayerWeaponData(id, solt, w, a);

            if(w != 0 && a != 0)
            {
                GetWeaponName(w, nName, 24);
                format(string,128,"Weapon: %s. Ammo: %d.",wName,a);
                SendClientMessage(playerid, COLOR_WHITE,string);
            }
        }
    }
    return 1;
}
also help one more thing Please

it dont show the weapon names
Reply
#4

You use wName in GetWeaponName... but use nName in the formatting?
pawn Код:
GetWeaponName(w, nName, 24);
                format(string,128,"Weapon: %s. Ammo: %d.",wName,a);
Reply
#5

LOL sry
Reply
#6

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
You use wName in GetWeaponName... but use nName in the formatting?
pawn Код:
GetWeaponName(w, nName, 24);
                format(string,128,"Weapon: %s. Ammo: %d.",wName,a);
didn't understood what the hell you said

just tell me how to fix
Reply
#7

It's not that hard to... misunderstand...
You use wName in GetWeaponName... but use nName in the formatting?

I am basically telling you what to do... change wName to nName... think a little.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)