commands not works :(
#2

Try using this one. This one should work with your script. I can't see an error there, Try pasting an error code so I can see it.

Code:
	if(strcmp(cmd, "/fine", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /fine [playerid/PartOfName] [money] <reason>");
				return 1;
			}
			new playa;
			new money;
			playa = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			money = strval(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 2)
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			        {
				        GetPlayerName(playa, giveplayer, sizeof(giveplayer));

						new length = strlen(cmdtext);
						while ((idx < length) && (cmdtext[idx] <= ' '))
						{
							idx++;
						}
						new offset = idx;
						new result[128];
						while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
						{
							result[idx - offset] = cmdtext[idx];
							idx++;
						}
						result[idx - offset] = EOS;
						if(!strlen(result))
						{
							SafeGivePlayerMoney(playa, - money);
							format(string, 256, "[ADMIN]: %s (%d) has been fined $%d by %s [No Reason Given].", giveplayer, playa,money, sendername);
							SendAdminMessage(COLOR_LIGHTRED,string);
		                    format(string, sizeof(string), "You have Fined $%d to %s (%d), No Reason Given.",money, giveplayer, playa);
		                    SendClientMessage(playerid,COLOR_LIGHTRED ,string);
		                    format(string, sizeof(string), "%s (%d), Has Been Fined $%d by %s, No Reason Given", giveplayer, playa, money, sendername);
		                    SendClientMessageToAll(COLOR_NICERED, string);
							format(string, sizeof(string), "~r~~h~-Admin Fined- ~n~~n~~n~~n~~n~~n~~n~~y~No reason Given ~n~Money: ~g~$%d", money);
							GameTextForPlayer(playa, string, 7000, 3);
							new y, m, d;
							new h,mi,s;
							getdate(y,m,d);
							gettime(h,mi,s);
							format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has been fined by %s | Reason: None | Money: $%d |.",d,m,y,h,mi,s,giveplayer,sendername, money);
							PayLog(string);
							AdminLog(string);
							format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] Fined by %s - Reason: None - Money: $%d .",d,m,y,h,mi,s,sendername,money);
							AddPunishment(playa, string);
							return 1;
						}
						SafeGivePlayerMoney(playa, - money);
						format(string, 256, "[ADMIN]: %s (%d) has been fined $%d by %s [Reason: %s].", giveplayer, playa,money, sendername, (result));
						SendAdminMessage(COLOR_LIGHTRED,string);
	                    format(string, sizeof(string), "You have Fined $%d to %s (%d) for: %s .",money, giveplayer, playa, (result));
	                    SendClientMessage(playerid,COLOR_LIGHTRED ,string);
	                    format(string, sizeof(string), "%s (%d), Has Been Fined $%d by %s for: %s", giveplayer, playa, money, sendername, (result));
	                    SendClientMessageToAll(COLOR_NICERED, string);
						format(string, sizeof(string), "~r~~h~-Admin Fined- ~n~~n~~n~~n~~n~~n~~n~~y~Reason: ~w~%s ~n~Money: ~g~$%d",(result), money);
						GameTextForPlayer(playa, string, 7000, 3);
						new y, m, d;
						new h,mi,s;
						getdate(y,m,d);
						gettime(h,mi,s);
						format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has been fined by %s | Reason: %s | Money: $%d |.",d,m,y,h,mi,s,giveplayer,sendername,(result),money);
						PayLog(string);
						AdminLog(string);
						format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] Fined by %s - Reason: %s - Money: $%d.",d,m,y,h,mi,s,sendername,(result),money);
						AddPunishment(playa, string);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
			}
		}
		return 1;
	}
Reply


Messages In This Thread
sscanf and zcmd (akill command) [REP ++] - by SamiHam - 12.07.2012, 14:47
Re: commands not works :( - by UnknownGamer - 12.07.2012, 15:49
Re: commands not works :( - by SamiHam - 12.07.2012, 16:00
Re: commands not works :( - by SamiHam - 13.07.2012, 06:43
Re: commands not works :( - by Kaperstone - 13.07.2012, 07:41
Re: commands not works :( - by SamiHam - 13.07.2012, 08:25
Re: commands not works :( - by Pro_Scriptor - 13.07.2012, 09:00
Re: commands not works :( - by clarencecuzz - 13.07.2012, 09:55
Re: commands not works :( - by SamiHam - 13.07.2012, 09:58
Re: commands not works :( - by Devilxz97 - 13.07.2012, 11:21
Re: commands not works :( - by Devilxz97 - 13.07.2012, 11:59
Re: commands not works :( - by SamiHam - 13.07.2012, 12:05
Re: commands not works :( - by Devilxz97 - 13.07.2012, 12:16
Re: commands not works :( - by Devilxz97 - 13.07.2012, 12:39
Re: commands not works :( - by SamiHam - 13.07.2012, 12:52
Re: commands not works :( - by Devilxz97 - 13.07.2012, 12:58
Re: commands not works :( - by SamiHam - 13.07.2012, 13:01
Re: commands not works :( - by Devilxz97 - 13.07.2012, 13:12
Re: commands not works :( - by Devilxz97 - 13.07.2012, 13:58
Re: commands not works :( - by Andi_Evandy - 13.07.2012, 14:06

Forum Jump:


Users browsing this thread: 1 Guest(s)