Simple help
#1

so iv got an pm command
PHP код:
CMD:pm(playeridparams[])
{
    new 
tmp[1080], giveplayeridgiveplayer[25], playername[25],string[1080];
    if(
adlvl[playerid] < && !vipmember[playerid] && helper[playerid] == 0) return 0;
    
GetPlayerName(giveplayeridgiveplayerMAX_PLAYER_NAME);
    if (
sscanf(params"us"giveplayeridtmp)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /pm [playerid] [message]");
    if (!
IsPlayerConnected(giveplayerid)) return SendClientMessage(playeridCOLOR_RED"Error: Inactive player id!");
    if (
giveplayerid == playerid) return SendClientMessage(playeridCOLOR_RED"Error: You can't send private message to your self!");
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    
GetPlayerName(giveplayeridgiveplayerMAX_PLAYER_NAME);
    
format(stringsizeof(string), "{E6E600}PM from %s(%d): %s"playernameplayeridtmp);
    
SendClientMessage(giveplayeridCOLOR_YELLOWstring);
    
format(string,sizeof(string), "{FFFF00}PM to %s(%d): %s"giveplayergiveplayeridtmp);
    
SendClientMessage(giveplayeridCOLOR_YELLOW"You can use /pmr [message] for fast reply.");
    
SendClientMessage(playeridCOLOR_WHITEstring);
    return 
1;

the problem is that the message be like PM FROM name: hi hru bro what ar
and the command cut off at Are o how can I fix it I tried to make the array bigger but didn't work
Reply
#2

Код:
CMD:pm(playerid, params[]) 
{ 
	//I changed the size of tmp to 160
	new tmp[160], giveplayerid, giveplayer[25], playername[25],string[256]; 
	
	if(adlvl[playerid] < 2 && !vipmember[playerid] && helper[playerid] == 0) return 0; 
	GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME); 
	
	//You must specify the size of the string when request the params
	if (sscanf(params, "us[160]", giveplayerid, tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /pm [playerid] [message]"); 
	if (!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "Error: Inactive player id!"); 
	if (giveplayerid == playerid) return SendClientMessage(playerid, COLOR_RED, "Error: You can't send private message to your self!"); 
	GetPlayerName(playerid, playername, MAX_PLAYER_NAME); 
	GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME); 
	format(string, sizeof(string), "{E6E600}PM from %s(%d): %s", playername, playerid, tmp); 
	SendClientMessage(giveplayerid, COLOR_YELLOW, string); 
	format(string,sizeof(string), "{FFFF00}PM to %s(%d): %s", giveplayer, giveplayerid, tmp); 
	SendClientMessage(giveplayerid, COLOR_YELLOW, "You can use /pmr [message] for fast reply."); 
	SendClientMessage(playerid, COLOR_WHITE, string); 
	return 1; 
}
This will work.
Reply
#3

alright tnx + REP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)