SA-MP Forums Archive
Another help please :o - 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)
+--- Thread: Another help please :o (/showthread.php?tid=459582)



Another help please :o - Thundey - 23.08.2013

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;
}


Re: Another help please :o - HyDrAtIc - 23.08.2013

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


Re: Another help please :o - Thundey - 23.08.2013

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.


Re: Another help please :o - HyDrAtIc - 23.08.2013

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


Re: Another help please :o - PrinceKumar - 23.08.2013

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.


Re: Another help please :o - Thundey - 23.08.2013

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?


Re: Another help please :o - iZN - 23.08.2013

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;
}



Re: Another help please :o - Thundey - 23.08.2013

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


Re: Another help please :o - iZN - 23.08.2013

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.


Re: Another help please :o - Konstantinos - 23.08.2013

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.