How Would I Do A Setscore Command - DCMD Please?
#1

Ok i script in dcmd, ye big deal. If you cant deal with it, get lost.

I need a setscore cmd. Please, Just a little code snippet and if u need any code from the script to help just ask... Its just bugging me atm.


pawn Код:
//This Is The Public For Increase Player Score
public IncreasePlayerScore(playerid,Value)
{
    new pscore = GetPlayerScore(playerid);
    pscore +=Value;
    SetPlayerScore(playerid,pscore);
    return 1;
}
pawn Код:
//This Is The Public For Decrease Player Score
public DecreasePlayerScore(playerid,Value)
{
    new pscore = GetPlayerScore(playerid);
    pscore -=Value;
    SetPlayerScore(playerid,pscore);
    return 1;
}
Reply
#2

Код:
new string[128], giveplayerid, pscore, amount;
new pscore = GetPlayerScore(playerid);
if(sscanf(params, "udd", giveplayerid, pscore, amount))
SetPlayerScore(giveplayerid, pscore) = amount;
format(string, sizeof(string), "   %s's Level has been set to %d.", GetPlayerNameEx(giveplayerid), amount);
SetPlayerScore(giveplayerid, pscore);
something like that.
Reply
#3

pawn Код:
public SetPlayerScoreEx(playerid,Value)
{
    SetPlayerScore(playerid,GetPlayerScore(playerid)+Value);
    return 1;
}
Reply
#4

SetPlayerScoreEx(playerid,?);

Where the ? is what would i put?
Reply
#5

A positive value, if you increase the score.
A negative value, if you decrease the score.
Reply
#6

its meant to be the command like /setscore [id] [score]

Like this

pawn Код:
dcmd_setscore(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "[ERROR]No Such Command :D");
    new Target, Level;
    if(!sscanf(params, "ui", Target, Level))
    {
        new string[128], string1[128], myname[24], targetname[24];
        GetPlayerName(playerid, myname, 24);GetPlayerName(Target, targetname, 24);
        SetPlayerScoreEx(playerid,AMOUNT);
        format(string, sizeof string, "Admin Has Changed Your Score ", myname);
        format(string1, sizeof string1, "You changed %s's score. ", targetname);
        SendClientMessage(playerid, -1, string1);
        SendClientMessage(Target, -1, string);
    } else return SendClientMessage(playerid, -1, "Usage: /setscore [playerid] [score]");
    return 1;
}
Where 'AMOUNT' Is i want it to be literally what score you want it set to...

Like this

Their score is 150, you do /setscore id 1

Their score will then be set to 1

then you do
/setscore id 40008

their score will now be 40008
Reply
#7

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
A positive value, if you increase the score.
A negative value, if you decrease the score.
Its emberashing that you even have to explain that...
Reply
#8

Quote:
Originally Posted by JAMMIEISFTW
Посмотреть сообщение
Where 'AMOUNT' Is i want it to be literally what score you want it set to...

Like this

Their score is 150, you do /setscore id 1

Their score will then be set to 1

then you do
/setscore id 40008

their score will now be 40008
So :
pawn Код:
dcmd_setscore(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "[ERROR]No Such Command :D");
    new Target, Level;
    if(sscanf(params, "ri", Target, Level))
        return SendClientMessage(playerid, -1, "Usage: /setscore [playerid] [score]");

    SetPlayerScore(Target,Level);
    new VBString[64], VBName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, VBName, MAX_PLAYER_NAME);
    format(VBString, sizeof VBString, "Admin %s Has Changed Your Score ", VBName);
    SendClientMessage(Target, -1, VBString);
    GetPlayerName(Target, VBName, MAX_PLAYER_NAME);
    format(VBString, sizeof VBString, "You changed %s's score. ", VBName);
    SendClientMessage(playerid, -1, VBString);
    return true;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)