SA-MP Forums Archive
[Help] Personal Messages command error - 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: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] Personal Messages command error (/showthread.php?tid=144360)



[Help] Personal Messages command error - johnnyc - 26.04.2010

i have pm system with block system,i need help asap please.
pawn Код:
if(strcmp("/pm", cmd, true) == 0)
{
tmp = strtok(cmdtext,idx);

if(!strlen(tmp) || strlen(tmp) > 5) {
SendClientMessage(playerid,COLOR_YELLOW,"Usage: /pm (id) (message)");
return 1;
}

new id = strval(tmp);
gMessage = strrest(cmdtext,idx);

if(!strlen(gMessage)) {
SendClientMessage(playerid,COLOR_YELLOW,"Usage: /pm (id) (message)");
return 1;
}

if(!IsPlayerConnected(id)) {
SendClientMessage(playerid,COLOR_YELLOW,"ERROR: Wrong player ID!");
return 1;
}
if(blocked[giveplayerid] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "  That player is blocking Personal Messages from everyone !");
return 1;
}
if(blocked[giveplayerid] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "That player blocked your personal messages");
return 1;
}
if(playerid != id) {
GetPlayerName(id,iName,sizeof(iName));
GetPlayerName(playerid,pName,sizeof(pName));
format(Message,sizeof(Message),"PM Sent to %s(%d): %s",iName,id,gMessage);
SendClientMessage(playerid,COLOR_YELLOW,Message);
format(Message,sizeof(Message),"PM From %s(%d): %s",pName,playerid,gMessage);
SendClientMessage(id,COLOR_YELLOW,Message);
PlayerPlaySound(id,1085,0.0,0.0,0.0);

printf("PM: %s",Message);

}
else {
SendClientMessage(playerid,COLOR_YELLOW,"You cannot PM yourself");
}
return 1;
}

Errors:

Код:
(8455) : error 017: undefined symbol "strrest"
(8455) : error 033: array must be indexed (variable "gMessage")

Код:
Line 8455 :   gMessage = strrest(cmdtext,idx);



Re: [Help] Personal Messages command error - johnnyc - 27.04.2010

BUMP


Re: [Help] Personal Messages command error - aircombat - 27.04.2010

this will fix it :
bottom of script :
Код:
stock strrest(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}
	new offset = index;
	new result[128];
	while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}



Re: [Help] Personal Messages command error - johnnyc - 27.04.2010

Oh dude thanks alot works perfectly now


Re: [Help] Personal Messages command error - xZacharias - 16.08.2010

Quote:
Originally Posted by aircombat
Посмотреть сообщение
this will fix it :
bottom of script :
Код:
stock strrest(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}
	new offset = index;
	new result[128];
	while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}
sry dont works for me, the compiler crashes whatever where I put that sh*t