ram usage (?)
#1

in my script, there are many pvars, a big PlayerInfo enum and some setproperties.
for now, ut works fine, but if a second player connects, some commands are buggy. i think these are probably the commands which use a lot of RAM, cause something like /goto works fine, but for example the /a chat doesn't really work, if i only write "/a" it displays "Usage: /a [text]", but if i write "/a xyausbdoi", it doesn't display anything... what should i do?
Reply
#2

This a problem with the script it self. Please show the code for the command "/a".
Reply
#3

Code:
ocmd:a(playerid,params[])
{
	new action[128],action2[128];
	if(sscanf(params,"s",action2))return SendClientMessage(playerid,cSup,"/a [text]");
	format(action,sizeof action,action2);
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid,name,sizeof name);
	if(PlayerInfo[playerid][pAdmin]!=0)format(action,sizeof action,"[%d]%s: %s",PlayerInfo[playerid][pAdmin],name,action);
	else format(action,sizeof action,"[Zivilist]%s: %s",name,action);
	admin(action);
	if(PlayerInfo[playerid][pAdmin]==0)
	{
	  new string[256];
	  format(string,sizeof(string),"[Deine Admin-Nachricht]: %s",action2);
	  SendClientMessage(playerid,cAdmin,string);
	}
	return 1;
}
but its not only /a and /a works if there ist only 1 player...
Reply
#4

Could you specify what "action" and "action2" are used for?

And also : format(action,sizeof action,action2); <-------what does this mean?
Reply
#5

gaaarrrrhhh... explain to me why you're using 256 cells!
Reply
#6

Quote:
Originally Posted by Joe_
gaaarrrrhhh... explain to me why you're using 256 cells!
First: OFFTOPIC :P
Second: This problem is with the script itself and so no lag issues.
Third: You are right, he shouldn't declare 256 cell arrays.
Four: Please answer my previous post.

Five: Try this:

Code:
CMD:a(playerid,params[])
{
	new action[128],action2[128];
	if(sscanf(params,"s",action2)) return SendClientMessage(playerid,cSup,"/a [text]");
	format(action,sizeof(action),action2);
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid,name,sizeof name);
	if(PlayerInfo[playerid][pAdmin]!=0) format(action,sizeof action,"[%d]%s: %s",PlayerInfo[playerid][pAdmin],name,action);
	else format(action,sizeof action,"[Zivilist]%s: %s",name,action);
	admin(action);
	if(PlayerInfo[playerid][pAdmin]==0)
	{
	  new string[256];
	  format(string,sizeof(string),"[Deine Admin-Nachricht]: %s",action2);
	  SendClientMessage(playerid,cAdmin,string);
	}
	return 1;
}
Reply
#7

pawn Code:
CMD:a(playerid,params[])
{
    new action[128],action2[128];
    if(sscanf(params,"s",action)) return SendClientMessage(playerid,cSup,"/a [text]");
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    if(PlayerInfo[playerid][pAdmin]!=0) format(action2,sizeof(action2),"[%d]%s: %s",PlayerInfo[playerid][pAdmin],name,action);
    else format(action2,sizeof(action2),"[Zivilist]%s: %s",name,action);
    admin(action2);
    return 1;
}
The previous code was checking if the admin level was not 0, if it returned 1, then it would format including the level, then you're using else, which means if the if statement returns 0, which means whoever typed /a is not an admin, but then you check it again?

Anyway the above should work, but your coding is very messy.
Reply
#8

i really think that's not the problem! the first string is for admins, the second for the player. i mean, its not only /a which is noch working, it's also /c /f /ban /kick ... each command using a string stops working after a second player connected, so i thought there's something like a "RAM limit" which i reached?
Reply
#9

Quote:
Originally Posted by [Ger
Little_Grandpa ]
i really think that's not the problem! the first string is for admins, the second for the player. i mean, its not only /a which is noch working, it's also /c /f /ban /kick ... each command using a string stops working after a second player connected, so i thought there's something like a "RAM limit" which i reached?
RAM limit reached after second player connecting? lol no :P I just can't understand what you are trying t do. You're script is really not making sense to me. If you are trying to write two different announce types for admins and non-admin players then I will write one for you.
Reply
#10

You probably use all heapspace available because your have many big local arrays. Use 'heapspace()' to see if that's the issue.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)