How to make /givecashall Command ?
#1

SOLVED!!! THANKS ALL!
Reply
#2

Use: zcmd, sscanf2,

Include(s):
Код:
#include <zcmd>
#include <sscanf2>
Try This:
pawn Код:
CMD:givecashall(playerid, params[])
{
    new value;
    if(!IsPlayerAdmin(playerid)) return 1;
    if(sscanf(params, "d", value) != 0) SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /givecashall [Amount]"); return 1;
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            GivePlayerMoney(i, value);
        }
    }
    return 1;
}
or

pawn Код:
CMD:givecashall(playerid, params[])
{
    new value;
    if(sscanf(params, "d", value) != 0)
    return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /givecashall [Amount]");
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            GivePlayerMoney(i, value);
        }
    }
    return 1;
}
Reply
#3

This is a quick example code, you need the include zcmd and sscanf
pawn Код:
CMD:givecashall(playerid, params[])
{
    new
        amount;
    if(sscanf(params, "i", amount))
        return SendClientMessage(playerid, -1, "/givecashall [Amount]");

    for(new i = 0; i <= MAX_PLAYERS; i++) //I prefer using foreach.
    {
        if(!IsPlayerConnected(playerid)) continue;
        GivePlayerMoney(i, amount);
    }
    return true;
}
- This forum requires that you wait 240 seconds between posts. Please try again in 71 seconds.
Reply
#4

For the two replies...
Код:
C:\Users\Ivailo\Desktop\Iordan\Servers\PCRP\filterscripts\DontHouse.pwn(94) : error 029: invalid expression, assumed zero
C:\Users\Ivailo\Desktop\Iordan\Servers\PCRP\filterscripts\DontHouse.pwn(94) : error 017: undefined symbol "cmd_givecashall"
C:\Users\Ivailo\Desktop\Iordan\Servers\PCRP\filterscripts\DontHouse.pwn(94) : error 029: invalid expression, assumed zero
C:\Users\Ivailo\Desktop\Iordan\Servers\PCRP\filterscripts\DontHouse.pwn(94) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#5

Quote:
Originally Posted by dakata994
Посмотреть сообщение
For the two replies...
Код:
C:\Users\Ivailo\Desktop\Iordan\Servers\PCRP\filterscripts\DontHouse.pwn(94) : error 029: invalid expression, assumed zero
C:\Users\Ivailo\Desktop\Iordan\Servers\PCRP\filterscripts\DontHouse.pwn(94) : error 017: undefined symbol "cmd_givecashall"
C:\Users\Ivailo\Desktop\Iordan\Servers\PCRP\filterscripts\DontHouse.pwn(94) : error 029: invalid expression, assumed zero
C:\Users\Ivailo\Desktop\Iordan\Servers\PCRP\filterscripts\DontHouse.pwn(94) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
What's line 94 also make sure you don't put that command underneath the callback called OnPlayerCommandText, also make sure that you have the include zcmd
Reply
#6

read this topic mate https://sampforum.blast.hk/showthread.php?tid=303514
Reply
#7

Because you don't have #include <zcmd> included.

Click me for image.


PHP код:
This forum requires that you wait 240 seconds between postsPlease try again in 107 seconds
Reply
#8

Where did you placed "CMD:givecashall(playerid, params[])" ?

If you put it inside the "public OnPlayerCommandText(playerid,cmdtext[])" Callback, remove it and place it anywhere into your Script.

And Also you must have ZCMD Include.

Downloads,

ZCMD
SSCANF2
Reply
#9

Make sure that you haven't already started a command and then didn't end it, i.e:

pawn Код:
CMD:command1(playerid, params[]) // this is a pure example
{
     SendClientMessage(playerid, -1, "...");
     Kick(playerid);
// here, the command is lacking the close bracket

CMD:givecashforall(playerid, params[])
{
     Code...
     return 1;
}
As you can see, on the first command, you didn't end it which will return that problem.
Reply
#10

Problem Solved Thanks all !!!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)