/unban help
#1

Hy Guys i have made this command CODE:
Код:
if (strcmp(cmd, "/unban", true)==0)
	{
	    if((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >=1337)
	    {
	        tmp = strtok(cmdtext, idx);
	        if(!strlen(tmp))
			{
		        SendClientMessage(playerid, COLOR_ORANGE, "Koristite: {FFFFFF}/unban [Ime Korisnika]");
	            return 1;
		 	}
		 	GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
		 	GetPlayerName(playerid, sendername, sizeof(giveplayer));
		 	SendClientMessage(playerid, COLOR_WHITE, " ");
		 	format(string, 256, "___________________________________________", tmp);
		 	SendClientMessage(playerid,COLOR_WHITE,string,1);
		 	format(string, 256, "[Unban] - %s je uspjesno unbanan!", tmp);
		 	SendClientMessage(playerid,COLOR_YELLOW,string,1);
		 	SendClientMessage(playerid, COLOR_WHITE, "___________________________________________");
			format(string, 256, " |A| %s je uspjesno unbanao igraca %s", sendername, tmp);
			printf(string);
			format(string,sizeof(string),"%s.ini",tmp);
			fremove(string);
			SendRconCommand(string);
			SendRconCommand("reloadbans");
   			GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
			GetPlayerName(playerid, sendername, sizeof(sendername));
		}
		return 1;
	}
And this errors show to me CODE:
Код:
C:.../RLRP.pwn(792) : error 010: invalid function or declaration
C:.../RLRP.pwn(794) : error 010: invalid function or declaration
C:.../RLRP.pwn(797) : error 010: invalid function or declaration
C:.../RLRP.pwn(800) : error 010: invalid function or declaration
C:.../RLRP.pwn(819) : error 010: invalid function or declaration
What is problem?
Reply
#2

Most visible problems:

pawn Код:
SendClientMessage(playerid,COLOR_YELLOW,string,1);
The '1' means nothing, you need to remove that, along with the comma before it. SendClientMessage has three parameters, remove all occurances of the ', 1' in your code.

pawn Код:
format(string, 256, "___________________________________________", tmp);
Client messages can't ever exceed the size of 128, '256' is more than pointless, and double the limit. Your compiler will get the size of the string by default and you won't have to type a number in format, if you replace it with sizeof(string), like:

pawn Код:
format(string, sizeof(string), "___________________________________________");
Furthermore, you have no variable named 'tmp' being used in your format statement - the code makes no sense, you can just send a normal client message. If you're not formatting a string with other strings, there's really no need to use format().

pawn Код:
format(string,sizeof(string),"%s.ini",tmp);
            fremove(string);
Are you sure you're deleting the ban file? Most unorganized Godfather scripts store user accounts in the main folder that SA-MP accesses and are created as 'Name_Name.ini', so it looks a little more like you're deleting your user account, rather than the ban.
Reply
#3

Can u do it for me just fix errors and post as Pawno code
Reply
#4

You have all the information you need, you can do it yourself.

You've been very ungrateful, so don't expect any further help from me.
Reply
#5

pawn Код:
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(giveplayer));
            SendClientMessage(playerid, COLOR_WHITE, " ");
            format(string, 256, "___________________________________________", tmp);
            SendClientMessage(playerid,COLOR_WHITE,string,1);
            format(string, 256, "[Unban] - %s je uspjesno unbanan!", tmp);
            SendClientMessage(playerid,COLOR_YELLOW,string,1);
            SendClientMessage(playerid, COLOR_WHITE, "___________________________________________");
            format(string, 256, " |A| %s je uspjesno unbanao igraca %s", sendername, tmp);
            printf(string);
            format(string,sizeof(string),"%s.ini",tmp);
            fremove(string);
            SendRconCommand(string);
            SendRconCommand("reloadbans");
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 256, "___________________________________________", tmp);

Why do you format this string? and why does it have 256 lengh if SAMP chatbox can only hold 129 charaters? and whats the point of that tmp variable if you are not using it on that format?

SendClientMessage(playerid,COLOR_WHITE,string,1);

If that function only holds 3 parameters why do you add another one?

GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));

Why do you get again the players name if you are no longer using them again?


" Can u do it for me just fix errors and post as Pawno code "

Whats the point of us doing it for you if you wont know whats wrong nor learn something from it?

If you cant fix such a little ban command now and we fix it for you, we will get more threads from you, i suggest you to review the gamemodes section of this forums and download one since it doesnt seem you wanna learn something.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)