Stock and ZCMD help!!
#1

i want to create a command, which return the name of the command to the stock, then the stock return that cmd. Can do that? Pls help me, thanks!

Example:
PHP код:
stock CheckAnim(playerid)
{
    if(
TheAnim[playerid] == 0) return 0;
    if(
TheAnim[playerid] == 1) return 1;
    return 
0;
}
stock DoAnim(playeridnamecmd[])
{
    
TheAnim[playerid] = 1;
    return 
cmd_namecmd[](playeridparams);
}
CMD:test(playeridparams[])
{
    if(
CheckAnim(playerid) == 0)
    {
        
DoAnim(playerid"test");
        return 
1;
    }
    
SendClientMessageEx(playerid, -1"Success.");
    return 
1;

Reply
#2

what is the use of it?
Reply
#3

i need it to make the progress for the command with animation. Can u help me?
Reply
#4

I think I understand what you're trying to achieve but why are you? Also use PAWN tags rather than quote's as it's hard to see without indentation. Also in future when trying to see if something works or not... Why not actually try it?
Reply
#5

PHP код:
stock CheckAnim(playerid)
{
if(
TheAnim[playerid] == 0) return 0;
if(
TheAnim[playerid] == 1) return 1;
}
CMD:test(playeridparams[])
{
    if(
CheckAnim(playerid) == 0)
    {
        
TheAnim[playerid] = 1;
    }
    
SendClientMessageEx(playerid, -1"Success.");
    return 
1;

isn't that easier ?

or do you want to repeat the command?
Reply
#6

Quote:
Originally Posted by NewerthRoleplay
Посмотреть сообщение
I think I understand what you're trying to achieve but why are you? Also use PAWN tags rather than quote's as it's hard to see without indentation. Also in future when trying to see if something works or not... Why not actually try it?
Sr about the quote, i fix it. I try to test the code, but it's not working, that's why i need a help.
Reply
#7

Quote:

isn't that easier ?

or do you want to repeat the command?

Yes, right. I want to repeat it.
Reply
#8

PHP код:
stock Test(playerid)
{
    if(
TheAnim[playerid] == 0)
    {
        
TheAnim[playerid] = 1;        
        
Test(playerid);
    } else {
        
SendClientMessageEx(playerid, -1"Success.");
    }
    return 
1;
}
CMD:test(playeridparams[])
{
    
Test(playerid);
    return 
1;

like that? or i still don't got it?
Reply
#9

Quote:
Originally Posted by [Bios]Marcel
Посмотреть сообщение
like that? or i still don't got it?
Thanks for your help. I think it's true, but it's not exactly what i need. I just want the stock can return the cmd with it's name.
Reply
#10

Let me give you an example:

pawn Код:
CMD:greet(playerid,params[])
{
 SendClientMessage(playerid,-1,"Hello ,How are you ?");
 return 1;
}
If you want to return this command in a stock.

pawn Код:
stock greeting()
{
 return cmd_greet; //It should be "cmd_(command name here)" if you are using <zcmd>
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)