Really weird!!! :O
#1

Now this is ******* strange,I dunno what happened I just took a look at this Pm system(https://sampforum.blast.hk/showthread.php?tid=164500), added it to my gamemode(of course I downloaded sscanf and zcmd) and added it to the bottom of my gamemdoe and I got this error while compiling:
pawn Код:
CMD:pm(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, "Usage: /pm <id> <message>");
        return 1;
    }
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: 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), "PM To %s(ID %d): %s", Name2, id, str2);
        SendClientMessage(playerid, 0xFF0000FF, str);
        format(str, sizeof(str), "PM From %s(ID %d): %s", Name1, playerid, str2);
        SendClientMessage(id, 0xFF0000FF, str);
    }
    return 1;
}
Compiling errors:At
pawn Код:
if(playerid == id) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You cannot pm yourself!")
    {
error 001: expected ";" token but found "{"
so I added ";" after that if statement and it compiled it right,but when I run samp-server.exe it gives me runtime error 19 couldn't find lsdm.amx but I have it on my gamemdoes folder What's wrong
Reply
#2

First of the ";" isn't needed after the if statement, but here
pawn Код:
if(playerid == id) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You cannot pm yourself!");
The other 2 parentheses are not necessary, then the command will be
pawn Код:
CMD:pm(playerid,params[])
{
    new str[256], str2[256], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
    if(sscanf(params, "us", id, str2)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /pm <id> <message>");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: 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), "PM To %s(ID %d): %s", Name2, id, str2);
    SendClientMessage(playerid, 0xFF0000FF, str);
    format(str, sizeof(str), "PM From %s(ID %d): %s", Name1, playerid, str2);
    SendClientMessage(id, 0xFF0000FF, str);
    return 1;
}
And the problem of the runtime error might be caused by the sscanf(assuming you use the plugin version), you have to add "sscanf" on the plugins line of your server.cfg, including the include ain't enaugh, or your gamemode won't be loaded.
Reply
#3

PHP код:
CMD:pm(playerid,params[])
{
     new 
str[256], str2[256], idName1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
    if(
sscanf(params"us"idstr2))
    {
        
SendClientMessage(playerid0xFF0000FF"Usage: /pm <id> <message>");
        return 
1;
    }
    if(!
IsPlayerConnected(id)) return SendClientMessage(playerid0xFF0000FF"ERROR: Player not connected");
    if(
playerid == id) return SendClientMessage(playerid0xFF0000FF"ERROR: You cannot pm yourself!");
    else
    {
       
        
GetPlayerName(playeridName1sizeof(Name1));
        
GetPlayerName(idName2sizeof(Name2));
        
format(strsizeof(str), "PM To %s(ID %d): %s"Name2idstr2);
        
SendClientMessage(playerid0xFF0000FFstr);
        
format(strsizeof(str), "PM From %s(ID %d): %s"Name1playeridstr2);
        
SendClientMessage(id0xFF0000FFstr);
    }
    return 
1;

Reply
#4

same problem runtime error 19 etc (I HAVE ALL INCLDUES) and without that command it's working,so I think this problem shoudl be treated seriously

HELP!!!
Reply
#5

Quote:
Originally Posted by Alby Fire
Посмотреть сообщение
And the problem of the runtime error might be caused by the sscanf(assuming you use the plugin version), you have to add "sscanf" on the plugins line of your server.cfg, including the include ain't enaugh, or your gamemode won't be loaded.
Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
same problem runtime error 19 etc (I HAVE ALL INCLDUES) and without that command it's working,so I think this problem shoudl be treated seriously
HELP!!!
Did you add
Код:
plugins sscanf
To your server.cfg or not?
If yes try to put
Код:
main() { }
Just under the includes' part of your GM
Reply
#6

That should work:
pawn Код:
COMMAND:pm(playerid,params[]) {
    new
        name1[30],
        name2[30],
        id,
        mess[50],
        text1[128],
        text2[128],
        logtext[128];
    if(sscanf(params,"us",id,mess))
        return SendClientMessage(playerid,red,"USAGE: /pm [id] [message] - will send a private message to a player.");
    if(IsPlayerConnected(id)) {
        GetPlayerName(playerid,name1,sizeof(name1));
        GetPlayerName(id,name2,sizeof(name2));
        format(text1,sizeof(text1),"PM sent to %s.",name2);
        format(text2,sizeof(text2),"PM from %s: %s",name1,mess);
        SendClientMessage(playerid,COLOR_LIGHTGREEN,text1);
        SendClientMessage(playerid,COLOR_LIGHTGREEN,text2);
        format(logtext,sizeof(logtext),"PM from %s, to %s: %s",name1,name2,mess);
        SaveIn("pm",logtext);
    } else {
        return SendClientMessage(playerid,red,"Invalid ID");
    }
    return 1;
}
EDIT: hey this bro before me, that should solve the problem xD
Reply
#7

simpli not working i added the sscanf plugins and i tried sven's method but SvaeIn was undefined symbol so I deletd that line and compiled(no errors)then I went to sa-mp.exe and again runtime error 19
Reply
#8

Are you using multiple command processors at once?

Open your server.cfg and paste it here completely (mask out the rcon password), also is the sscanf.dll in your 'plugins' folder in the server root directory?
Reply
#9

PROBLEM FIXED!!!(special thansk to alby_fire and playbox telling me about plugins and server.cfg)

Also thanks to evryone of course.
Reply
#10

NOTE:Help still required on "What's wrong with htis?" topic
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)