PDA

View Full Version : .:[Help]:. /cw Command.


TuSheng
25/03/2015, 07:21 AM
Hi Guys , I Got A Problem.
When I'm Admin And I Want To Check Player's Weapons & Ammo , But It Always Pop Up " * You Have No Permission To Use This Command !" But I'm An Admin , All Admin(Level) Can't Use That Command , Idk Why , I Tried To Solved But I'm A Newbie , So Someone Can Help Me To Let All Admins(Level) Can Use That Command? Thanks !

Sorry About My Bad English Btw.

Here Is My Code , Something Went Wrong?

CMD:cw(playerid, params[])
{
if(pInfo[playerid][Adminlevel] <= 0)
{
new count = 0;
new ammo, weaponid, weapon[30], string26[150], id;
if(!sscanf(params, "u", id))
{
for (new c = 0; c < 13; c++)
{
GetPlayerWeaponData(id, c, weaponid, ammo);
if (weaponid != 0 && ammo != 0)
{
count++;
}
}
SendClientMessage(playerid, COLOR_ORANGE, "||{FF8000}============={FFFF00} Weapons And Ammo {FF8000}===========||");
if(count > 0)
{
for (new c = 0; c < 13; c++)
{
GetPlayerWeaponData(id, c, weaponid, ammo);
if (weaponid != 0 && ammo != 0)
{
GetWeaponName(weaponid, weapon, 24);
format(string26, sizeof(string26), "Weapons: {A8FFA8}%s {FF0000}.:. {00FF00}Ammo: {A8FFA8}%d", weapon, ammo);
SendClientMessage(playerid, COLOR_GREEN, string26);
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "* This Player Has No Weapons !");
}
return 1;
}
else return SendClientMessage(playerid, COLOR_RED, "[Usage]: /cw [PlayerID]");
}
else return SendClientMessage(playerid, COLOR_RED, "* You Have No Permission To Use This Command !");
}

Mya
25/03/2015, 07:30 AM
Try This, this is just for admin level 1 can use this command

CMD:cw(playerid, params[])
{
if(pInfo[playerid][Adminlevel] <= 1)
{
new count = 0;
new ammo, weaponid, weapon[30], string26[150], id;
if(!sscanf(params, "u", id))
{
for (new c = 0; c < 13; c++)
{
GetPlayerWeaponData(id, c, weaponid, ammo);
if (weaponid != 0 && ammo != 0)
{
count++;
}
}
SendClientMessage(playerid, COLOR_ORANGE, "||{FF8000}============={FFFF00} Weapons And Ammo {FF8000}===========||");
if(count > 0)
{
for (new c = 0; c < 13; c++)
{
GetPlayerWeaponData(id, c, weaponid, ammo);
if (weaponid != 0 && ammo != 0)
{
GetWeaponName(weaponid, weapon, 24);
format(string26, sizeof(string26), "Weapons: {A8FFA8}%s {FF0000}.:. {00FF00}Ammo: {A8FFA8}%d", weapon, ammo);
SendClientMessage(playerid, COLOR_GREEN, string26);
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "* This Player Has No Weapons !");
}
return 1;
}
else return SendClientMessage(playerid, COLOR_RED, "[Usage]: /cw [PlayerID]");
}
else return SendClientMessage(playerid, COLOR_RED, "* You Have No Permission To Use This Command !");
}

DeitY
25/03/2015, 07:37 AM
if(pInfo[playerid][Adminlevel] <= 0)

Means that only people with Admin level 0 and below can use this command.

If u wish to every admin above level 1 and plus use this, simply

if(pInfo[playerid][Adminlevel] > 0)

TuSheng
25/03/2015, 09:26 AM
Try This, this is just for admin level 1 can use this command

CMD:cw(playerid, params[])
{
if(pInfo[playerid][Adminlevel] <= 1)
{
new count = 0;
new ammo, weaponid, weapon[30], string26[150], id;
if(!sscanf(params, "u", id))
{
for (new c = 0; c < 13; c++)
{
GetPlayerWeaponData(id, c, weaponid, ammo);
if (weaponid != 0 && ammo != 0)
{
count++;
}
}
SendClientMessage(playerid, COLOR_ORANGE, "||{FF8000}============={FFFF00} Weapons And Ammo {FF8000}===========||");
if(count > 0)
{
for (new c = 0; c < 13; c++)
{
GetPlayerWeaponData(id, c, weaponid, ammo);
if (weaponid != 0 && ammo != 0)
{
GetWeaponName(weaponid, weapon, 24);
format(string26, sizeof(string26), "Weapons: {A8FFA8}%s {FF0000}.:. {00FF00}Ammo: {A8FFA8}%d", weapon, ammo);
SendClientMessage(playerid, COLOR_GREEN, string26);
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "* This Player Has No Weapons !");
}
return 1;
}
else return SendClientMessage(playerid, COLOR_RED, "[Usage]: /cw [PlayerID]");
}
else return SendClientMessage(playerid, COLOR_RED, "* You Have No Permission To Use This Command !");
}

Thanks For Helping Me :D DeitY Solved My Problem , Anyway Thank You.

if(pInfo[playerid][Adminlevel] <= 0)

Means that only people with Admin level 0 and below can use this command.

If u wish to every admin above level 1 and plus use this, simply

if(pInfo[playerid][Adminlevel] > 0)

Thanks I Get It Now , Thanks For Helping Me :3

Sorry About My Bad/Poor English.