Errors and warnings
#1

Код:
CMD:pm(playerid, params[])
{
    new id, string[128], string2[128], sender[MAX_PLAYER_NAME], reciever[MAX_PLAYER_NAME];
	if(sscanf(params, "us[75]", id, params[2])) return SendClientMessage(playerid, 0xADFF2F, "Използване: /pm <id> <message>");
	GetPlayerName(playerid, sender, sizeof(sender));
	GetPlayerName(id, reciever, sizeof(reciever));
	format(string, sizeof(string), "%s: %s" sender, params[2]);
	format(string2, sizeof(string2), "%s: %s" reciever, params[2]);
	SendClientMessage(id, 0xADFF2F, string);
	SendClientMessage(id, 0xADFF2F, string2);
	return 1;
}
Код:
Erros and warnings:

D:\igri\GTA-SanAndreas\gamemodes\grandlarc.pwn(585) : error 001: expected token: "-string end-", but found "-identifier-"
D:\igri\GTA-SanAndreas\gamemodes\grandlarc.pwn(585) : warning 215: expression has no effect
D:\igri\GTA-SanAndreas\gamemodes\grandlarc.pwn(585) : warning 215: expression has no effect
D:\igri\GTA-SanAndreas\gamemodes\grandlarc.pwn(585) : error 001: expected token: ";", but found ")"
D:\igri\GTA-SanAndreas\gamemodes\grandlarc.pwn(585) : error 029: invalid expression, assumed zero
D:\igri\GTA-SanAndreas\gamemodes\grandlarc.pwn(585) : fatal error 107: too many error messages on one line

HELP
Reply
#2

Please show me line 585.
Reply
#3

format(string, sizeof(string), "%s: %s" sender, params[2]);
Reply
#4

Here's a new /pm command I have re-written for you.

pawn Код:
COMMAND:pm(playerid,params[])
{
        new pid;
        new message1[100];
        if(sscanf(params, "us[32]", pid, message1))
        {
            return SendClientMessage(playerid, 0xADFF2F, "USAGE: /pm <playerid> <message>");
        }
        if(pid == INVALID_PLAYER_ID) SendClientMessage(playerid,-1,"ERROR: That player is not connected.");
        new pmsg[256];
        new pname[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pname,sizeof(pname));
        format(pmsg,sizeof(pmsg),"PM from %s(%d): %s",pname,playerid,message1);
        new pidmsg[256];
        new pidname[MAX_PLAYER_NAME];
        GetPlayerName(pid,pidname,sizeof(pidname));
        format(pidmsg,sizeof(pidmsg),"PM to %s(%d): %s",pidname,pid,message1);
        SendClientMessage(pid, 0xADFF2F, pmsg);
        PlayerPlaySound(pid,1057,0.0,0.0,0.0);
        SendClientMessage(playerid, 0xADFF2F, pidmsg);
    return 1;
}
Reply
#5

This

Obviously though, you missed a comma (,)

pawn Код:
CMD:pm(playerid, params[])
{
    new id, string[128], string2[128], sender[MAX_PLAYER_NAME], reciever[MAX_PLAYER_NAME], message1[128];
    if(sscanf(params, "us[75]", id, message1)) return SendClientMessage(playerid, 0xADFF2F, "Използване: /pm <id> <message>");
    GetPlayerName(playerid, sender, sizeof(sender));
    GetPlayerName(id, reciever, sizeof(reciever));
    format(string, sizeof(string), "%s: %s", sender, message1);
    format(string2, sizeof(string2), "%s: %s", reciever, message1);
    SendClientMessage(playerid, 0xADFF2F, string);
    SendClientMessage(id, 0xADFF2F, string2);
    return 1;
}
Reply
#6

thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)