Problem with dcmd_pm
#1

Hi guys,

Currently editing SFCRRPG gamemode and I changed the script in the dcmd_pm
because It was always returning back to ID 0.

here is the code:

dcmd_pm(playerid, params[]) {
new str[128], id,
string[168];
if(sscanf(params, "us[128]", id, str))
return SendClientMessage(playerid, -1, "ERROR: /pm ID Message"); format(string, sizeof(string), "PM to %i: %s", id, str"); // %i will return the ID of the player
SendClientMessage(playerid, -1, string); format(string, sizeof(string), "PM from %i: %s", playerid, str);
SendClientMessage(giveplayerid, -1, string); return 1; }

I'm getting these errors:

E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4093) : error 037: invalid string (possibly non-terminated string)
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4093) : warning 215: expression has no effect
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4093) : error 001: expected token: ";", but found ")"
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4093) : error 029: invalid expression, assumed zero
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4093) : fatal error 107: too many error messages on one line

Can anyone tell me what is wrong with the script above ?
Reply
#2

pawn Код:
dcmd_pm(playerid, params[]) {
new str[128], id,
string[168];
if(sscanf(params, "us[128]", id, str))
return SendClientMessage(playerid, -1, "ERROR: /pm ID Message"); format(string, sizeof(string), "PM to %i: %s", id, str); // %i will return the ID of the player
SendClientMessage(playerid, -1, string); format(string, sizeof(string), "PM from %i: %s", playerid, str);
SendClientMessage(giveplayerid, -1, string); return 1; }
Reply
#3

You had an extra inverted commas.
pawn Код:
dcmd_pm(playerid, params[])
{
    new str[128], id, string[168];
    if(sscanf(params, "us[128]", id, str)) return SendClientMessage(playerid, -1, "ERROR: /pm ID Message");
    format(string, sizeof(string), "PM to %i: %s", id, str); // %i will return the ID of the player
    SendClientMessage(playerid, -1, string);
    format(string, sizeof(string), "PM from %i: %s", playerid, str);
    SendClientMessage(giveplayerid, -1, string);
    return 1;
}
Reply
#4

Quote:
Originally Posted by SmiT
Посмотреть сообщение
You had an extra inverted commas.
pawn Код:
dcmd_pm(playerid, params[])
{
    new str[128], id, string[168];
    if(sscanf(params, "us[128]", id, str)) return SendClientMessage(playerid, -1, "ERROR: /pm ID Message");
    format(string, sizeof(string), "PM to %i: %s", id, str); // %i will return the ID of the player
    SendClientMessage(playerid, -1, string);
    format(string, sizeof(string), "PM from %i: %s", playerid, str);
    SendClientMessage(giveplayerid, -1, string);
    return 1;
}
Changed it to this and now I'm getting these errors:

E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4094) : error 017: undefined symbol "giveplayerid"
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4096) : error 010: invalid function or declaration
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4099) : error 010: invalid function or declaration
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4101) : error 010: invalid function or declaration
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4104) : error 010: invalid function or declaration
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4106) : error 010: invalid function or declaration
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4110) : error 010: invalid function or declaration
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4115) : error 021: symbol already defined: "format"
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4118) : error 021: symbol already defined: "format"
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4121) : error 010: invalid function or declaration
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4123) : error 010: invalid function or declaration


Original dcmd_pm taken from the gamemode

Код:
dcmd_pm(playerid,params[])
{
	new string[128];
	new ID;
	new cmdreason[100];
	if(sscanf(params, "us[100]", ID, cmdreason))
	{
	    SendClientMessage(playerid,COLOR_ERROR,"USAGE: /pm (Player Name/ID) (Message)");
	    return 1;
	}
    if(IsMuted[playerid] == 1)
	{
	    SendClientMessage(playerid,COLOR_ERROR,"You are Muted. You Cannot Use This Command");
	    return 1;
    }
    if(udb_Exists(PlayerName(playerid)) && !PLAYERLIST_authed[playerid])
	{
	    SendClientMessage(playerid,COLOR_ERROR,"You must login before you can talk");
	    return 1;
    }
    if(!IsPlayerConnected(ID))
	{
	    format(string, sizeof(string), "The Player ID (%d) is not connected to the server.",ID);
	    SendClientMessage(playerid,COLOR_ERROR,string);
	    return 1;
    }
	format(string, sizeof(string), "PM Sent to: %s(%d): %s",PlayerName(ID),ID,cmdreason);
	SendClientMessage(playerid,COLOR_YELLOW,string);
	
	format(string, sizeof(string), "PM From: %s(%d) %s",PlayerName(playerid),playerid,cmdreason);
	SendClientMessage(ID,COLOR_YELLOW,string);
	
	format(string, sizeof(string), "3[PM] From %s(%d) to %s(%d): %s",PlayerName(playerid),playerid,PlayerName(ID),ID,cmdreason); // [0] <jacob> hi
	IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string);
	
	SpamStrings[playerid] ++;
    PlayerPlaySound(ID,1085,0.0,0.0,0.0);
	return 1;
}
Reply
#5

Код:
dcmd_pm(playerid, params[]) 
{
new str[128], id, string[168];
 if(sscanf(params, "us[128]", id, str)) return SendClientMessage(playerid, -1, "ERROR: /pm ID Message"); 
 format(string, sizeof(string), "PM to %i: %s", id, str); // %i will return the ID of the player     

SendClientMessage(playerid, -1, string); 

 format(string, sizeof(string), "PM from %i: %s", playerid, str);
SendClientMessage(id, -1, string); 
 return 1; 
}
Reply
#6

Quote:
Originally Posted by sniperwars
Посмотреть сообщение
Changed it to this and now I'm getting these errors:

E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4094) : error 017: undefined symbol "giveplayerid"
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4096) : error 010: invalid function or declaration
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4099) : error 010: invalid function or declaration
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4101) : error 010: invalid function or declaration
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4104) : error 010: invalid function or declaration
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4106) : error 010: invalid function or declaration
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4110) : error 010: invalid function or declaration
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4115) : error 021: symbol already defined: "format"
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(411 : error 021: symbol already defined: "format"
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4121) : error 010: invalid function or declaration
E:\SA-MP Servers\samp03csvr_R2-2_win32\gamemodes\SFCnR.pwn(4123) : error 010: invalid function or declaration


Original dcmd_pm taken from the gamemode
pawn Код:
dcmd_pm(playerid, params[])
{
    new str, id,string[128];
    if(sscanf(params, "us[128]", id, str)) return SendClientMessage(playerid, -1, "ERROR: /pm ID Message");
    format(string, sizeof(string), "PM to %i: %s", id, str); // %i will return the ID of the player
    SendClientMessage(playerid, -1, string);
    format(string, sizeof(string), "PM from %i: %s", playerid, str);
    SendClientMessage(id, -1, string);
    return 1;
}
Reply
#7

It wasn't the script after all. It was the tram that was causing it.
The tram name is Billy which Is ID 0 and when I send a pm to my self it sent the pm to Billy.
I removed the tram now and the PM works great. How can I use keep the Tram and the PM not
to return back to id 0 ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)