Need a command 2
#1

someone gave me that code:
pawn Код:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

@ onplayercommand text
dcmd(givecashtoall,13,cmdtext);

dcmd_givecashtoall(playerid,params[])
{
  for(new i=0;i<MAX_PLAYERS;i++) {
  if(IsPlayerConnected(i)){
  GivePlayerMoney(i,10000);
  }
  }
  return 1;
}

I need it as a command (like /money) not in dcmd.
and i need that if the admin is doing /money 1 it will give all 10000$
if he is doing /money 2 it will give all 100000$
and if he is doing /money 3 it will give all 1000000$


tanks for helpers
Reply
#2

*bump*
please help me
Reply
#3

Its not hard to duplicate the command to change the ammounts,

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/money", cmdtext, true, 6) == 0)
    {
    for(new i=0;i<MAX_PLAYERS;i++) {
    if(IsPlayerConnected(i)){
    GivePlayerMoney(i,10000);
    }
    }  
    return 1;
    }
    return 1;
}
to make it admin only

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/money", cmdtext, true, 6) == 0)
    {
    if(IsPlayerAdmin(playerid)){
    for(new i=0;i<MAX_PLAYERS;i++) {
    if(IsPlayerConnected(i)){
    GivePlayerMoney(i,10000);
    }
    }  
    }
    return 1;
    }
    return 1;
}

Reply
#4

tanks but why 2 return 1?
I need that if the admins is doing /money 1 it will give 10000$ if it /money 2 it will give 100000$ and if it /money 3 it iwll give 1000000$
did you understand me?
Reply
#5

Quote:
Originally Posted by nuriel8833
tanks but why 2 return 1?
I need that if the admins is doing /money 1 it will give 10000$ if it /money 2 it will give 100000$ and if it /money 3 it iwll give 1000000$
did you understand me?
No, not really, but there are 2 return 1's because the public function is being returned, and the code inside the public function is being returned.
Reply
#6

you know those command that you are doing the command and after that a number like:
/cd 60

I need to do that but if the number is 1 it will give 10000$ and if the number 2 it will give 100000$ and if the number 3 it will give 1000000$

now did you understand me?
Reply
#7

Sort of, and the easiest way to do that, is dcmd

pawn Код:
dcmd_killmsg(playerid,params[])
{
    if((!strcmp(params,"1",true)) || (!strcmp(params,"\"1\"",true))) {
    for(new i=0;i<MAX_PLAYERS;i++) {
    if(IsPlayerConnected(i)){
    GivePlayerMoney(i,10000);
    }
    }  
    return 1;
    }

    if((!strcmp(params,"2",true)) || (!strcmp(params,"\"2\"",true))) {
    for(new i=0;i<MAX_PLAYERS;i++) {
    if(IsPlayerConnected(i)){
    GivePlayerMoney(i,100000);
    }
    }  
    return 1;
    }

    if((!strcmp(params,"3",true)) || (!strcmp(params,"\"3\"",true))) {
    for(new i=0;i<MAX_PLAYERS;i++) {
    if(IsPlayerConnected(i)){
    GivePlayerMoney(i,1000000);
    }
    }  
    return 1;
    }
return 1;
}
That should work, sorry but I mainly use dcmd.
Reply
#8

Quote:
Originally Posted by InstabiC
Sort of, and the easiest way to do that, is dcmd

pawn Код:
dcmd_killmsg(playerid,params[])
{
    if((!strcmp(params,"1",true)) || (!strcmp(params,"\"1\"",true))) {
    for(new i=0;i<MAX_PLAYERS;i++) {
    if(IsPlayerConnected(i)){
    GivePlayerMoney(i,10000);
   }
   }   
    return 1;
    }

    if((!strcmp(params,"2",true)) || (!strcmp(params,"\"2\"",true))) {
    for(new i=0;i<MAX_PLAYERS;i++) {
    if(IsPlayerConnected(i)){
    GivePlayerMoney(i,100000);
   }
   }   
    return 1;
    }

    if((!strcmp(params,"3",true)) || (!strcmp(params,"\"3\"",true))) {
    for(new i=0;i<MAX_PLAYERS;i++) {
    if(IsPlayerConnected(i)){
    GivePlayerMoney(i,1000000);
   }
   }   
    return 1;
    }
return 1;
}
That should work, sorry but I mainly use dcmd.
OHHHHHHHHHHHH FUCK THAT DCMD!!!!!!!!!!!!
Can someone make that to a reguler code i dont know how to do that
Reply
#9

I really need the code you know...
Reply
#10

you know its already 3rd page so if just someone can make me the regular code i will nbe happy
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)