Help with a command
#1

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 :/
Reply
#2

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;
}
Reply
#3

Thanks a lot (+REP)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)