/giveallscore dcmd for LuxAdmin
#1

Hey all i want how to make /giveallscore cmd for luxadmin like this any one can make this for me and got 2 rep tnx


this is orginal lux admin cmd:

Код:
dcmd_giveallcash(playerid,params[])
{
	if(AccInfo[playerid][Level] >= 3)
	{
	    if(!strlen(params)) return
		SendClientMessage(playerid, LIGHTBLUE2, "Usage: /giveallcash [Value]") &&
		SendClientMessage(playerid, orange, "Function: Will give a specified value in Money for all players");
		new var = strval(params), string[128];
       	SendCommandToAdmins(playerid,"GiveAllCash");
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				PlayerPlaySound(i,1057,0.0,0.0,0.0);
				GivePlayerMoney(i,var);
			}
		}
		format(string,sizeof(string),"|- Administrator \"%s\" has given all Players '$%d' -|", pName(playerid), var );
		return SendClientMessageToAll(blue, string);
	}
	else return ErrorMessages(playerid, 1);
}

i got make this but when i m in game it say unknown cmd:



Код:
dcmd_giveallscore(playerid,params[])
{
if(AccInfo[playerid][Level] >= 3) {
if(!strlen(params)) return
SendClientMessage(playerid, LIGHTBLUE2, "USAGE: /giveallscore [score]");
SendClientMessage(playerid, orange, "Function: Will give a specified value in Score for all players");
new var = strval(params), string[128];
SendCommandToAdmins(playerid,"GIVEALLSCORE");
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
 PlayerPlaySound(i,1057,0.0,0.0,0.0);
 SetPlayerScore(playerid, GetPlayerScore(playerid)+var);
 }
  }
format(string,sizeof(string),"Administrator \"%s\" has given all players '%d' score/s", pName(playerid), var );
return SendClientMessageToAll(blue, string);    }
else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");}
Reply
#2

Don't you have to add the dcmd line onplayercommand up top also?

If I was you, I would just use zcmd, foreach, sscanf so for example:

pawn Код:
CMD:giveallscore(playerid, params[])
{
    new escore, string[128];
    if(AccInfo[playerid][Level] >= 3)
    {
        if(sscanf(params, "d", escore)) return SendClientMessage(playerid, -1, "USAGE: /giveallscore amount");

        foreach(Player, x)
        {
            format(string, sizeof(string), "You have been given an extra %d score.", escore);
            SendClientMessage(x, -1, string);
            SetPlayerScore(x, GetPlayerScore(x) + escore);
        }
    }
    else
    {
        SendClientMessage(playerid, -1, "You aren't high enough level to use this command.");
    }
    return 1;
}
Best of luck.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)