converting strcmp
#1

Hi

Please help,i need to convert this command strcmp.

Код:
CMD:snow(playerid, params[])
{
	if(snowOn{playerid})
	{
	    DeleteSnow(playerid);
	    SendClientMessage(playerid, 0x00FF00AA, "* A hуesйs elбllt!");
	}
	else
	{
	    CreateSnow(playerid);
	    SendClientMessage(playerid, 0x00FF00AA, "* A hуesйs elindult!");
	}
	return 1;
}

CMD:allsnowon(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    ploop(i) //This is included in my FS! It's the '#define ploop(%0)' thing.
    {
        if(snowOn{i}) continue;
        CreateSnow(i);
    }
    return 1;
}

CMD:allsnowoff(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    ploop(i)
    {
        if(!snowOn{i}) continue;
        DeleteSnow(i);
    }
    return 1;
}
Thanks!

Sorry for my low english
Reply
#2

Please don't. Search for a ZCMD tutorial and learn how to use it. Converting this code to strcmp would be like exchanging a Lamborghini for a Lada.
Reply
#3

Even though it's not the best decision, it is what he's asking for after all, and we are here to help.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext,"/snow",true) == 0)
    {
        if(snowOn{playerid})
        {
            DeleteSnow(playerid);
            SendClientMessage(playerid, 0x00FF00AA, "* A hуesйs elбllt!");
        }
        else
        {
            CreateSnow(playerid);
            SendClientMessage(playerid, 0x00FF00AA, "* A hуesйs elindult!");
        }
        return 1;
    }

    if(strcmp(cmdtext,"/allsnowon",true) == 0)
    {
        if(!IsPlayerAdmin(playerid)) return 0;
        ploop(i) //This is included in my FS! It's the '#define ploop(%0)' thing.
        {
            if(snowOn{i}) continue;
            CreateSnow(i);
        }
        return 1;
    }

    if(strcmp(cmdtext,"/allsnowoff",true) == 0)
    {
        if(!IsPlayerAdmin(playerid)) return 0;
        ploop(i)
        {
            if(!snowOn{i}) continue;
            DeleteSnow(i);
        }
        return 1;
    }
    return 0;
}
Reply
#4

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
Even though it's not the best decision, it is what he's asking for after all, and we are here to help.

- code -
Giving him an answer while providing a code without explaining anything isn't helping.
Telling him that he should learn how ZCMD works - and preferrably start using it - however is.
Reply
#5

Try this

Quote:

if(strcmp(cmd, "/snow", true) == 0)
{
if(snowOn{playerid})
{
DeleteSnow(playerid);
SendClientMessage(playerid, 0x00FF00AA, "* A hуesйs elбllt!");
}
else
{
CreateSnow(playerid);
SendClientMessage(playerid, 0x00FF00AA, "* A hуesйs elindult!");
}
return 1;
}

if(strcmp(cmd, "/allsnowon", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return 0;
ploop(i) //This is included in my FS! It's the '#define ploop(%0)' thing.
{
if(snowOn{i}) continue;
CreateSnow(i);
}
return 1;
}

if(strcmp(cmd, "/allsnowoff", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return 0;
ploop(i)
{
if(!snowOn{i}) continue;
DeleteSnow(i);
}
return 1;
}

Reply
#6

Quote:
Originally Posted by LarzI
Посмотреть сообщение
Giving him an answer while providing a code without explaining anything isn't helping.
Telling him that he should learn how ZCMD works - and preferrably start using it - however is.
It is only giving him advice. He asked for code (or a convert to be precise) so there is nothing wrong with his post. I don't really get why you have to get so upset about this?
Reply
#7

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
It is only giving him advice. He asked for code (or a convert to be precise) so there is nothing wrong with his post. I don't really get why you have to get so upset about this?
Because if you taught him how to use ZCMD instead of convert the code, he'd be able to use a much faster command system.
Reply
#8

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
It is only giving him advice.
Yes. Isn't this the 'Scripting Help' section?

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
He asked for code (or a convert to be precise) so there is nothing wrong with his post.
That's exactly what's wrong with his post. If you're going to ask for code, you should post in the Script Request thread.
Reply
#9

They have tutorials for that kind of thing, if they want to learn, they would search for tutorials, they're not going to ask for help, they just study the code and see what they did wrong, or what they were missing. If they want to learn how to code something, they can either request it to be done for them, or they can get off their ass and search for help instead. Next time you reply to someone's thread, I would like to see you 'teach' them how to code it in full detail, like you have done so often in the past...
Reply
#10

Quote:
Originally Posted by LarzI
Посмотреть сообщение
[..]especially rule #7 - which is by the way a stickied thread: https://sampforum.blast.hk/showthread.php?tid=355296[..]
Quote:
Originally Posted by mamorunl
Посмотреть сообщение
It is only giving him advice. He asked for code (or a convert to be precise) so there is nothing wrong with his post. I don't really get why you have to get so upset about this?
He's requesting, not asking for a scripting help.

Quote:
Originally Posted by LarzI
Посмотреть сообщение
Converting this code to strcmp would be like exchanging a Lamborghini for a Lada.
Haha!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)