26.07.2013, 22:39
(
Последний раз редактировалось Uberanwar; 26.07.2013 в 22:49.
Причина: adding another question
)
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?
2. How do I check if my script is laggy, like it's performance?
3. Is there any tips for optimizing script?
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?