SA-MP Forums Archive
Does not work.UNKNOWN COMMAND. - 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)
+--- Thread: Does not work.UNKNOWN COMMAND. (/showthread.php?tid=367955)



Does not work.UNKNOWN COMMAND. - TaLhA XIV - 11.08.2012

PHP код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
" Blank Filterscript by your name here");
    print(
"--------------------------------------\n");
    return 
1;
}
public 
OnFilterScriptExit()
{
    return 
1;
}
#else
main()
{
    print(
"\n----------------------------------");
    print(
" Blank Gamemode by your name here");
    print(
"----------------------------------\n");
}
#endif
public OnGameModeInit()
{
    
// Don't use these lines if it's a filterscript
    
SetGameModeText("Blank Script");
    
AddPlayerClass(01958.37831343.157215.3746269.1425000000);
    return 
1;
}
public 
OnGameModeExit()
{
    return 
1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraLookAt(playerid1958.37831343.157215.3746);
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    return 
1;
}
public 
OnVehicleSpawn(vehicleid)
{
    return 
1;
}
public 
OnVehicleDeath(vehicleidkillerid)
{
    return 
1;
}
public 
OnPlayerText(playeridtext[])
{
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
CMD:minus(playerid,params[])
    {
        new 
Float:f1,Float:f2;
        if(
sscanf(params,"ff",f1,f2)) return SendClientMessage(playerid,-1,"Usage: /minus <first value><second value>");
        new 
Float:output f1-f2;
        new 
string[128];
        
format(string,sizeof(string),"Your answer is: %f",output);
        
SendClientMessage(playerid,-1,string);
        return 
1;
    }
CMD:multiplay(playerid,params[])
    {
        new 
Float:f1,Float:f2;
        if(
sscanf(params,"ff",f1,f2)) return SendClientMessage(playerid,-1,"Usage: /multiplay <first value><second value>");
        new 
Float:output f1*f2;
        new 
string[128];
        
format(string,sizeof(string),"Your answer is: %f",output);
        
SendClientMessage(playerid,-1,string);
        return 
1;
    }
CMD:plus(playerid,params[])
    {
        new 
Float:f1,Float:f2;
        if(
sscanf(params,"ff",f1,f2)) return SendClientMessage(playerid,-1,"Usage: /plus <first value><second value>");
        new 
Float:output f1+f2;
        new 
string[128];
        
format(string,sizeof(string),"Your answer is: %f",output);
        
SendClientMessage(playerid,-1,string);
        return 
1;
    }
CMD:divide(playerid,params[])
    {
        new 
Float:f1,Float:f2;
        if(
sscanf(params,"ff",f1,f2)) return SendClientMessage(playerid,-1,"Usage: /divide <first value><second value>");
        new 
Float:output f1/f2;
        new 
string[128];
        
format(string,sizeof(string),"Your answer is: %f",output);
        
SendClientMessage(playerid,-1,string);
        return 
1;
    }
return 
0;

Okay I tried to make a filterscript but it does not work.It says unknown command.Please can someone fix this for me.


Re: Does not work.UNKNOWN COMMAND. - phillip875 - 11.08.2012

Don't do CMD:example(playerid,params[])

Inside of any callback.

That is your problem.


Re: Does not work.UNKNOWN COMMAND. - RedJohn - 11.08.2012

pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    return 1;
}
CMD:minus(playerid,params[])
{
    new Float:f1,Float:f2;
    if(sscanf(params,"ff",f1,f2)) return SendClientMessage(playerid,-1,"Usage: /minus <first value><second value>");
    new Float:output = f1-f2;
    new string[128];
    format(string,sizeof(string),"Your answer is: %f",output);
    SendClientMessage(playerid,-1,string);
    return 1;
}
CMD:multiplay(playerid,params[])
{
    new Float:f1,Float:f2;
    if(sscanf(params,"ff",f1,f2)) return SendClientMessage(playerid,-1,"Usage: /multiplay <first value><second value>");
    new Float:output = f1*f2;
    new string[128];
    format(string,sizeof(string),"Your answer is: %f",output);
    SendClientMessage(playerid,-1,string);
    return 1;
}
CMD:plus(playerid,params[])
{
    new Float:f1,Float:f2;
    if(sscanf(params,"ff",f1,f2)) return SendClientMessage(playerid,-1,"Usage: /plus <first value><second value>");
    new Float:output = f1+f2;
    new string[128];
    format(string,sizeof(string),"Your answer is: %f",output);
    SendClientMessage(playerid,-1,string);
    return 1;
}
CMD:divide(playerid,params[])
{
    new Float:f1,Float:f2;
    if(sscanf(params,"ff",f1,f2)) return SendClientMessage(playerid,-1,"Usage: /divide <first value><second value>");
    new Float:output = f1/f2;
    new string[128];
    format(string,sizeof(string),"Your answer is: %f",output);
    SendClientMessage(playerid,-1,string);
    return 1;
}