SA-MP Forums Archive
/weaps help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /weaps help (/showthread.php?tid=246345)



/weaps help - tanush - 03.04.2011

Well im trying to make if admin does /weaps [id], it will show what weapons that player has and how many ammos. please help
pawn Код:
CMD:weaps(playerid, params[])
{
    if(PlayerData[playerid][AdminLevel] > 0)
    {
        new id,str[128],WeapName[24],weap,name[MAX_PLAYER_NAME];
        if(sscanf(params,"u",id)) return SendClientMessage(playerid,0xFF9900AA,"USAGE: /weaps [id]");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF0000FF,"That user is not connected.");
        GetPlayerName(id,name,sizeof(name));
        GetWeaponName(weap,WeapName,sizeof(WeapName));
        format(str,sizeof(str),"|| %s Weapons ||",name);
        SendClientMessage(playerid,0xFF9900AA,str);
        format(str,sizeof(str),"%s(%d)",WeapName,GetPlayerAmmo(id));
        SendClientMessage(playerid,0xFF9900AA,str);
    }
    else return 0;
    return 1;
}



Re: /weaps help - Marricio - 03.04.2011

pawn Код:
CMD:weaps(playerid, params[])
{
    if(PlayerData[playerid][AdminLevel] > 0)
    {
        new id,str[128],WeapName[24],weap,name[MAX_PLAYER_NAME];
        if(sscanf(params,"u",id)) return SendClientMessage(playerid,0xFF9900AA,"USAGE: /weaps [id]");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF0000FF,"That user is not connected.");
        GetPlayerName(id,name,sizeof(name));
        new ammo = GetPlayerAmmo(playerid);
        GetWeaponName(weap,WeapName,sizeof(WeapName));
        format(str,sizeof(str),"|| Weapon name: %s --- Ammo: %d ||",name,ammo);
        SendClientMessage(playerid,0xFF9900AA,str);
        format(str,sizeof(str),"%s(%d)",WeapName,GetPlayerAmmo(id));
        SendClientMessage(playerid,0xFF9900AA,str);
    }
    else return 0;
    return 1;
}



Re: /weaps help - tanush - 03.04.2011

still wont work, it wont show gun name


Re: /weaps help - Marricio - 03.04.2011

pawn Код:
CMD:weaps(playerid, params[])
{
    if(PlayerData[playerid][AdminLevel] > 0)
    {
        new id,str[128],WeapName[24],weap,name[MAX_PLAYER_NAME];
        if(sscanf(params,"u",id)) return SendClientMessage(playerid,0xFF9900AA,"USAGE: /weaps [id]");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF0000FF,"That user is not connected.");
        GetPlayerName(id,name,sizeof(name));
        new ammo = GetPlayerAmmo(playerid);
        GetWeaponName(weap,WeapName,sizeof(WeapName));
        format(str,sizeof(str),"|| Weapon name: %s --- Ammo: %d ||",WeapName,ammo);
        SendClientMessage(playerid,0xFF9900AA,str);
        format(str,sizeof(str),"%s(%d)",WeapName,GetPlayerAmmo(id));
        SendClientMessage(playerid,0xFF9900AA,str);
    }
    else return 0;
    return 1;
}
There, fixed:P


Re: /weaps help - tanush - 03.04.2011

it still wont work, it shows
pawn Код:
|| Weapon name:  --- Ammo: -31073 ||
(-31073)
in server while i have an desert eagle pistol with 99999 ammmo