PDA

View Full Version : /unban help


Dusan01
16/11/2011, 02:35 PM
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?

Calgon
16/11/2011, 02:40 PM
Most visible problems:


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.

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:

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().

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.

Dusan01
16/11/2011, 03:59 PM
Can u do it for me just fix errors and post as Pawno code

Calgon
16/11/2011, 04:07 PM
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.

kirk
16/11/2011, 04:15 PM
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.