/givewep command problem
#2

pawn Код:
CMD:givewep(playerid,params[])
{
    if(pInfo[playerid][Logged] == 0) return SCM(playerid,0x0080C0FF,"Please login before using this command.");
    if(pInfo[playerid][Admin] >= 3)
    {
    if(GetPVarInt(playerid,"CmdTime")>GetTickCount())return SCM(playerid,0xFF0000FF,"Please wait before using this command again.");
    new Target;
    new Weapid;
    new amt;
    if(sscanf(params,"uid",Target, Weapid,amt)) return SCM(playerid,0xff0000FF,"Usage /givewep [playerid] [weaponid] [ammo]");
    if(Target == INVALID_PLAYER_ID) return SCM(playerid,red,"Error: Wrong player ID");
    if(Weapid == 36 || Weapid == 37 || Weapid == 38 || Weapid == 41 || Weapid == 43 || Weapid == 44 || Weapid == 45) return SCM(playerid,0xff0000FF,"Error: Invalid weapon id.");
    if(Weapid < 0 || Weapid > 46) return SCM(playerid,0xFFFFFFFF,"You have entered an invalid weapon id.");
    if(amt > 999) return SCM(playerid,0xff0000FF,"Error: You can give a max of 999 ammo for weapon.");
    GivePlayerWeapon(Target,Weapid,amt);
    new tname[MAX_PLAYER_NAME];
    GetPlayerName(Target,tname,sizeof(tname));
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pname,sizeof(pname));
    new tstring[110];
    new pstring[110];
    new echos[128];
    format(tstring,sizeof(tstring),"You have received weapon id %d with %d ammo from %s (%d).",Weapid,amt,pname,playerid);
    format(pstring,sizeof(pstring),"You have given weapon id %d with %d ammo to %s (%d).",Weapid,amt,tname,Target);
    format(echos,sizeof(echos),"1,8** Admin %s (%d) has given weapon id %d with %d ammo to %s (%d)",pname,playerid,Weapid,amt,tname,Target);
    SCM(Target,COLOR_BLUE,tstring);
    SCM(playerid,COLOR_BLUE,pstring);
    IRC_GroupSay(gGroupID, IRC_CHANNEL, echos);
    IRC_GroupSay(gGroupID, IRC_ACHANNEL, echos);
    SetPVarInt(playerid,"CmdTime",GetTickCount()+2000);
    pInfo[Target][AdminActions]++;
    }
    return 1;
}
Try that, also try correcting those indents, makes the code look strange
Reply


Messages In This Thread
/givewep command problem - by Face9000 - 05.04.2013, 21:27
Re: /givewep command problem - by MattyG - 05.04.2013, 21:37
Re: /givewep command problem - by Face9000 - 05.04.2013, 21:39
Re: /givewep command problem - by BigGroter - 05.04.2013, 21:45
Re: /givewep command problem - by MattyG - 05.04.2013, 21:48
Re: /givewep command problem - by Face9000 - 05.04.2013, 22:00

Forum Jump:


Users browsing this thread: 1 Guest(s)