Jump to content
  • 0

Comanda mapname


Question

Guest Fr0st
Posted

Se poate face o comanda pentru admini cu care poti schimba numele mapei? ceva genul din rcon sa fie in loc de /rcon mapname "SAN ANDREAS"  ceva gen /mapname ".......

7 answers to this question

Recommended Posts

Posted

normal..

if(strcmp(cmd, "/mapname) == 0)
{
new string[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /mapname [name]");
return 1;
}
mapname = strval(tmp);
format(string,256,"mapname %s",mapname);
SendRconCommand(string);
}

asta presupunand ca ai strtok in gm daca nu il ai sa imi spui si ti-l dau! app sa spui dak ti-a mers

Guest Fr0st
Posted

Nu il am daca doresti sa mi-l dai

Posted

strtok(const string[], &index)

{

new length = strlen(string);

while ((index < length) && (string[index] <= ' '))

{

index++;

}

new offset = index;

new result[20];

while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))

{

result[index - offset] = string[index];

index++;

}

result[index - offset] = EOS;

return result;

}

Guest Fr0st
Posted

Acestea unde le bag in GM?

Guest Fr0st
Posted

    if(strcmp(cmd, "/mapname",true) == 0)

  {

    new string[256];

    tmp = strtok(cmdtext, idx);

    if(!strlen(tmp))

        {

          SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /mapname [name]");

          return 1;

        }

    mapname = strval(tmp);

    format(string,256,"mapname %s",mapname);

    SendRconCommand(string);

    }

Am facut adr tot mai imi da o problema    D:\Documents and Settings\Fr0st\Desktop\gf.pwn(20760) : warning 219: local variable "string" shadows a variable at a preceding level

D:\Documents and Settings\Fr0st\Desktop\gf.pwn(20767) : error 033: array must be indexed (variable "mapname")

Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

1 Error.

Posted

    if(strcmp(cmd, "/mapname",true) == 0)

  {

    new string[256];

    tmp = strtok(cmdtext, idx);

    if(!strlen(tmp))

        {

          SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /mapname [name]");

          return 1;

        }

    mapname = strval(tmp);

    format(string,256,"mapname %s",mapname);

    SendRconCommand(string);

    }

Am facut adr tot mai imi da o problema    D:\Documents and Settings\Fr0st\Desktop\gf.pwn(20760) : warning 219: local variable "string" shadows a variable at a preceding level

D:\Documents and Settings\Fr0st\Desktop\gf.pwn(20767) : error 033: array must be indexed (variable "mapname")

Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

1 Error.

Incearca asa:

if(strcmp(cmd, "/mapname",true) == 0)
{
	new mapname[126];
     	tmp = strtok(cmdtext, idx);
     	if(!strlen(tmp))
        {
        	SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /mapname [name]");
           	return 1;
        }
     	mapname = strval(tmp);
     	format(string,256,"mapname %s",mapname);
    	SendRconCommand(string);
	return 1;
}

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.