Script Help
#1

Код:
CMD:pm(playerid, params[])
{
	new id, text[124];
	new string[124];
	new name=GetPlayerName(playerid);
	if(sscanf(params, "ui[124]", id, text))
	    return SendClientMessage(playerid, -1, "[USAGE]: /pm [playerid] [text]");
	format(string, sizeof(string), "((PM from %s:%s))", name, text);
	SendClientMessage(-1, string);
	return 1;
}
Errors:
Код:
E:\San Andreas Multiplayer Server Files (Classified)\Castaway Island Roleplay Server Files\gamemodes\CI-RP.pwn(225) : warning 202: number of arguments does not match definition
E:\San Andreas Multiplayer Server Files (Classified)\Castaway Island Roleplay Server Files\gamemodes\CI-RP.pwn(225) : warning 202: number of arguments does not match definition
E:\San Andreas Multiplayer Server Files (Classified)\Castaway Island Roleplay Server Files\gamemodes\CI-RP.pwn(229) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

Its the line before 'return 1;' at the end:

Should be
Код:
SendClientMessage(playerid,-1,string);
Reply
#3

Don't get it
Reply
#4

He means that you missed a parameter.
It's not
pawn Код:
SendClientMessage(-1,string);
but
pawn Код:
SendClientMessage(playerid,-1,string);
Reply
#5

You're missing "playerid" from your last SendClientMessage.
Reply
#6

Try this code. i hope it helped
pawn Код:
// PM Command
    if(strcmp("/pm", cmd, true) == 0)
    {
        tmp = strtok(cmdtext,idx);
       
        if(!strlen(tmp) || strlen(tmp) > 5) {
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (message)");
            return 1;
        }
       
        new id = strval(tmp);
        gMessage = strrest(cmdtext,idx);
       
        if(!strlen(gMessage)) {
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (message)");
            return 1;
        }
       
        if(!IsPlayerConnected(id)) {
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/pm : Bad player ID");
            return 1;
        }
       
        if(playerid != id) {
            GetPlayerName(id,iName,sizeof(iName));
            GetPlayerName(playerid,pName,sizeof(pName));
            format(Message,sizeof(Message),">> %s(%d): %s",iName,id,gMessage);
            SendClientMessage(playerid,PM_OUTGOING_COLOR,Message);
            format(Message,sizeof(Message),"** %s(%d): %s",pName,playerid,gMessage);
            SendClientMessage(id,PM_INCOMING_COLOR,Message);
            PlayerPlaySound(id,1085,0.0,0.0,0.0);
           
            printf("PM: %s",Message);
           
        }
        else {
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"You cannot PM yourself");
        }
        return 1;
    }
Reply
#7

Quote:
Originally Posted by kaisersouse
Посмотреть сообщение
You're missing "playerid" from your last SendClientMessage.
Still get errors ,
Код:
E:\San Andreas Multiplayer Server Files (Classified)\Castaway Island Roleplay Server Files\gamemodes\CI-RP.pwn(225) : warning 202: number of arguments does not match definition
E:\San Andreas Multiplayer Server Files (Classified)\Castaway Island Roleplay Server Files\gamemodes\CI-RP.pwn(225) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
Reply
#8

try it as filterscript
Reply
#9

delete this:
pawn Код:
new name = GetPlayerName(playerid);
Instead do this:
pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof name);
https://sampwiki.blast.hk/wiki/GetPlayerName
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)