SA-MP Forums Archive
Stock and ZCMD help!! - 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)
+--- Thread: Stock and ZCMD help!! (/showthread.php?tid=519030)



Stock and ZCMD help!! - dieuhanhphuc - 12.06.2014

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;




AW: Stock and ZCMD help!! - BiosMarcel - 12.06.2014

what is the use of it?


Re: Stock and ZCMD help!! - dieuhanhphuc - 12.06.2014

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


Re: Stock and ZCMD help!! - NewerthRoleplay - 12.06.2014

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?


AW: Stock and ZCMD help!! - BiosMarcel - 12.06.2014

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?


Re: Stock and ZCMD help!! - dieuhanhphuc - 12.06.2014

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.


Re: AW: Stock and ZCMD help!! - dieuhanhphuc - 12.06.2014

Quote:

isn't that easier ?

or do you want to repeat the command?

Yes, right. I want to repeat it.


AW: Stock and ZCMD help!! - BiosMarcel - 12.06.2014

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?


Re: AW: Stock and ZCMD help!! - dieuhanhphuc - 12.06.2014

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.


Re: Stock and ZCMD help!! - Amrev - 12.06.2014

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>
}