#1

Well again I have a problem, My gamemode has a problem with private messages, when you try to send a private message it sends it but it does not appear complete it always cuts part of the message and I do not know what to do and tried many things but I have no solution, that always happens to me when I add this include #include <sscanf> if I remove that include the / pm command works correctly but when I place it, the messages of some server functions come out shortened, with that include another command that I have and I put the include so that operate this command

This cmd work with sscanf include but without sscanf not work
Код:
CMD:searchcar(playerid,params[])
{
    new idvp,ncar[600],StringSECH[1140],STRCCHAR[1140];
    if(sscanf(params,"sT[600]",ncar))return SendClientMessage(playerid,red,"Use: /SearchCar [CarName]");
    idvp = GetVehicleModelIDFromName(ncar);
    for(new i=0;i<MAX_VEHICLES;i++){
    if(VehicleInfo[i][model] == idvp && VehicleInfo[i][Temp] == false){
    format(StringSECH,sizeof(StringSECH),"{FFFAFA}Vehicle:{00FF00} %s | {FFFAFA}Owner:{00FF00} %s\n",VehicleName[GetVehicleModel(i)-400],VehicleInfo[i][owner],i);
    strcat(STRCCHAR,StringSECH);}}
    new dname[MAX_PLAYER_NAME];
    new string[128];
    format(string,sizeof(string),"17 %s ID(%d) Has Used Command /Searchcar",dname,playerid,params);
    IRC_GroupSay(groupID, IRC_ADMINCHANNEL, string);
    ShowPlayerDialog(playerid,601,DIALOG_STYLE_MSGBOX ,"{FFFF00}Search Car",STRCCHAR, "Ok", "");
    return 1;
}
This is the code of pm cmd

Код:
CMD:pm(playerid,params[]) {
    if(PlayerInfo[playerid][Muted] == 1)
	{
 		PlayerInfo[playerid][MuteWarnings]++;
 		new string[128];
		if(PlayerInfo[playerid][MuteWarnings] < ServerInfo[MaxMuteWarnings]) {
			format(string, sizeof(string),"WARNING: You are muted, if you continue to speak you will be kicked. (%d / %d)", PlayerInfo[playerid][MuteWarnings], ServerInfo[MaxMuteWarnings] );
			SendClientMessage(playerid,red,string);
		} else {
			SendClientMessage(playerid,red,"You have been warned ! Now you have been kicked");
			format(string, sizeof(string),"***%s (ID %d) was kicked for exceeding mute warnings", PlayerName2(playerid), playerid);
			SendClientMessageToAll(grey,string);
			SaveToFile("KickLog",string); Kick(playerid);
		}
		return 0;
	}
	new id, gMessage[128],Message[128],iName[MAX_PLAYER_NAME], pmName[MAX_PLAYER_NAME];
	if (sscanf(params, "is",id,gMessage)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /pm <ID> <Message>");
	if(!IsPlayerConnected(id)) {
		SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/pm : Bad player ID");
		return 1;
	}
	if(playerid == id) {
		SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"You cannot PM yourself");
		return 1;
	}
	if(ServerInfo[ReadPMs] == 1 && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
	{
    	new string[128],recievername[MAX_PLAYER_NAME],string2[128];
		GetPlayerName(playerid, string, sizeof(string)); GetPlayerName(id, recievername, sizeof(recievername));
		format(string, sizeof(string), "***[PM]: %s To %s: %s", string, recievername, gMessage);
		IRC_GroupSay(groupID, IRC_ADMINCHANNEL, string);
		for (new a = 0; a < MAX_PLAYERS; a++) if ((PlayerInfo[a][Level] >= ServerInfo[MaxAdminLevel]) && a != playerid)
		SendClientMessage(a, grey, string);
	}
 	if(PlayerInfo[playerid][Muted] == 1)
	{
		new string[128];
 		PlayerInfo[playerid][MuteWarnings]++;
		if(PlayerInfo[playerid][MuteWarnings] < ServerInfo[MaxMuteWarnings]) {
			format(string, sizeof(string),"WARNING: You are muted, if you continue to speak you will be kicked (Warning: %d/%d)", PlayerInfo[playerid][MuteWarnings], ServerInfo[MaxMuteWarnings] );
			SendClientMessage(playerid,red,string);
		} else {
			SendClientMessage(playerid,red,"You have been warned! Now you have been kicked");
			GetPlayerName(playerid, string, sizeof(string));
			format(string, sizeof(string),"%s [ID %d] Kicked for exceeding mute warnings", string, playerid);
			SendClientMessageToAll(grey,string);
			SaveToFile("KickLog",string); Kick(playerid);
		}
		return 0;
	}
	GetPlayerName(id,iName,sizeof(iName));
	GetPlayerName(playerid,pmName,sizeof(pmName));
    new tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
	new player1 = strval(tmp);
	if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
	format(Message,sizeof(Message),">> %s(%d): %s",iName,id,gMessage);
	SendClientMessage(playerid,PM_OUTGOING_COLOR,Message);
	format(Message,sizeof(Message),"** %s(%d): %s",pmName,playerid,gMessage);
	SendClientMessage(id,PM_INCOMING_COLOR,Message);
	PlayerPlaySound(id,1085,0.0,0.0,0.0);
	printf("PM: %s",Message);
	return 1;
}
With the include sscanf the /searchcar works but without the sscanf it does not work but it works without problems the /pm, as it could work the 2 correctly...
that's why I put the issue of the pm command called '' error '' but I might have a solution to this problem
Reply
#2

Have you tried increasing the cell size of string?
Reply
#3

Quote:
Originally Posted by jasperschellekens
Посмотреть сообщение
Have you tried increasing the cell size of string?
where?
Reply
#4

Код:
Message[128]
String[128]
Increase their cells. and try again. something like this perhaps
Код:
Message[256]
String[256]
Reply
#5

In your code we have sscanf function, right? Show the code youre using without the use of sscanf.
Reply
#6

PHP код:
#define scm SendClientMessage
gName(pid){
    new 
s[24];
    
GetPlayerName(pid,s,24);
    return 
s;
}
AdminMsg(color,s[]){
    for (new 
iiMAX_PLAYERSi++){
        if(
PlayerInfo[i][Level]>=ServerInfo[MaxAdminLevel])SendClientMessage(i,color,s);
    }
    return 
1;
}
CMD:pm(pid,p[]) {
    if(
PlayerInfo[pid][Muted])return scm(pid,-1,"You are muted!");
    new 
id,s[128];
    if(
sscanf(p,"us[128]",id,p))return scm(pid,-1,"USAGE: /pm <ID> <Message>");
    if(!
IsPlayerConnected(id))    return scm(pid,-1,"Player isn't connected!");
    if(
pid==id)                    return scm(pid,-1,"You can't pm youself!");
    if(
ServerInfo[ReadPMs] && PlayerInfo[pid][Level] != ServerInfo[MaxAdminLevel]){
        
format(s,sizeof(s),"***[PM]: %s To %s: %s",gName(pid),gName(id),p);
        
IRC_GroupSay(groupID,IRC_ADMINCHANNEL,s);
        
AdminMsg(grey,s);
    }
    
format(s,sizeof(s),">> %s(%d): %s",gName(id),id,p);
    
scm(pid,PM_OUTGOING_COLOR,s);
    
format(s,sizeof(s),"** %s(%d): %s",gName(pid),pid,p);
    
scm(id,PM_INCOMING_COLOR,s);
    
PlayerPlaySound(id,1085,0.0,0.0,0.0);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)