Unknow Command.
#1

PHP код:
#include <a_samp>
#include <streamer>
#include <zcmd>
#include <foreach>
#define MAX_DROP_ITEMS 1000
#define COLOR_ACTION 0xFFC0CBFF
new string[128], sendername[MAX_PLAYER_NAME], DropObject[MAX_DROP_ITEMS];
enum dData
{
    
DropGunAmmount[2],
    
Float:DropGunPosX,
    
Float:DropGunPosY,
    
Float:DropGunPosZ,
    
DropGunVWorld,
    
DropGunInterior,
};
new 
DropInfo[MAX_DROP_ITEMS][dData];
new 
GunObjectIDs[200] ={
   
1575,  331333334335336337338339341321322323324325326342343344, -1,  -, -,
   
346347348349350351352353355356372357358359360361362363364365366367,
   
3683691575
};
stock GetGunObjectID(WeaponID)
{
    if (
WeaponID || WeaponID 64)
    {
        return 
1575;
    }
    return 
GunObjectIDs[WeaponID];
}
stock DropGun(playeridGunIDGunAmmoFloat:XFloat:YFloat:Zworldinterior)
{
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,sizeof(name));
    if(
GunID != && GunAmmo != 0)
    {
        for(new 
0sizeof(DropInfo); i++)
        {
            if(
DropInfo[i][DropGunPosX] == 0.0 && DropInfo[i][DropGunPosY] == 0.0 && DropInfo[i][DropGunPosZ] == 0.0)
            {
                
DropInfo[i][DropGunAmmount][0] = GunID;
                
DropInfo[i][DropGunAmmount][1] = GunAmmo;
                
DropInfo[i][DropGunPosX] = X;
                
DropInfo[i][DropGunPosY] = Y;
                
DropInfo[i][DropGunPosZ] = Z;
                
DropInfo[i][DropGunVWorld] = world;
                
DropInfo[i][DropGunInterior] = interior;
                
DropObject[i] = CreateDynamicObject(GetGunObjectID(GunID), XYZ-180.00.00.0world);
                return 
1;
            }
        }
        return 
1;
    }
    return 
1;
}
stock RemovePlayerWeapon(playeridweaponid)
{
    if(!
IsPlayerConnected(playerid) || weaponid || weaponid 50)
        return;
    new 
saveweapon[13], saveammo[13];
    for(new 
slot 0slot 13slot++)
        
GetPlayerWeaponData(playeridslotsaveweapon[slot], saveammo[slot]);
    
ResetPlayerWeapons(playerid);
    for(new 
slotslot 13slot++)
    {
        if(
saveweapon[slot] == weaponid || saveammo[slot] == 0)
            continue;
        
GivePlayerWeapon(playeridsaveweapon[slot], saveammo[slot]);
    }
    
GivePlayerWeapon(playerid01);
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    new 
Float:X,Float:Y,Float:Z;
    
GetPlayerPos(playeridXYZ);
    
DropGun(playeridGetPlayerWeapon(playerid),GetPlayerAmmo(playerid),X,Y,Z,GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/dropgun"cmdtexttrue10) == 0)
    {
        new 
Float:X,Float:Y,Float:Z;
        new 
GunID GetPlayerWeapon(playerid);
        new 
GunAmmo GetPlayerAmmo(playerid);
        
GetPlayerName(playeridsendernamesizeof(sendername));
        
GetPlayerPos(playeridXYZ);
        
RemovePlayerWeapon(playeridGunID);
        
DropGun(playeridGunID,GunAmmo,X,Y,Z,GetPlayerVirtualWorld(playerid),GetPlayerInterior(playerid));
        return 
1;
    }
    if (
strcmp("/dropgun"cmdtexttrue10) == 0)
    {
        for(new 
0sizeof(DropInfo); i++)
        {
            if (
IsPlayerInRangeOfPoint(playerid2.0,DropInfo[i][DropGunPosX],DropInfo[i][DropGunPosY],DropInfo[i][DropGunPosZ]))
            {
                if(
GetPlayerVirtualWorld(playerid) == DropInfo[i][DropGunVWorld] && GetPlayerInterior(playerid) == DropInfo[i][DropGunVWorld])
                {
                    
GetPlayerName(playeridsendernamesizeof(sendername));
                    
DestroyDynamicObject(DropObject[i]);
                    
DropInfo[i][DropGunPosX] = 0.0;
                    
DropInfo[i][DropGunPosY] = 0.0;
                    
DropInfo[i][DropGunPosZ] = 0.0;
                    
DropInfo[i][DropGunAmmount][0] = 0;
                    
DropInfo[i][DropGunAmmount][1] = 0;
                    
GivePlayerWeapon(playerid,DropInfo[i][DropGunAmmount][0],DropInfo[i][DropGunAmmount][1]);
                    return 
1;
                }
            }
        }
            return 
1;
    }
    return 
1;

This is not working,I compiled it but I have NO errors.Not even warnings but when I test the IG and use this cmd it returns UNKNOWN COMMAND.Please help me.
ThAnKs!
Reply
#2

Well, you're using strcmp to handle commands, aren't you? Then you should remove this line
pawn Код:
#include <zcmd>
Edit:

Just a tip: OnPlayerCommandText should return 0 so other commands could be reached.
Reply
#3

Still not fixed please help.
Reply
#4

Check all the OnPlayerCommandText callbacks in all your scripts and make them return 0 NOT 1.
Reply
#5

Not even working please can you change it for me in the script.
Reply
#6

Well, I ran your script in my server and it worked (without including zcmd). Are you sure that OnPlayerCommandText doesn't return 1 (or any value that is not 0) in any of your scripts?

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/command", true))
    {
        // Code
        return 1;
    }
    return 0; // returning 0
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)