Jump to content
  • 0

pomoc admin chat pres strcmp


Ronnie

Dotaz

zdravim mam FS a v nem adminskript a admin chat mam ted dcmd prikaz /ac ale chtel bych to mit jak v exisu na // ale pres dcmd mi to neslo a se strcmp nedelam tak zadam o pomoc diky mam to ve FS takhle :

if (strcmp("//", cmdtext, true, 10) == 0)
	{
	    new string[256];
		if(!strlen(params)) return SendClientMessage(playerid, COLOR_BILA, "Spatne zadany prikaz --> /help");
  		for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
   		{
    		if(adminlevel[i] > 0)
    		{
       			format(string, sizeof(string), "ADMIN chat [%s]: %s", jmeno(playerid), params);
         		SendClientMessage(i, COLOR_SVMODRA, string);
          		}
     		}
		return 1;
	}

chyby to vyhodi tyhle :

C:\Users\Ronnie\SAMP\moje mody\Ronnie.pwn(930) : error 017: undefined symbol "params"
C:\Users\Ronnie\SAMP\moje mody\Ronnie.pwn(935) : error 017: undefined symbol "params" 

dekuji predem za kazdou pomoc

Edited by Ronnie
Link to comment
Share on other sites

5 odpovědí na tuto otázku

Recommended Posts

  • 0

Všechno  params

 

Přepiš na

 

cmdtext


Final Code:

if (strcmp("//", cmdtext, true, 10) == 0)
    {
     new string[256];
        if(!strlen(cmdtext)) return SendClientMessage(playerid, COLOR_BILA, "Spatne zadany prikaz --> /help");
        for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
        {
        if(adminlevel[i] > 0)
        {
            format(string, sizeof(string), "ADMIN chat [%s]: %s", jmeno(playerid), cmdtext);
        SendClientMessage(i, COLOR_SVMODRA, string);
        }
        }
        return 1;
    }
Link to comment
Share on other sites

  • 0

Polis_Polismanovic:

To není tak jednoduché jak myslíš a píšeš, tady potřebuješ využít práci se stringem

Př.:

if(!strcmp(cmdtext, "//", false, 2))
{
if(strlen(cmdtext) == 2) return SendClientMessage(playerid, -1, "Špatně");
new str[128];
strmid(str, cmdtext, 2, strlen(cmdtext));
format(str, 128, "ADMIN CHAT [%s]: %s", jmeno(playerid), str);
for(new i = 0; i < MAX_PLAYERS; i++)
if(IsPlayerConnected(i))
if(adminlevel[i] > 0)
SendClientMessage(i, COLOR_SVMODRA, str);
return 1;
}

Tohle by mělo fungoval, odtabuj si to a vyzkoušej

Link to comment
Share on other sites

  • 0

Polis_Polismanovic:

To není tak jednoduché jak myslíš a píšeš, tady potřebuješ využít práci se stringem

Př.:

if(!strcmp(cmdtext, "//", false, 2))
{
if(strlen(cmdtext) == 2) return SendClientMessage(playerid, -1, "Špatně");
new str[128];
strmid(str, cmdtext, 2, strlen(cmdtext));
format(str, 128, "ADMIN CHAT [%s]: %s", jmeno(playerid), str);
for(new i = 0; i < MAX_PLAYERS; i++)
if(IsPlayerConnected(i))
if(adminlevel[i] > 0)
SendClientMessage(i, COLOR_SVMODRA, str);
return 1;
}

Tohle by mělo fungoval, odtabuj si to a vyzkoušej

Ah Moje Chyba na String jsem zapoměl.

Link to comment
Share on other sites

  • 0
if(strcmp("//",cmdtext,true,2) == 0)
{
	new string[144];
	format(string,sizeof(string),"ADMIN chat [%s]: %s",jmeno(playerid),cmdtext[2]);
	for(new i;i<MAX_PLAYERS;i++)
	{
		if(IsPlayerConnected(i) && adminlevel[i] > 0) SendClientMessage(i,COLOR_SVMODRA, string);
	}
	return 1;
}

A nebo lepsi

if(cmdtext[1] == '/')
{
	new string[144];
	format(string,sizeof(string),"ADMIN chat [%s]: %s",jmeno(playerid),cmdtext[2]);
	for(new i;i<MAX_PLAYERS;i++)
	{
		if(IsPlayerConnected(i) && adminlevel[i] > 0) SendClientMessage(i,COLOR_SVMODRA, string);
	}
	return 1;
}
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...