katursis / pawn.cmd Goto Github PK
View Code? Open in Web Editor NEW🚀 Plugin-powered command processor for SA:MP server
License: MIT License
🚀 Plugin-powered command processor for SA:MP server
License: MIT License
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug] Stack pointer (STK) is 0x1DD8C50, heap pointer (HEA) is 0x1DD93C0
[debug] AMX backtrace:
[debug] #0 00117d00 in public dialog_DialogCompany (playerid=0, response=1, listitem=2, inputtext[]=@01dd93a4 "") at mod.pwn:12389
[debug] #1 native CallLocalFunction () from samp-server.exe
[debug] #2 00117d00 in public OnDialogResponse (playerid=0, dialogid=1, response=2, listitem=31298468, inputtext[]=@00000018 "") at \mod.pwn:12389
12389 - PC_EmulateCommand(playerid, "/sirket");
I have a command and it has a dialog, I am calling the same command when I press a list item in dialog. But it gives some problems.
Is it possible?
I tried setting a flag ANIMATIONS and it won't work, the enum for it is
enum { ANIMATIONS }
I have diffrent commands in different files stored.. say, in my main gm I include commands/main, in which I then include "commands/supporter", "commands/admin", "commands/highadmin"... .pwn files
after I included all files, I put the two callbacks at the end of commands/main.pwn - but calling my cmd results in invalid command message (flags always 0, seems the command isn't really declared.
#include "/../../gamemodes/commands/debug.pwn"
//#include "/../../gamemodes/commands/player.pwn"
//#include "/../../gamemodes/commands/supporter.pwn"
//#include "/../../gamemodes/commands/admin.pwn"
#include "/../../gamemodes/commands/head-admin.pwn"
//#include "/../../gamemodes/commands/projektleiter.pwn"*/
`public OnPlayerCommandReceived(playerid, cmd[], params[], flags)
{
if(!pInfo[playerid][loggedin])return 0;
DebugPrint("if([%d]%d < %d", playerid, pPermissions[playerid], flags);
if (pPermissions[playerid]<flags)
{
SendClientMessage(playerid, GREY, "* Du hast keinen Zugriff auf diesen Befehl.");
return 0;
}
return 1;
}
public OnPlayerCommandPerformed(playerid, cmd[], params[], result, flags)
{
if(result == -1)
{
SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: Unbekannter Befehl. ("HTML_RED"/help"#HTML_WHITE")");
return 0;
}
return 1;
}
I want to use a command like OnPlayerCommandText(playerid, "/kick");
I tried CMD:kick(playerid,"1");
But give error on compile.
Hello. I am coding for sa-mp for 5 days. But I can't find same issues in internet. So, my code is in filterscript:
#include <a_samp>
#include <mxINI>
#define FILTERSCRIPT
#include <Pawn.CMD>
#include <colors>
#include "cmd_flags"
cmd:a(playerid, args[])
{
printf("args count: %d", sizeof(args));
return 1;
}
public OnPlayerCommandReceived(playerid, cmd[], params[], flags)
{
new pname[30];
GetPlayerName(playerid, pname, 30);
new fname[50];
format(fname, 50, "users/%s.ini", pname);
new inif = ini_openFile(fname);
new pRang;
ini_getInteger(inif, "adminLevel", pRang);
ini_closeFile(inif);
if (flags > pRang)
{
SendClientMessage(playerid, RED, "You have no permissions for access this command");
return 0;
}
return 1;
}
public OnPlayerCommandPerformed(playerid, cmd[], params[], result, flags)
{
if (result == -1)
{
SendClientMessage(playerid, RED, "SERVER: Unknown command.");
return 0;
}
return 1;
}
public OnFilterScriptInit()
{
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
and when I type /a 1 2 3 in chat, my console says args count: 0
.
so sorry if this is dumb question but I tired of finding solve.
alias:
Hello, i want to run Open.MP project and when i start server i recieve this error:
Skipping legacy plugin 'pawncmd'; There is an open.mp compatible version you can find here: https://github.com/katursis/Pawn.CMD/releases , make sure to download x.x.x-omp version
I'm use pawncmd 3.3.6 omp version and i have same problem with the last pawncmd version
после выпуска 11 выпуск 9 не работает
[Pawn.CMD] HandleCommand: Call: amx_Exec(struct tagAMX *:02F3EF70, int *:0019F760, int:679): Array index out of bounds (4)
help me
omp-server: beta build 3
plugin: 3.3.6-omp
platform: Windows 11 64bit
[Info] Loaded 20 component(s)
[Info] Executing Server Config...
[15:20:41] [Info] [Pawn.CMD] plugin v3.3.6 loading...
[15:20:41] [Info] [Pawn.CMD]
| Pawn.CMD 3.3.6 | 2016 - 2022
|--------------------------------
| Author and maintainer: katursis
| Compiled: Apr 24 2022 at 17:16:06
|--------------------------------------------------------------
| Repository: https://github.com/katursis/Pawn.CMD
[15:20:41] [Info] Loading plugin: mysql
[15:20:41] [Info] >> plugin.mysql: R41-4 successfully loaded.
[15:20:41] [Info] Loading plugin: streamer
[15:20:41] [Info]
*** Streamer Plugin v2.9.5 by Incognito loaded ***
[15:20:41] [Error] Skipping legacy plugin 'pawncmd'; There is an open.mp compatible version you can find here: https://github.com/katursis/Pawn.CMD/releases , make sure to download x.x.x-omp version.
[15:20:41] [Info]
[15:20:41] [Info] *** fixes.inc info: Trying to unload RconCommand/ClientCheckResponse fix FS...
[15:20:41] [Info] *** Ignore any errors if the FS already unloaded.
[15:20:41] [Info]
Hello,
Pawn.CMD has been my favourite command processor for years and I have never had any problems with this great plugin. The flag and alias features of this just come in very handy and useful.
Since I heard that open.mp would not be compatible with Pawn.CMD because of the memory hacking in this plugin, I'm curious if there would be a compatible version for open.mp in the future? Otherwise, I would have to migrate to another command processor as I'm likely to move to open.mp soon.
Hi, I had this weird issue in my script a couple of times but I haven't been able to narrow down to what's the root cause of it. The issue is this and it does sometimes crash the server, other times it doesn't. Please provide information on how and what does the HandleCommand issue means and how to, if there is any solution to detect the ":0" issue. I believe it might be because of the new plugin library that you use because I haven't had the issue with it.
I was using 3.3.2, but I have switched to 3.3.3 after this issue. I will report if it still occurs because I have no idea how to reproduce it.
[18:25:29] [debug] Run time error 4: "Array index out of bounds"
[18:25:29] [debug] Attempted to read/write array element at index 115 in array of size 100
[18:25:29] [debug] AMX backtrace:
[18:25:29] [debug] #0 003ba4a8 in ?? (... <28 arguments>) at C:\some\fake\path\script.amx
[18:25:29] [debug] #1 00000075 in public pc_cmd_asay () at <unknown file>:0
[18:25:29] [Pawn.CMD] HandleCommand: Call: amx function (7) error 4```
Thanks!
Some natives from YSF plugin isn't added to OMP. (Like SetPlayerChatBubbleForPlayer.)
Are the missing natives planned to be added on next release?
Thank you.
Solved!
I'm trying to create flags based on admin level, but it's not working!
I wanted to prevent admins below level 3 from using /test command:
new CMD_ADM_1 = 1
new CMD_ADM_2 = 2
new CMD_ADM_3 = 3
new CMD_ADM_4 = 4
new CMD_ADM_5 = 5
new CMD_ADM_6 = 6
new PlayerCmdAdmin[MAX_PLAYERS];
PlayerCmdAdmin[playerid] = CMD_ADM_2;
flags:test(CMD_ADM_3 | CMD_ADM_4 | CMD_ADM_5 | CMD_ADM_6)
CMD:test(playerid)
{
return 1;
}
public OnPlayerCommandReceived(playerid, cmd[], params[], flags)
{
if(flags && !(flags & PlayerCmdAdmin[playerid]))
{
SendClientMessage(playerid,-1,"Not allowed!");
return 0;
}
return 1;
}
Performing hook on OnFilterScriptInit and OnGameModeInit provided #if defined FILTERSCRIPT is not necessary. The server performs only one callback, depending on the type of script. Therefore both callbacks use is not a problem.
Second suggestion if you could add other detection systems commands :)
#error Detected another command system
Hello!
I would like to use sscanf to detect and separate parameters to create command log which saves not only typed command but parameters, example: "The player Junior typed /ban 1 Hacking"
Can anybody help me?
public OnPlayerCommandPerformed(playerid, cmd[], params[], result, flags)
{
return 1;
}
But the files are from the same unzipped folder. Same problem with 3.3.6 version.
I wanted to know if it is possible to do something like this with Pawn.CMD, and if it is possible how to do it, thank you very much.
What do I mean by Guess Command? An example would be:
When you type e.g. "/hel"
public OnPlayerCommandPerformed(playerid, cmd[], params[], result, flags)
{
if(result == -1)
{
new guessCmd[32];
Command_GuessFunc(guessCmd, cmd);
SendClientMessageEx(playerid, -1, "{FF0000}ERROR:{FFFFFFFF} \"%s\" is not found, did you mean \"%s\"?", cmd, guessCmd);
}
return 1;
}
CMD:help(playerid) return 1;
Sorry for my bad English.
Hello
I'm work with YSI includes and concret include y_hook with Pawn.CMD worked problem.
When I compilare code so no't working command.
My server freezes randomly. In the event of a freeze, I am forced to turn it off and on again, as it does not defrost on its own. The 'Crashdetect' does not report any from gamemode function that may be "slow" at the time of freezing.
Q: How do I know the problem may have to do with this plugin (Pawn.CMD)?
A: I tested the server without this plugin (Pawn.CMD) and the problem did not occur.
plugin version used: 3.4.0 (SA-MP)
Operating System: Windows Server 2019
Plugins used:
sampvoice
discord-connector
pawnraknet
log-plugin
mysql
sscanf
CTime
MapAndreas
streamer
pawnregex
pawn-memory
SAMPSON
I'm getting errors in command aliases since 3.3.0.
For example, this code:
CMD:test(playerid, params[])
{
SendClientMessage(playerid, -1, "OK");
return 1;
}
alias:test("tést", "teñst")
Works fine on a gamemode/filterscript with UTF-8 encoding. But in a ISO 8859-1 encoding gamemode it returns these errors:
And the callback OnPlayerCommandReceived
sometimes cuts the cmd[]
string. So, if the command it's something like /hellowórld
, the callback returns a cmd[]
string like hellow
.
I tried using LocaleName = "es_ES.ISO8859-1"
in pawncmd.cfg
but it does nothing.
Pawn CMD plugin version 3.1.2 work but 3.1.4 commands not working. What is the reason for this?
warning 239: literal array/string passed to a non-const parameter
When we use Zeex 3.10.9 compiler it give us this warning in the callcmd
For example;
callcmd::hasat(playerid, NULL);
Hi all. An error occurs when trying to declare an alias. What could be the problem?
alias:menu("mn");
error 010: invalid function or declaration
I'm using the latest version of Pawn.CMD (3.2.0) with YSI (4.0). I've a modular gamemode and the hooked callbacks won't work because I've to use 'Cmd' instead of 'Command' when hooking since Pawn doesn't support function names of more than 32 characters.
I completely understand why your last threads were deleted, but this one was perfectly fine.
You didn't go against any rules this time, so why was it deleted?
Plus, my last post was pretty important. Did you see it by any chance?
Recently I decided to switch from YCMD to Pawn.CMD, and didn't pay attention at all, it compiled, uh oh it should work, right? I was focusing on upgrading the script along with the other developer, updating YSI, updating plugins, etc... But now I realized that there is at least 3-4 seconds delay, rephrase, commands don't work 3-4 seconds after one command was executed. So basically let's say I type /help, it executes, I try to /help again, it doesn't work. I spam /help it doesn't work. I've to wait 3-4 seconds, then /help for it to work. Only this is logged when I run the server, but later on no errors, no nothing.
[10:19:14] [Pawn.CMD] PC_RegAlias: invalid unordered_map<K, T> key
[10:19:14] [Pawn.CMD] PC_RegAlias: invalid unordered_map<K, T> key
Hopefully you can help me regarding this issue?
[Pawn.CMD] File or function is not found in public OnPlayerCommandText(0, "/unban Ark_Jithu") - please note that the AMX error is not related with the plugin, but your script
I'm migrating from izcmd to PawnCMD and I'm interested to use flags instead of normal if checks.
I'm having some problem here:
public OnPlayerCommandReceived(playerid, cmd[], params[], flags)
{
if (flags && !(flags & p_Permissions[ playerid ] ) )
{
return SendError( playerid, "You don't have access to this command." ), 0;
}
return 1;
}
I want to pass the command if it doesn't have any flags, but this still doesn't work, I don't want to manually assign every single command I have right now
My commands:
CMD:cmds( playerid, params[ ] )
{
return 1;
}
flags:ownercmds( CMD_OWNER )
CMD:ownercmds( playerid, params[ ] )
{
return 1;
}
How I'm assigning the flags:
hook OnPlayerlogin( playerid )
{
if( p_AdminLevel[ playerid ] == 6 ) p_Permissions[ playerid ] = CMD_OWNER | CMD_COUNCIL | CMD_LEAD | CMD_SENIOR | CMD_GENERAL | CMD_TRIAL;
else if( p_AdminLevel[ playerid ] == 5 ) p_Permissions[ playerid ] = CMD_COUNCIL | CMD_LEAD | CMD_SENIOR | CMD_GENERAL | CMD_TRIAL;
else if( p_AdminLevel[ playerid ] == 4 ) p_Permissions[ playerid ] = CMD_LEAD | CMD_SENIOR | CMD_GENERAL | CMD_TRIAL;
else if( p_AdminLevel[ playerid ] == 3 ) p_Permissions[ playerid ] = CMD_SENIOR | CMD_GENERAL | CMD_TRIAL;
else if( p_AdminLevel[ playerid ] == 2 ) p_Permissions[ playerid ] = CMD_GENERAL | CMD_TRIAL;
else if( p_AdminLevel[ playerid ] == 1 ) p_Permissions[ playerid ] = CMD_TRIAL;
else p_Permissions[ playerid ] = 0;
return 1;
}
I can access /stats but I can't access /ownercmds.
HI i updated plugin but i get this error when i type any cmd server unknown command
I return zero in the filterscript, but the commands in fashion continue to be processed. So it was conceived?
Tried your command processor in linux. It was great.
but when I tried to run it in localhost ( Win XP ) server just crashes and I get this error:
[23:35:50] [debug] Server crashed due to an unknown error
[23:35:50] [debug] Native backtrace:
[23:35:50] [debug] # 0 012f22f7 in ?? () from plugins\pawncmd.dll
[23:35:50] [debug] # 1 012f45fb in ?? () from plugins\pawncmd.dll
[23:35:50] [debug] # 2 00469ab5 in ?? () from samp-server.exe
[23:35:50] [debug] # 3 65646f6d in ?? () from samp-server.exe
Closed
I don't know what is wrong with this..
{
new targetGang, players, upto, bet, g = p_GangID[ playerid ];
printf("checks");
if ( ! IsPlayerGangLeader( playerid, g ) ) return SendError(playerid, "You are not the gang leader." ), printf("checks 2");
else if ( sscanf( params, "dddD(0)", targetGang, players, upto, bet ) ) return SendUsage(playerid, "/requestwar [GANG_ID] [PLAYERS] [KILLS] [BET ( optional )]"), printf("checks 1");
else if ( upto < 5 || upto > 20) return SendError(playerid, "Kills must not lower than 5 and not greater that 20"), printf("checks 3");
else if ( targetGang == g) return SendError(playerid, "You can't request a gang war with your own gang!"), printf("checks 4");
else if ( targetGang < 0 || targetGang >= MAX_GANGS) return SendError( playerid, "Invalid Gang ID." ), printf("checks 5");
else if ( !Iter_Contains( gangs, targetGang) ) return SendError(playerid, "Invalid Gang ID."), printf("checks 6");
else if ( GetOnlineGangMembers( targetGang ) < players) return SendError(playerid, "Gang doesn't have that players online"), printf("checks 7");
else if ( GetOnlineGangMembers( g ) < players) return SendError(playerid, "Your gang doesn't have that players online"), printf("checks 8");
else if ( gettime() - h_gangData[ g ][ g_gangInviteTick ] < 120) return SendError(playerid, "You're waiting an invite / someone invited you");
else if ( gettime() - h_gangData[ targetGang ][ g_gangInviteTick] < 120 ) return SendError(playerid, "Gang is currently waiting a request");
else if ( g_gangData[ g ][ E_BANK ] < bet) return SendError(playerid, "You don't have enough money in your Gang bank to place that bet!");
{
printf("if checkes");
SendRequestToGang( g, targetGang);
format(szNormalString, sizeof(szNormalString), "[GWINFO]: Players Needed: %d, Kills: %d, bet: %d", players, upto, bet);
SendClientMessage(GetGangLeader( targetGang ), COLOR_GREEN, szNormalString);
format(szNormalString, sizeof(szNormalString), "[GWINFO]: You requested a war to %s", ReturnGangName(targetGang));
SendClientMessage(playerid, COLOR_GREEN, szNormalString);
h_gangData[ g ][g_gangBet] = bet;
h_gangData[ g ][g_gangUpToMem] = upto;
h_gangData[targetGang][g_gangInviteTick] = gettime();
h_gangData[targetGang][g_gangIdRequested] = g;
h_gangData[targetGang][g_gangMembersRequired] = players;
h_gangData[ g ][g_gangMembersRequired] = players;
h_gangData[ g ][g_gangInviteTick] = gettime();
}
return 1;
}
server_log.txt
[17:05:32] [Pawn.CMD] HandleCommand: Call: amx_Exec(P6tagAMX:0x8c9bb20, Pi:0xffded37c, i:929): Array index out of bounds (4)
The error occurs when I enter all sscanf parameters, any ideas?
I get this error when I run the server. Where I need to put it to work?
Solved!
при всём уважении, ты вообще проверяешь что заливаешь в релизы?
это уже который раз.
Hey there,
After a command, I'm getting this and also nothing on the server won't be able to use as well. (Like, textdraws won't work, dialogs won't respond)
[Pawn.CMD] HandleCommand: Call: amx_Exec(struct tagAMX *:02253BA8, int *:0018F7D8, int:499): Invalid memory access (5)
cmd:testcmd(playerid, params[])
{
if(!AdminCheck(playerid, ADMIN_LEVEL123)) return 1; // Basically, controlling if the user is admin or not.
new gelbakak[32];
format(gelbakak, sizeof(gelbakak), "%s", RutbeAdi(playerid)); // This is a function returning a string from some player variables. Like if adminlevel[playerid] == 3 >> Returns a text "This is a Super admin"
FixTurkishCharacters(gelbakak); // And then this, I'll give it below.
SendClientMessage(playerid, -1, gelbakak);
return 1;
}
stock FixTurkishCharacters(icerik[])
{
strreplace(icerik, 'Ş', 'S');
strreplace(icerik, 'ş', 's');
strreplace(icerik, 'Ö', 'O');
strreplace(icerik, 'ö', 'o');
strreplace(icerik, 'Ü', 'U');
strreplace(icerik, 'ü', 'u');
strreplace(icerik, 'İ', 'I');
strreplace(icerik, 'ı', 'i');
strreplace(icerik, 'Ğ', 'G');
strreplace(icerik, 'ğ', 'g');
strreplace(icerik, 'Ç', 'C');
strreplace(icerik, 'ç', 'c');
return icerik;
}
BY THE WAY; I'm using the same function in another command, it works fine.
cmd:testchar(playerid, params[]) // THIS WORKS PROPERLY. BUT THE OTHER COMMAND WON'T.
{
if(!AdminCheck(playerid, ADMIN_LEVEL123)) return 1;
FixTurkishCharacters(params);
SCM(playerid,-1,params);
return 1;
}
Titled message when running windows server on ver 0.3.4
Admins should be able to open a config dialog by typing /cp , and whenever they use Button 1 (Response == 1) the dialog should be reopend after the tasks are done, but nothing is happening, here is my code:
https://gist.github.com/Bios-Marcel/8e56a942640a6cac70001e7a909b49e6
I added a custom Unknown command message, and even if i type a valid command that message shows up. Note that this bug occurs only when the command returns a error message(like if i dont type a parameter, or if dont fulfill a statement) .
public OnPlayerCommandPerformed(playerid, cmd[], params[], result, flags)
{
if(result == -1)
{
Text_Send(playerid,$UNKNOWN_COMMAND);
return 0;
}
return 1;
}
This is the code in OnPlayerCommandPerformed. Right now i use y_text to send messages(because i have multi-language system), but even if i use SendClientMessage(in the callback above) its doing the same thing.
After further testing i found out that this is happening because i use y_text(Text_Send) functions to send messages in my commands, if i use SendClientMessage everything functions normally.
Here is a screenshot with the texts: https://imgur.com/4MXs9fC
This the line for /movespray that is checking for params:
if(sscanf(params,"d",pnsid))return Text_Send(playerid, $COMMAND_MOVESPRAY);
And this is the line for the /armour command:
if(sscanf(params,"uf",id,armor))return SCM(playerid,c_ERROR,"Tasteaza:"c_error" /armour[playerid/nume jucator] [armura]","Type:"c_error" /armour[playerid/playerName] [ammount]");
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.