SA-MP Forums Archive
Need help in /giveallscore (rep++) - 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: Need help in /giveallscore (rep++) (/showthread.php?tid=338192)



Need help in /giveallscore (rep++) - iOmar - 29.04.2012

I want /giveallscore cmd. I don't have it in admin script. Please can any one make for me>??

I have sample:
pawn Код:
dcmd_armourall(playerid,params[])
{
    #pragma unused params
    if(AccInfo[playerid][Level] >= 3)
    {
        SendCommandToAdmins(playerid,"ArmourAll");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
        if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel])
        {
        PlayerPlaySound(i,1057,0.0,0.0,0.0);
        SetPlayerArmour(i,100.0);
        }
        }
        new string[128];
        format(string,sizeof(string),"|- Administrator \"%s\" has Restored all players armour -|", pName(playerid));
        return SendClientMessageToAll(blue, string);
    }
    else return ErrorMessages(playerid, 6);
}



Re: Need help in /giveallscore (rep++) - Crazymax - 29.04.2012

try this:

pawn Код:
dcmd_giveallscore(playerid,params[])
{
    if(AccInfo[playerid][Level] >= 3)
    {
        SendCommandToAdmins(playerid,"ScoreAll");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
        if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel])
        {
        SetPlayerScore(i, strval(params));
        }
        }
        new string[128];
        format(string,sizeof(string),"|- Administrator \"%s\" has set all players score to %d -|", pName(playerid),strval(params));
        return SendClientMessageToAll(blue, string);
    }
    else return ErrorMessages(playerid, 6);
}



Re: Need help in /giveallscore (rep++) - iOmar - 29.04.2012

when i did this in game it said server unknown command..


Re: Need help in /giveallscore (rep++) - JaKe Elite - 29.04.2012

pawn Код:
dcmd_giveallscore(playerid,params[])
{
    if(AccInfo[playerid][Level] >= 3)
    {
        SendCommandToAdmins(playerid,"ScoreAll");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
        if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel])
        {
        SetPlayerScore(i, strval(params));
        }
        }
        new string[128];
        format(string,sizeof(string),"|- Administrator \"%s\" has set all players score to %d -|", pName(playerid),strval(params));
        return SendClientMessageToAll(blue, string);
    }
    else return ErrorMessages(playerid, 6);
    return 1;
}



Re: Need help in /giveallscore (rep++) - $$inSane - 29.04.2012

ok i make it for u


Re: Need help in /giveallscore (rep++) - Mean - 29.04.2012

Of course it said unknown command because you didn't add
pawn Код:
dcmd(giveallscore, 12, cmdtext);
to your OnPlayerCommandText.

This is necessary when using DCMD.
Click me for more info!

Also:
pawn Код:
dcmd_giveallscore(playerid,params[]) {
    if(AccInfo[playerid][Level] >= 3) {
        SendCommandToAdmins(playerid,"GiveAllScore");
        for(new i = 0; i < MAX_PLAYERS; i++) {
            SetPlayerScore(i, GetPlayerScore(i) + strval(params));
        }
        new string[128];
        format(string,sizeof string,"|- Administrator \"%s\" has given everyone %d score!", pName(playerid), strval(params));
        SendClientMessageToAll(blue, string);
    }
    else {
        ErrorMessages(playerid, 6);
    }
    return 1;
}
PS: What CrazyMax and Romel posted is SETallscore, not GIVEallscore.


Re: Need help in /giveallscore (rep++) - $$inSane - 29.04.2012

try this:


Код:
dcmd_givescore(playerid, params[])
{
    new giveplayerid,
        amount,
        gscore = GetPlayerScore(playerid);
    if(sscanf(params, "ud", giveplayerid, amount)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /givescore [playerid/partname] [amount]");
    else if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player not found");
    else if(amount > gscore) return SendClientMessage(playerid, 0xFF0000AA, "ERROE:Unknown Score");
    else
    {
        SetPlayerScore(giveplayerid,GetPlayerScore(giveplayerid) + amount);
        SetPlayerScore(playerid,gscore - amount);
        SendClientMessage(playerid, 0x00FF00AA, "Score Sent");
        SendClientMessage(giveplayerid, 0x00FF00AA, "You Recieved Score");
    }
    return 1;
}



Re: Need help in /giveallscore (rep++) - Mean - 29.04.2012

Quote:
Originally Posted by $$inSane
Посмотреть сообщение
try this:


Код:
dcmd_givescore(playerid, params[])
{
    new giveplayerid,
        amount,
        gscore = GetPlayerScore(playerid);
    if(sscanf(params, "ud", giveplayerid, amount)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /givescore [playerid/partname] [amount]");
    else if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player not found");
    else if(amount > gscore) return SendClientMessage(playerid, 0xFF0000AA, "ERROE:Unknown Score");
    else
    {
        SetPlayerScore(giveplayerid,GetPlayerScore(giveplayerid) + amount);
        SetPlayerScore(playerid,gscore - amount);
        SendClientMessage(playerid, 0x00FF00AA, "Score Sent");
        SendClientMessage(giveplayerid, 0x00FF00AA, "You Recieved Score");
    }
    return 1;
}
He needs giveALLscore, not givescore.


Re: Need help in /giveallscore (rep++) - iOmar - 29.04.2012

Thnx Al. It worked. Thnx Mean.... (rep added)