Another help please :o
#1

hey there ,

my problem is kinda weird , actually it is weird . I'll go directly to the problem. This is a script for /changename i added to my script , when i compile it , it actually success in compiling it but when i go in-game it says invalid cmd.
i really tried different ways none worked , and the weird part is that it successfully compiled , so if anyone can help me i'll be grateful


dcmd_changename(playerid, params[])
{
if(AccountInfo[playerid][aLevel] < 5) SendClientMessage(playerid, COLOR_RED, "AdminLevel 5 needed for this command!");
new name[MAX_PLAYER_NAME], newname[16];
GetPlayerName(playerid, name, sizeof(name));
if(sscanf(params,"s", newname)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /changename [new name]");
if(dini_Exists(newname)) return SendClientMessage(playerid, COLOR_RED, "That name has already been taken!");
if(strlen(params) >= 3)
{
format(file, sizeof(file), "users/%s.txt", name);
dini_Set(file, "%s.txt", newname);
SendClientMessage(playerid, COLOR_GREEN, "Your name has been successfully been changed");
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "That name is too short, pick something else!");
}
return 1;
}
Reply
#2

First, make sure you have folder "users" into your "scriptfiles" folder, secondly, make sure you are admin +level 5.
Reply
#3

yea , i have the Users and i'm level 5 that's why its weird. Also i did a /clearchat command which also got compiled but ingame it says invalid cmd , which is also weird and will make me go crazy.
Reply
#4

Can you show me the clearchat command using [pawn] tags?
Reply
#5

Ur cmd can give unknown if there will be any little mistake in ur cmd or related function check that your function are scripted properly or not or check which lines giving you these errors for a little untouched reason.
Reply
#6

dcmd_cc(playerid,params[])
{
if(Accountinfo[playerid][aLevel] < 3) SendClientMessage(playerid, COLOR_RED, "AdminLevel 3 needed for this command!");
else
(
for(new i = 0; i < 250; i++) SendClientMessageToAll(0x00000000," ");
return 1;
}


PS: is that a bad script for a /cc command?
Reply
#7

lrn2usebbcodes
Always use this bbcode for adding pawn script: pawn and /pawn with []

Why are you using simple brackets, use curly brackets(braces).

Fixed your command:
pawn Код:
dcmd_cc(playerid,params[])
{
  if(Accountinfo[playerid][aLevel] < 3)
         return SendClientMessage(playerid, COLOR_RED, "AdminLevel 3 needed for this command!");
    for(new i = 0; i < 100; i++)
    {
        SendClientMessageToAll(0x00000000, " ");
    }
   return 1;
}
Reply
#8

btw , it still didn't work. Its successfully compiles but it says invalid cmd ingame
Reply
#9

Quote:
Originally Posted by Thundey
Посмотреть сообщение
btw , it still didn't work. Its successfully compiles but it says invalid cmd ingame
Did you even put this in OnPlayerCommandText callback?

pawn Код:
// change that 1 if its already used
dcmd(cc, 1, cmdtext);
If still doesn't helps, please show your OnPlayerCommandText callback.
Reply
#10

Quote:
Originally Posted by iZN
Посмотреть сообщение
Did you even put this in OnPlayerCommandText callback?

pawn Код:
// change that 1 if its already used
dcmd(cc, 1, cmdtext);
If still doesn't helps, please show your OnPlayerCommandText callback.
That number there is for the lenght, it's not something close to ID. "cc" should have 2.

@Thundey: Do you use only dcmd for commands at the same mode? If you use some commands with dcmd and let's say some other with ZCMD, some of them will not work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)