SA-MP Forums Archive
Why this not work .. - 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: Why this not work .. (/showthread.php?tid=212135)



Why this not work .. - Rock18 - 16.01.2011

Hi , today i've made a command , when i put this in my gamemode and compile it , no error but when i go ingame the comand dont't work it says Unknown Command ...
This is the command
Код:
if(!strcmp(cmdtext, "/cmds", true))
{
new string[9999], sL[9999];
format(sL, sizeof(sL), "{fff000}+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+");
format(string, sizeof(string),"General Commands", "{FF0202}->/car [name]{EFED7A}foloseste {FF0202}/car [name]{EFED7A} pentru a lua masina dorita\n{FF0202}->/teles{EFED7A} foloseste {FF0202}/teles {EFED7A}pentru a vedea toate teleporturile \n{FF0202}->/usercp{EFED7A} foloseste {FF0202}/usercp {EFED7A}pentru a vedea User Control Panel\n%s",sL);
return ShowPlayerDialog(playerid, 9999, 0, "General Commands", string, "Ok", "Cancel");
}



Re: Why this not work .. - Typhome - 16.01.2011

Код:
if(!strcmp(cmdtext, "/cmds", true))
{
new string[9999], sL[9999];
format(sL, sizeof(sL), "{fff000}+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+");
format(string, sizeof(string),"General Commands", "{FF0202}->/car [name]{EFED7A}foloseste {FF0202}/car [name]{EFED7A} pentru a lua masina dorita\n{FF0202}->/teles{EFED7A} foloseste {FF0202}/teles {EFED7A}pentru a vedea toate teleporturile \n{FF0202}->/usercp{EFED7A} foloseste {FF0202}/usercp {EFED7A}pentru a vedea User Control Panel\n%s",sL);
ShowPlayerDialog(playerid, 9999, 0, "General Commands", string, "Ok", "Cancel");
return 1;
}



Re: Why this not work .. - Alex_Valde - 16.01.2011

ZOMG!!!!

What the **** are you trying to do with this:
pawn Код:
new string[9999], sL[9999];


Dude, please reduce the size of that array.
It's a crime to make that big, for nothing.


Re: Why this not work .. - Typhome - 16.01.2011

Use it [128] not [9999]


Re: Why this not work .. - Rock18 - 16.01.2011

Doesn't work , it doesn't matter i rezolved that problem , now i have another one , i think it's the same problem but i can't resolv this too ...this is the code ...
Код:
if(!strcmp(cmdtext, "/cmds2", true))
	{
	new string[999], sL[998], sI[997], sU[996], sY[995], sT[994];
	format(sL, sizeof(sL), "{FDFF66}/flip /healme /credits /rules /cc /count");
	format(sI, sizeof(sI), "{FDFF66}/godon /godoff /skin <id> /cpanel /ccredits");
        format(sU, sizeof(sU), "{FDFF66}/godcar /cash /culori /zi /noapte /nrg /fix");
        format(sY, sizeof(sY), "{FDFF66}/bug /sugestie /save /load /sprunk /beer /smoke");
        format(sT, sizeof(sT), "{FDFF66}/rampages /pgoto <id>");
	format(string, sizeof(string),"{FF0202}->/car [name]{EFED7A} foloseste {FF0202}/car [name]{EFED7A} pentru a lua masina dorita\n{FF0202}->/teles{EFED7A} foloseste {FF0202}/teles {EFED7A}pentru a vedea toate teleporturile \n{FF0202}->/usercp{EFED7A} foloseste {FF0202}/usercp {EFED7A}pentru a vedea User Control Panel\n\n\n%s\n%s\n%s\n%s\n%s",sL,sI,sU,sY,sT);
        return ShowPlayerDialog(playerid, 9990, 0, "General Commands", string, "Ok", "Cancel");
    }
When i compile the script i get
Код:
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Header size:            308 bytes
Code size:             1068 bytes
Data size:             3104 bytes
Stack/heap size:      16384 bytes; estimated max. usage=5994 cells (23976 bytes)
Total requirements:   20864 bytes
But , when i type the command in game it says Unknown command


Re: Why this not work .. - ExeC - 16.01.2011

Yea, omfg, that's because you are using too many 'cells', you must use:

pawn Код:
new string[128], sL[128], sI[128], sU[128], sY[128], sT[128];
Not over 900....


Re: Why this not work .. - Typhome - 16.01.2011

Код:
if(!strcmp(cmdtext, "/cmds2", true))
	{
	new string[999], sL[998], sI[997], sU[996], sY[995], sT[994];
	format(sL, sizeof(sL), "{FDFF66}/flip /healme /credits /rules /cc /count");
	format(sI, sizeof(sI), "{FDFF66}/godon /godoff /skin <id> /cpanel /ccredits");
        format(sU, sizeof(sU), "{FDFF66}/godcar /cash /culori /zi /noapte /nrg /fix");
        format(sY, sizeof(sY), "{FDFF66}/bug /sugestie /save /load /sprunk /beer /smoke");
        format(sT, sizeof(sT), "{FDFF66}/rampages /pgoto <id>");
	format(string, sizeof(string),"{FF0202}->/car [name]{EFED7A} foloseste {FF0202}/car [name]{EFED7A} pentru a lua masina dorita\n{FF0202}->/teles{EFED7A} foloseste {FF0202}/teles {EFED7A}pentru a vedea toate teleporturile \n{FF0202}->/usercp{EFED7A} foloseste {FF0202}/usercp {EFED7A}pentru a vedea User Control Panel\n\n\n%s\n%s\n%s\n%s\n%s",sL,sI,sU,sY,sT);
        ShowPlayerDialog(playerid, 9990, 0, "General Commands", string, "Ok", "Cancel");
       return 1;
    }



Re: Why this not work .. - Alex_Valde - 16.01.2011

@Rock18.
Man, with this
pawn Код:
new string[999], sL[998], sI[997], sU[996], sY[995], sT[994];
you use more memory than Windows 98.
And you have only one command. Congratulations!