zcmd to strcmp
#1

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;
}
Reply
#2

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

Watch that and you will know how to make it
https://sampforum.blast.hk/showthread.php?tid=199796
Reply
#4

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

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

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

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

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!
Reply
#9

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)