SA-MP Forums Archive
[Tutorial] Making a simple PM system with ZCMD & sscanf - 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)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Making a simple PM system with ZCMD & sscanf (/showthread.php?tid=164500)

Pages: 1 2


Re: Making a simple PM system with ZCMD & sscanf - PinkFloydLover - 08.09.2010

not quite sure but try something like:
pawn Code:
if(str2 > 128)//gets if the players message is more then the max
{
    //rest of message here
}



Re: Making a simple PM system with ZCMD & sscanf - gondes - 19.09.2010

Can you making cmd /me with color purple?


Re: Making a simple PM system with ZCMD & sscanf - Toni - 19.09.2010

Quote:
Originally Posted by gondes
View Post
Can you making cmd /me with color purple?
pawn Code:
CMD:me(playerid, params[])
{
    new str[128], pName[24];
    GetPlayerName(playerid, pName, 24);
    if(sscanf(params, "s[128]", str))
    {
        return SendClientMessage(playerid, LBLUE, "Usage: /me (action)") &&
        SendClientMessage(playerid, ORANGE, "Function: make a me action");
    }
    format(str, sizeof(str), "* %s %s", pName, str);
    SendClientMessageToAll(PURPLE, str);
    return 1;
}



Re: Making a simple PM system with ZCMD & sscanf - _rAped - 05.01.2011

You forgot to index the string in sscanf so this will flood your server with warnings.


Re: Making a simple PM system with ZCMD & sscanf - opik - 06.08.2011

I have problem with this pm Scripts..
When i pm to id 0 - 5 its work Great, BUT, when i PM to id 6 - and bigger than id 6. the Message will Sent to id 0. anyone can help me ?


Re: Making a simple PM system with ZCMD & sscanf - mickos - 08.06.2012

Very nice


Re: Making a simple PM system with ZCMD & sscanf - chuck100 - 14.05.2013

Exellent Tutorial you just forgot

Quote:

if(playerid == id) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You cannot pm yourself!")

You forgot in the end of that line the ";"... Anyway Ty


Re: Making a simple PM system with ZCMD & sscanf - Pettersen - 18.05.2013

Good tut but you could have explained a bit more
But good tut.


Re: Making a simple PM system with ZCMD & sscanf - ATGOggy - 30.10.2014

CMDm(playerid, params[])
{
new stringpm[128],toid, toname[128];
if(sscanf(params, "us", toid, params)) SendClientMessage(playerid, COLOR_ORANGE, "Correct usage: /pm <id> <message>");
else if(!IsPlayerConnected(toid)) SendClientMessage(playerid, COLOR_ORANGE, "ERROR: Player not connected");
if(playerid == toid) SendClientMessage(playerid, COLOR_ORANGE, "ERROR: You cannot send a PM to yourself!");
else
{
GetPlayerName(toid, toname, sizeof(toname));
format(stringpm, sizeof(stringpm), "PM To %s(%d): %s", playername, toid, params);
SendClientMessage(playerid, COLOR_YELLOW, stringpm);
format(stringpm, sizeof(stringpm), "PM From %s(%d): %s", playername, playerid, params);
SendClientMessage(toid, COLOR_YELLOW, stringpm);
}
return 1;
}



I did this but I keep getting error:

E:\My Server\gamemodes\SARCR.pwn(596) : error 029: invalid expression, assumed zero
E:\My Server\gamemodes\SARCR.pwn(596) : error 017: undefined symbol "cmd_pm"
E:\My Server\gamemodes\SARCR.pwn(596) : error 029: invalid expression, assumed zero
E:\My Server\gamemodes\SARCR.pwn(596) : fatal error 107: too many error messages on one line


Re: Making a simple PM system with ZCMD & sscanf - Rudy_ - 30.10.2014

Have you got Zcmd?


Re: Making a simple PM system with ZCMD & sscanf - ATGOggy - 30.10.2014

yes i downloaded it and copied it to pawno>inlude


Re: Making a simple PM system with ZCMD & sscanf - Rudy_ - 30.10.2014

Do you have it inside your Gamemode/script?

pawn Code:
#include <Zcmd>



Re: Making a simple PM system with ZCMD & sscanf - ATGOggy - 30.10.2014

yes, also below zcmd.inc in right side, there are no fuctions.


Re: Making a simple PM system with ZCMD & sscanf - ATGOggy - 30.10.2014

rudy, plz help me


Re: Making a simple PM system with ZCMD & sscanf - ATGOggy - 31.10.2014

when i covert it to dcmd, it the same error occurs


Re: Making a simple PM system with ZCMD & sscanf - Arastair - 08.11.2014

Nice tut, very well explained


Re: Making a simple PM system with ZCMD & sscanf - antixgaming - 30.04.2018

Quote:
Originally Posted by M3ntaL
View Post
I got a problem

Did everything right, i gues, put the include
Code:
#include <zcmd>
and the code
Code:
CMD:es(playerid, params[])
{
    new str[256], str2[256], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
    if(sscanf(params, "us", id, str2))
    {
    	SendClientMessage(playerid, 0xFF0000FF, "Vihje: /es <id> <sхnum>");
  		return 1;
    }
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "VIGA: Player not connected");
    if(playerid != id) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You cannot pm yourself!");
    {
		GetPlayerName(playerid, Name1, sizeof(Name1));
 		GetPlayerName(id, Name2, sizeof(Name2));
        format(str, sizeof(str), "ES kasutajalt %s(ID %d): %s", Name2, id, str2);
        SendClientMessage(playerid, 0xFF0000FF, str);
        format(str, sizeof(str), "ES kasutajalt %s(ID %d): %s", Name1, playerid, str2);
        SendClientMessage(id, 0xFF0000FF, str);
    }
    return 1;
}
but i keep getting this error while i try to compile it ( just started scripting, i think i'm with good brain... just dont figure this out )

Code:
C:\Documents and Settings\Owner\Desktop\BBRP GM\gamemodes\bbrp.pwn(51) : error 017: undefined symbol "sscanf"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Btw. It's translated to Estonian, as you can see, dont mind that ^^.
You didn't included sscanf. At top of your script should be #include <sscanf2>, and of course you will need sscanf installed.