SA-MP Forums Archive
Command NOT working - 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: Command NOT working (/showthread.php?tid=183981)



Command NOT working - kvsolga - 17.10.2010

hi i have got this command it compiles fine but when i go ingame it doesn't work Here:

--------------------------------------------
}
dcmd(c,1,cmdtext);
return 1;
}

dcmd_c(playerid,params[])
{
if(IsPlayerClan(playerid))
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerClan(i))
{
new string[1024];
new name[256];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"Clan Chat- %s: %s",name,params);
SendClientMessage(i,0x0033FFFF,string);
}
}
return 1;
------------------------------------------------

Please help me


Re: Command NOT working - kvsolga - 18.10.2010

sorry for double post but someone help meh out


Re: Command NOT working - JaTochNietDan - 18.10.2010

pawn Код:
dcmd_c(playerid,params[])
{
    if(IsPlayerClan(playerid)) // This seems a little pointless, you could do it this way:
    if(!IsPlayerClan(playerid)) return SendClientMessage(playerid,red,"You need to be in a clan");
    new string[1024]; // Try not to create so many local scoped variables in loops, there's no need for so much memory allocation and de-allocation so many times, the same space in memory should be re-used.
    new name[256];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerClan(i))
        {
            GetPlayerName(playerid,name,sizeof(name));
            format(string,sizeof(string),"Clan Chat- %s: %s",name,params);
            SendClientMessage(i,0x0033FFFF,string);
        }
    }
    return 1;
} // Forgot a bracket...



Re: Command NOT working - kvsolga - 18.10.2010

it still wont work..


Re: Command NOT working - JaTochNietDan - 18.10.2010

Quote:
Originally Posted by kvsolga
Посмотреть сообщение
it still wont work..
That's not much help, I need to know what's wrong. What happens?

Also where did you put this in your script?

pawn Код:
dcmd(c,1,cmdtext);
return 1;