Need a command 2 -
nuriel8833 - 03.08.2009
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
Re: Need a command 2 -
nuriel8833 - 04.08.2009
*bump*
please help me
Re: Need a command 2 -
[LL]InstabiC - 04.08.2009
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;
}
Re: Need a command 2 -
nuriel8833 - 04.08.2009
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?
Re: Need a command 2 -
[LL]InstabiC - 04.08.2009
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.
Re: Need a command 2 -
nuriel8833 - 04.08.2009
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?
Re: Need a command 2 -
[LL]InstabiC - 04.08.2009
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.
Re: Need a command 2 -
nuriel8833 - 04.08.2009
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
Re: Need a command 2 -
nuriel8833 - 04.08.2009
I really need the code you know...
Re: Need a command 2 -
nuriel8833 - 04.08.2009
you know its already 3rd page so if just someone can make me the regular code i will nbe happy