SA-MP Forums Archive
Help with a command - 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: Help with a command (/showthread.php?tid=392935)



Help with a command - Michael98 - 16.11.2012

pawn Код:
new asay[128];
CMD:say(playerid,params[])
{
new w[128];
if(sscanf(params, "s[128]" ,w)) return SendClientMessage(playerid,-1,Error!);
else
{
foreach(Player,i)
{
SendClientMessage(i,-1,"Type '%s' first to win!");
asay[i] = w[0];
}
}
return 1;
}
public OnPlayerText(playerid, text[])
{
if(text == asay[playerid])
{
SendClientMessage(playerid,-1,"You won!");
}
return 1;
}
Can someone help me make this command please?
I dont know how to make it work :/


Re: Help with a command - SuperViper - 16.11.2012

Next time properly indent your code.

pawn Код:
new asay[MAX_PLAYERS][128];

CMD:say(playerid, params[])
{
    new w[128];
    if(sscanf(params, "s[128]" ,w)) return SendClientMessage(playerid, -1, "Error!");

    foreach(Player, i)
    {
        format(asay[i], 128, w);
        format(w, sizeof(w), "Type '%s' first to win!", w);
        SendClientMessage(i, -1, w);
    }

    return 1;
}

public OnPlayerText(playerid, text[])
{
    if(!strcmp(text, asay[playerid], true))
    {
        SendClientMessage(playerid,-1,"You won!");
    }

    return 1;
}



Re: Help with a command - Michael98 - 16.11.2012

Thanks a lot (+REP)