zcmd to strcmp -
Boyka96 - 28.10.2014
Hii I need to convert this commands from zcmd to strcmp .. but the problem is .. I never used zcmd so I dont know how it works XD .. can someone pls help me out with this .. thanks in advance
Код:
CMD:ban(playerid, params[])
{
new reason[64], Reason[64], Mins, Hours, Days, Query[256], String[128];
if(PInfo[playerid][AdminLevel] == 0) return 0;
if(sscanf(params, "uiiiS(No reason)[64]", Otherid, Mins, Hours, Days, reason)) return SendClientMessage(playerid, RED_COLOR, "Syntax: /ban <playerid> <minutes> <hours> <days> <reason[Optional]>");
if(!IsPlayerConnected(Otherid)) return SendClientMessage(playerid, RED_COLOR, "[Error]: Player not connected");
if(strlen(reason) > 64) return SendClientMessage(playerid, RED_COLOR, "The ban reason cannot exceed 64 characters!");
new CTS = ((Mins*60) + (Hours*3600) + (Days*86400));
mysql_real_escape_string(reason, Reason);
format(Query, sizeof(Query), "INSERT INTO `tBans` (Username, Admin, IP, Reason, Seconds, Banned) VALUES ('%s', '%s', '%s', '%s', '%d', 1)", PlayerName(Otherid), PlayerName(playerid), GetIP(Otherid), Reason, (CTS+gettime()));
mysql_query(Query);
format(String, sizeof(String), "Administrator{FF8000} %s (%i){FFFFFF} has banned{FF8000} %s (%i){FFFFFF} for{FF8000} %s", PlayerName(playerid), playerid, PlayerName(Otherid), Otherid, reason);
SendClientMessageToAll(COLOR_WHITE, String);
Kick(Otherid);
return 1;
}
Re: zcmd to strcmp -
Pottus - 28.10.2014
My god not another one these posts I mentioned this before doing this is like slamming on your brakes on the highway then throwing your car in reverse.
Re: zcmd to strcmp -
Glossy42O - 28.10.2014
Watch that and you will know how to make it
https://sampforum.blast.hk/showthread.php?tid=199796
Re: zcmd to strcmp -
Boyka96 - 28.10.2014
Pottus .. instead of making useless comments and being a noob .. you could have just ignored this .. I dont think there is a single human that was born with scripting skills .. even you, I'm pretty sure one day you didnt even know what does script means

(thats if you know now) ..
and thanks stuun
Re: zcmd to strcmp -
Sithis - 28.10.2014
Do not go back to strcmp. Zcmd is much better and faster. Instead of converting it to strcmp, check out how zcmd works and work from there.
Re: zcmd to strcmp -
Boyka96 - 28.10.2014
sithis .. but I have all my commands in strcmp .. well I'll work on switching to zcmd but for now it's more useful to change it to strcmp
Re: zcmd to strcmp -
Sithis - 28.10.2014
Really, don't. It will be better to ONLY use zcmd. Strcmp is slower and when you add more commands, it will become more slow.
Re: zcmd to strcmp -
Vince - 28.10.2014
Quote:
Originally Posted by Boyka96
Pottus .. instead of making useless comments and being a noob .. you could have just ignored this .. I dont think there is a single human that was born with scripting skills .. even you, I'm pretty sure one day you didnt even know what does script means  (thats if you know now) ..
and thanks stuun 
|
You make zero sense. The only noob I see in this thread is you.
Quote:
Originally Posted by Boyka96
sithis .. but I have all my commands in strcmp .. well I'll work on switching to zcmd but for now it's more useful to change it to strcmp
|
Congrats, double work!
Re: zcmd to strcmp -
Glossy42O - 28.10.2014
No one is noob.
He is just new at scripting no need to say "Noob" to be honest who says noob he is noob himself.
So y'all don't make useless comments if you wanna help then post a comment don't post "The only noob i see in this thread is you"
This is useless comment instead of saying that you could help him.
Anyways i found some awesome tutorials watch all of them and you will know.
https://sampforum.blast.hk/showthread.php?tid=446744
https://sampforum.blast.hk/showthread.php?tid=250454
https://sampwiki.blast.hk/wiki/Strcmp
https://sampwiki.blast.hk/wiki/Creating_Commands
Re: zcmd to strcmp -
TakeiT - 28.10.2014
Quote:
Originally Posted by Boyka96
Pottus .. instead of making useless comments and being a noob .. you could have just ignored this .. I dont think there is a single human that was born with scripting skills .. even you, I'm pretty sure one day you didnt even know what does script means  (thats if you know now) ..
and thanks stuun 
|
It has nothing to do with the fact that you are unaware on how to do this, that's what this forum is for. What he is implying is that you're working backwards. It's like uninstalling windows 7 for windows 98. Using strcmp is not a smart move for coding, it's actually longer to make and while it does work, it uses a fuckton of memory (Which does add up the more players/commands you add) as well is increasing your .amx size. Now, don't get me wrong, while you are coding a gamemode, I almost guarentee that you will need strcmp to compare strings. However, if you use ZCMD, you will spend less time typing commands, the commands look a lot cleaner, and they process faster. Using string compare for commands isn't recommended by any experienced scripter, i'm not saying that i'm some sort of god, take my word, but ask anyone here that codes, that has been here atleast 6 months, they'll all say the same.
There are guides, and I think a tool to convert your strcmp commands into zcmd