SA-MP Forums Archive
Simple zcmd help? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Simple zcmd help? (/showthread.php?tid=485042)



Simple zcmd help? - canadianclass - 02.01.2014

I am fairly new to scripting, so I heard that zcmd is pretty simple and better than strcmp, so I got zcmd and sscanf2 and I tried to make a simple money command, and it failed.



Код:
// Give Money - Finished - 10:09 02/01/2014

CMD:givemoney(playerid, params[])
{
	new targetid, ammount, sendername[MAX_PLAYER_NAME], recievername[MAX_PLAYER_NAME], string[128];
	if(sscanf(params,"ui", targetid, ammount)) return SendClientMessage(playerid, COLOR_WHITE, "/givemoney [ID] [Ammount]");
	if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not a staff member");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player is not connected");
	GetPlayerName(playerid, sendername, sizeof(sendername));
	GetPlayerName(targetid, recievername, sizeof(recievername));
	format(string, sizeof(string), "You have recieved %s dollars from staff member %s", ammount, sendername);
	SendClientMessage(targetid, COLOR_GREEN, string);
	format(string, sizeof(string), "You have added %s dollars to %d 's account", ammount, targetid);
	SendClientMessage(playerid, COLOR_GOLD, string);
	GivePlayerMoney(targetid, ammount);
	return 1;
}
After I found that out, I made a simple one and IT failed too!

Код:
CMD:test(playerid, params[])
if (!PlayerIsAdmin(playerid)) return SendClientMessage(playerid, 0xFFFF00AA, "No admin for you.");
if PlayerIsAdmin(playerid) SendClientMessage(playerid, 0XFFFF00AA, "You're a admin mate!");
return 1;
Also, where am I supposed to place the cmd? I just put it at the bottom of the script because I heard that you cant put it in one of the call backs...? Help would be appreciated. Thank you!


Re: Simple zcmd help? - canadianclass - 02.01.2014

Figured it out.....



Remember guys! DO NOT forgot to add your plugins in your server config!