I dont get whats wrong? -
Goldino - 26.01.2013
Title says it all?
Код:
CMD:ban(playerid, params[])
{
if(pInfo[playerid][Adminlevel] < 2)return SendClientMessage(playerid, 0xFF0000FF, "You are not authorised to use this command");
new PID; //define the playerid we wanna ban
new reason[64]; //the reason, put into a string
new str[128]; //a new message string
new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
GetPlayerName(PID, Playername, sizeof(Playername));
if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
format(str, sizeof(str), "'%s' has been banned by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
SendClientMessageToAll(COLOR_RED, str); //send that message to all
Ban(PID); //Ban the playerid we've defined
}
else //if he has not got the permissions
{
SendClientMessage(playerid, COLOR_GREY, "You have to be level 5 to use that command!"); //return this message
}
return 1;
}CMD:ban(playerid, params[])
{
if(pInfo[playerid][Adminlevel] < 2)return SendClientMessage(playerid, 0xFF0000FF, "You are not authorised to use this command");
new PID; //define the playerid we wanna ban
new reason[64]; //the reason, put into a string
new str[128]; //a new message string
new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
GetPlayerName(PID, Playername, sizeof(Playername));
if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
format(str, sizeof(str), "'%s' has been banned by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
SendClientMessageToAll(COLOR_RED, str); //send that message to all
Ban(PID); //Ban the playerid we've defined
}
else //if he has not got the permissions
{
SendClientMessage(playerid, COLOR_GREY, "You have to be level 5 to use that command!"); //return this message
}
return 1;
}
Код:
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(696) : warning 209: function "cmd_ban" should return a value
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(697) : error 010: invalid function or declaration
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(701) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.
Please help!
thankss
Re: I dont get whats wrong? -
]Rafaellos[ - 26.01.2013
Your using cmd:ban twice maybe?
AW: I dont get whats wrong? -
Blackazur - 26.01.2013
You have two Times "CMD:ban", maybe that is the Problem.
Re: I dont get whats wrong? -
IgrexolonO - 26.01.2013
Код:
CMD:ban(playerid, params[])
{
if(pInfo[playerid][Adminlevel] < 2)
{
new PID; //define the playerid we wanna ban
new reason[64]; //the reason, put into a string
new str[128]; //a new message string
new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
GetPlayerName(playerid, Adminname, sizeof(Adminname));
GetPlayerName(PID, Playername, sizeof(Playername));
if(sscanf(params, "us[64]", PID, reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]");
if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
format(str, sizeof(str), "'%s' has been banned by administrator '%s'. Reason: %s ", Playername, Adminname, reason);
SendClientMessageToAll(COLOR_RED, str);
Ban(PID);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You have to be level 5 to use that command!");
}
return 1;
}
This command is so fucking messed up, that I've only repaired { }.
AW: I dont get whats wrong? -
xOFxK1LLER - 26.01.2013
pawn Код:
CMD:ban(playerid, params[])
{
if(pInfo[playerid][Adminlevel] < 2) return SendClientMessage(playerid, 0xFF0000FF, "You are not authorised to use this command");
new PID; //define the playerid we wanna ban
new reason[64]; //the reason, put into a string
new str[128]; //a new message string
new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!"); // if the ID is wrong or not connected, return a message! (PID used here)
GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
GetPlayerName(PID, Playername, sizeof(Playername));
format(str, sizeof(str), "'%s' has been banned by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
SendClientMessageToAll(COLOR_RED, str); //send that message to all
Ban(PID); //Ban the playerid we've defined
return 1;
}
That's how it works, you had a lot of shit in that code, also make sure that you don't use cmd:ban 2 times