SA-MP Forums Archive
Questions - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: General (https://sampforum.blast.hk/forumdisplay.php?fid=13)
+--- Thread: Questions (/showthread.php?tid=453910)



Questions - Uberanwar - 26.07.2013

Hello I'm Uberanwar I want to ask some questions..

1. How to convert commands alot faster? I've like 50 commands - I've strcmp cmds, i want to convert it to dcmd
(a) Do I've to put DCMD commands under onplayercommandtext

(b) What do I've to change in this code, to convert it to dcmd?

Quote:
Код:
    if(strcmp(cmd, "/register", true) == 0)
	{
	    tmp = strtok(cmdtext, idx);
	    if(strlen(tmp) == 0) return SendClientMessage(playerid, ERROR, "Use: /register [PASSWORD]");
	    format(file,sizeof(file),"%s.dudb.sav", name);
	    if(!fexist(file))
		{
			dini_Create(file);
			dini_IntSet(file, "Password", udb_hash(tmp));
			dini_IntSet(file, "Money", 2500);
			dini_IntSet(file, "Score", 1);
			dini_IntSet(file, "Bank", 1000);
			dini_IntSet(file, "RobSkill", 1);
			dini_IntSet(file, "TerSkill", 1);
			dini_IntSet(file, "WantedLevel", 0);
			dini_IntSet(file, "Jail", 0);
			dini_IntSet(file, "RentalOwner", 0);
			dini_IntSet(file, "Drugs", 0);
			dini_IntSet(file, "C4", 0);
			dini_IntSet(file, "Skin", -1);
			SendClientMessage(playerid, GREY, "Thanks for registering!");
			SendClientMessage(playerid, GREY, "You may now login.");
			SendClientMessage(playerid, GREY, "To do so, type: /login [PASSWORD]");
			GameTextForPlayer(playerid, "~r~Registered!", 3000, 1);
		}
		else SendClientMessage(playerid, ERROR, "This account is already registered in our system. Use: /login [PASSWORD]");
		return true;
	}

2. How do I check if my script is laggy, like it's performance?

3. Is there any tips for optimizing script?


Re: Questions - thefatshizms - 26.07.2013

Quote:
Originally Posted by Uberanwar
Посмотреть сообщение
3. Is there any tips for optimizing script?
Don't use dcmd.


Re: Questions - Uberanwar - 26.07.2013

Quote:
Originally Posted by thefatshizms
Посмотреть сообщение
Don't use dcmd.
Uhh, I need to convert the strcmp commands to dcmd for some reasons


Re: Questions - Diablosrouge - 26.07.2013

Use zcmd instead.


Re: Questions - Uberanwar - 27.07.2013

Sorry, I prefer DCMD. I just want to convert them from strcmp to dcmd,


Re: Questions - thefatshizms - 27.07.2013

Quote:
Originally Posted by Uberanwar
Посмотреть сообщение
Sorry, I prefer DCMD. I just want to convert them from strcmp to dcmd,
You're asking for tips on optimization yet you wan't to use the worst command processors made.