SA-MP Forums Archive
[HELP]Small help for cmd text - 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: [HELP]Small help for cmd text (/showthread.php?tid=570630)



[HELP]Small help for cmd text - fuckingcruse - 12.04.2015

Hey all i want to learn something like , if there is a command such as /heal
If player types /heal it's ok , but if he type /HEAL or /hEal or something it doesn't come can anyone teach me how to make everything to work if the letters are correct..


Re: [HELP]Small help for cmd text - aCloudy - 12.04.2015

This will work:
Код:
if (strcmp("/heal", cmdtext, true, 10) == 0)
Just replace this line with the line in your script > /heal command.


Re: [HELP]Small help for cmd text - fuckingcruse - 12.04.2015

and dude , as i dont want to spam the Topic's i got another doubt...

What's my mistake in this code?
Код:
CMD:stamina(playerid,params[])
{
    new option[20];
    if(isnull(params))
    {
        SendClientMessage(playerid , -1 /*You can use your color*/ , " /estamina <0 or 1> ");
    }
	if(!strcmp(option, "0", true))
	{
		SendClientMessage(playerid,-1 , " Now Player's will lose Stamina");
		return 1;
	}
	else
	if(!strcmp(option, "1", true))
	{
	    SendClientMessage(playerid,-1 , " Now player's will not lose their Stamina");
		ClearAnimations(MAX_PLAYERS);
		SetTimer("anim",4000,true);
		return 1;
	}
	return 1;
}

forward anim();
public anim()
{
	ClearAnimations(MAX_PLAYERS);
	return 1;
}
I just want to Make the stamina unlimited if /stamina 1 , orelse it will be normal.. what's my mistake?


Re: [HELP]Small help for cmd text - fuckingcruse - 12.04.2015

The codes I gave aren't working 1% .. lol


Re: [HELP]Small help for cmd text - ATGOggy - 12.04.2015

Quote:
Originally Posted by fuckingcruse
Посмотреть сообщение
and dude , as i dont want to spam the Topic's i got another doubt...

What's my mistake in this code?
Код:
CMD:stamina(playerid,params[])
{
    new option[20];
    if(isnull(params))
    {
        SendClientMessage(playerid , -1 /*You can use your color*/ , " /estamina <0 or 1> ");
    }
	if(!strcmp(option, "0", true))
	{
		SendClientMessage(playerid,-1 , " Now Player's will lose Stamina");
		return 1;
	}
	else
	if(!strcmp(option, "1", true))
	{
	    SendClientMessage(playerid,-1 , " Now player's will not lose their Stamina");
		ClearAnimations(MAX_PLAYERS);
		SetTimerEx("anim",4000,true, "i", playerid);
		return 1;
	}
	return 1;
}

forward anim(playerid);
public anim(playerid)
{
	ClearAnimations(playerid);
	return 1;
}
I just want to Make the stamina unlimited if /stamina 1 , orelse it will be normal.. what's my mistake?
You didn't assign a value to the string 'function'.

Try this:
Код:
IsNumeric(const string[])
{
	for (new i = 0, j = strlen(string); i < j; i++)
	{
		if (string[i] > '9' || string[i] < '0') return 0;
	}
    return 1;
}
CMD:stamina(playerid,params[])
{
    new option;
    if(isnull(params)) return SendClientMessage(playerid , -1 /*You can use your color*/ , " /estamina <0 or 1> ");
    if(!IsNumeric(params)) return SendClientMessage(playerid , -1 /*You can use your color*/ , " /estamina <0 or 1> ");
    option = strval(params);
     if(option==0)
     {
         SendClientMessage(playerid,-1 , " Now Player's will lose Stamina");
	 return 1;
     }
     if(option==1)
     {
         SendClientMessage(playerid,-1 , " Now player's will not lose their Stamina");
	 ClearAnimations(MAX_PLAYERS);
	 SetTimer("anim",4000,true);
	 return 1;
     }
     return 1;
}

forward anim();
public anim()
{
	ClearAnimations(MAX_PLAYERS);
	return 1;
}
And show the code for /heal


Re: [HELP]Small help for cmd text - fuckingcruse - 12.04.2015

That's not working , player is losing stamina


Re: [HELP]Small help for cmd text - ATGOggy - 12.04.2015

I edited my code, try it again.


Re: [HELP]Small help for cmd text - fuckingcruse - 13.04.2015

Not working , player is getting tired ATGOggy


Re: [HELP]Small help for cmd text - Stinged - 13.04.2015

It's not working because:
1- You're using MAX_PLAYERS instead of a player id.
2- You're using SetTimer, not SetTimerEx, it doesn't have any parameters.
3- It's not possible to have unlimited stamina.


Re: [HELP]Small help for cmd text - fuckingcruse - 13.04.2015

i used max player's because it will set for all.. and thanks for the info...