command givescore
#5

Quote:
Originally Posted by Kyosaur
Посмотреть сообщение
pawn Код:
//needs dcmd and sccanf - search or pm me if you dont have it.

//top - global var
new String[128];

//OnPlayerCommandText

dcmd(givescore, 9, cmdtext);

//Anywhere else (not in a callback ofc)
dcmd_givescore(playerid, params[])
{
    new GivePlayerID, Score;
    if(!sscanf(params, "ud", GivePlayerID, Score))
    {
      if(IsPlayerConnected(GivePlayerID))
      {
        new Name[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME],current = GetPlayerScore(GivePlayerID);
        SetPlayerScore(GivePlayerID, current+Score);
        GetPlayerName(GivePlayerID, Name, sizeof(Name));
        GetPlayerName(playerid, pName, sizeof(pName));
       
        format(String, sizeof(String), "You were given %d score points by %s!",Score,pName);
        SendClientMessage(playerid, 0xFFFFFFFF, String);
        format(String, sizeof(String), "You gave %s %d score points!",Name,Score);
        SendClientMessage(playerid, 0xFFFFFFFF, String);
        return 1;
      }
      SendClientMessage(playerid,0xAA3333AA, "Error: That player isnt connected!");
      return 1;
    }
    SendClientMessage(playerid,0xAA3333AA, "Syntax Error: /Givescore <UserName/ID> <Score>");
    return 1;
}
I tried that, but for some reason it gives 0 score no matter what amount I insert.
Reply


Messages In This Thread
command givescore - by RenisiL - 02.11.2009, 16:43
Re: command givescore - by _Vortex - 02.11.2009, 17:50
Re: command givescore - by Correlli - 02.11.2009, 19:44
Re: command givescore - by Kyosaur - 02.11.2009, 21:19
Re: command givescore - by Superrollo - 02.08.2011, 21:57

Forum Jump:


Users browsing this thread: 1 Guest(s)