[HELP] /Addscore
#3

never used strcmp and strtok, i'll give it a try.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/addscore", cmdtext, true, 10) == 0)
    {
        new tmp[256];
        tmp = strtok ( cmdtext, idx );
        if ( !strlen ( tmp ) )
        {
            SendClientMessage(playerid, COLOR_RED, "USAGE: /addscore [ID]");
            return 1;
  }
        new score = GetPlayerScore(tmp);
        SetPlayerScore(tmp,score+1);
       
        new name[MAX_PLAYER_NAME], string[49];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "%s(%d) added 1 score extra to your account.",name,playerid); //sends that message only to the plyer who got the score... %s is meant to say the Playername + ID of who added the score to him
        SendClientMessagel(tmp,0xFFFF00AA, string);

        return 1;
    }
    return 0;
}
Reply


Messages In This Thread
[HELP] /Addscore - by Larsey123IsMe - 08.12.2010, 23:01
Re: [HELP] /Addscore - by Lenny the Cup - 08.12.2010, 23:10
Re: [HELP] /Addscore - by The_Gangstas - 08.12.2010, 23:17
Re: [HELP] /Addscore - by iFriSki - 08.12.2010, 23:17
Re: [HELP] /Addscore - by Larsey123IsMe - 08.12.2010, 23:18
Re: [HELP] /Addscore - by The_Gangstas - 08.12.2010, 23:31
Re: [HELP] /Addscore - by Larsey123IsMe - 08.12.2010, 23:33
Re: [HELP] /Addscore - by The_Gangstas - 08.12.2010, 23:40
Re: [HELP] /Addscore - by Tessar - 12.12.2010, 16:36
Re: [HELP] /Addscore - by Lenny the Cup - 12.12.2010, 18:14

Forum Jump:


Users browsing this thread: 1 Guest(s)