[HELP]Small help for cmd text
#1

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..
Reply
#2

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

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?
Reply
#4

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

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
Reply
#6

That's not working , player is losing stamina
Reply
#7

I edited my code, try it again.
Reply
#8

Not working , player is getting tired ATGOggy
Reply
#9

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.
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)