Scripting Help
#1

I need command /reward for admins i mean if someone reported a player and the report is right and banned i must give him a reward

i want the command : /reward <id> <cash> <score>

Thanks
Reply
#2

:bumb:
Reply
#3

:bumb:
Reply
#4

This is Scripting Help forum, not Script Request.
Go learn how to scripting, then if you have any problem, ask here.
Reply
#5

pawn Код:
CMD:reward(playerid, params[])
{
  if(IsPlayerAdmin(playerid))
    {
      new id,score,cash;
      if(sscanf(params,"iii",id,cash,score)
      {
        SendClientMessage(playerid,-1,"/reward <id> <cash> <score>");
        return 1;
      }
      else
      {
       if(IsPlayerConnected(id))
       {
       GivePlayerMoney(id,cash);
       SetPlayerScore(id,GetPlayerScore(playerid)+score);
       }
       else
       {
       SendClientMessage(playerid,-1,"Player is not connected");
       return 1;
       }
      }
    }
    else
    {
    SendClientMessage(playerid,-1,"You need to be an Admin to use this command");
    return 1;
    }
    return 1;
}
Reply
#6

@Rittik it have error:
Код:
error 001: expected token: ")", but found "{"
Error Line :
Код:
CMD:reward(playerid, params[])
{
  if(IsPlayerAdmin(playerid))
    {
      new id,score,cash;
      if(sscanf(params,"iii",id,cash,score)
      //This Line{
        SendClientMessage(playerid,-1,"/reward <id> <cash> <score>");
        return 1;
      }
      else
      {
       if(IsPlayerConnected(id))
       {
       GivePlayerMoney(id,cash);
       SetPlayerScore(id,GetPlayerScore(playerid)+score);
       }
       else
       {
       SendClientMessage(playerid,-1,"Player is not connected");
       return 1;
       }
      }
    }
    else
    {
    SendClientMessage(playerid,-1,"You need to be an Admin to use this command");
    return 1;
    }
    return 1;
}
Reply
#7

Now it's fine.
pawn Код:
CMD:reward(playerid, params[])
{
  if(IsPlayerAdmin(playerid))
    {
      new id,score,cash;
      if(sscanf(params,"iii",id,cash,score))
      {
        SendClientMessage(playerid,-1,"/reward <id> <cash> <score>");
        return 1;
      }
      else
      {
       if(IsPlayerConnected(id))
       {
       GivePlayerMoney(id,cash);
       SetPlayerScore(id,GetPlayerScore(playerid)+score);
       }
       else
       {
       SendClientMessage(playerid,-1,"Player is not connected");
       return 1;
       }
      }
    }
    else
    {
    SendClientMessage(playerid,-1,"You need to be an Admin to use this command");
    return 1;
    }
    return 1;
}
Reply
#8

It's worked, but i want it for my admin system so i will change:

Код:
if(IsPlayerAdmin(playerid))
with :
Код:
if (PlayerInfo[playerid][Admin] == 2) return SendClientMessage(playerid, 0xF50A0AFF, "<!> ERROR: You are not authorized to use this command!");
?
Reply
#9

pawn Код:
CMD:reward(playerid, params[])
{
  if(PlayerInfo[playerid][Admin] == 2||IsPlayerAdmin(playerid))
    {
      new id,score,cash;
      if(sscanf(params,"iii",id,cash,score))
      {
        SendClientMessage(playerid,-1,"/reward <id> <cash> <score>");
        return 1;
      }
      else
      {
       if(IsPlayerConnected(id))
       {
       GivePlayerMoney(id,cash);
       SetPlayerScore(id,GetPlayerScore(playerid)+score);
       }
       else
       {
       SendClientMessage(playerid,-1,"Player is not connected");
       return 1;
       }
      }
    }
    else
    {
    SendClientMessage(playerid, 0xF50A0AFF, "<!> ERROR: You are not authorized to use this command!");
    return 1;
    }
    return 1;
}
Reply
#10

pawn Код:
CMD:reward(playerid, params[])
{
  if(PlayerInfo[playerid][Admin] >= 2||IsPlayerAdmin(playerid)) // Try now.
    {
      new id,score,cash;
      if(sscanf(params,"iii",id,cash,score))
      {
        SendClientMessage(playerid,-1,"/reward <id> <cash> <score>");
        return 1;
      }
      else
      {
       if(IsPlayerConnected(id))
       {
       GivePlayerMoney(id,cash);
       SetPlayerScore(id,GetPlayerScore(playerid)+score);
       }
       else
       {
       SendClientMessage(playerid,-1,"Player is not connected");
       return 1;
       }
      }
    }
    else
    {
    SendClientMessage(playerid, 0xF50A0AFF, "<!> ERROR: You are not authorized to use this command!");
    return 1;
    }
    return 1;
}
Try now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)