SA-MP Forums Archive
Command with a define - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Command with a define (/showthread.php?tid=189710)



Command with a define - RedFusion - 12.11.2010

Can i edit this?

Код:
#define kills 15
With a command, because i want to be able to edit this definiton to 10, 20 and other numbers when i want to.
Someone please give me an example?


Re: Command with a define - Retardedwolf - 12.11.2010

Just use a var?


Re: Command with a define - RedFusion - 12.11.2010

I'm new to variables, how do i do?


Re: Command with a define - Retardedwolf - 12.11.2010

pawn Код:
new kills;

? I don't really understand what you need the command for. Maybe tell me more?


Re: Command with a define - iggy1 - 12.11.2010

As for your original question, no you can not change a define - after the script has been compiled. Ever.


Re: Command with a define - RedFusion - 13.11.2010

I want to make like a command with /setkills [Kills]
So i could use it like /setkills 20.


Re: Command with a define - Retardedwolf - 13.11.2010

pawn Код:
COMMAND:setkills( playerid, params [ ] )
{
    kills = strval ( params );
    return 1;
}
ZCMD.


Re: Command with a define - Hal - 13.11.2010

pawn Код:
command(setkills, playerid, params[])
{
    new amount;
    if( sscanf( params, "u", amount ) )
    {
        SendClientMessage(playerid, WHITE, "SYNTAX: /setkills [amount]");
    }
    else
    {
        if (IsPlayerAdmin(playerid))
        {
            Kills = amount;
        }
    }
    return 1;
}
idk if it will work. Just an example


Re: Command with a define - Hal - 13.11.2010

Quote:
Originally Posted by Retardedwolf
Посмотреть сообщение
pawn Код:
COMMAND:setkills( playerid, params [ ] )
{
    kills = strval ( params );
    return 1;
}
ZCMD.
when i saw it first i was wondering why you didnt use params :P