What is this ?!
#1

[IMG][/IMG]
See the chat above.....
where is the rest of the name ??
Here is the code
PHP код:
CMD:ban(playeridparams[])
{
    new 
targetid;
    if(
PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playeridCOLOR_RED"You can't use this command");
    if(
targetid == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_RED"This player is not connected");
    if(
sscanf(params,"u"targetid)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /ban [id]");
    {
    new 
name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
    new 
admin[MAX_PLAYER_NAME], string1[24+MAX_PLAYER_NAME];
    
GetPlayerName(playeridadminsizeof(admin));
    
GetPlayerName(targetidnamesizeof(name));
    
format(stringsizeof(string), "%s has been banned by an admin %s"nameadmin);
    
SendClientMessageToAll(COLOR_REDstring);
    
PlayerInfo[targetid][pBan] = 1;
    
SetTimerEx("KickDelay"2000false"i"playerid);
    }
    return 
true;

Reply
#2

post image
Reply
#3

change string size

pawn Код:
CMD:ban(playerid, params[])
{
    new targetid;
    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED, "You can't use this command");
    if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
    if(sscanf(params,"u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /ban [id]");
    {
    new name[MAX_PLAYER_NAME], string[32];
    new admin[MAX_PLAYER_NAME];
    GetPlayerName(playerid, admin, sizeof(admin));
    GetPlayerName(targetid, name, sizeof(name));
    format(string, sizeof(string), "%s has been banned by an admin %s", name, admin);
    SendClientMessageToAll(COLOR_RED, string);
    PlayerInfo[targetid][pBan] = 1;
    SetTimerEx("KickDelay", 2000, false, "i", playerid);
    }
    return true;
}
Reply
#4

All the name disapeared
Please Help !!
Reply
#5

Nvm, didn't read the OP good enough.
Reply
#6

you assigned few cells to the variable!

pawn Код:
CMD:ban(playerid, params[])
{
    new targetid;
    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED, "You can't use this command");
    if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
    if(sscanf(params,"u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /ban [id]");
    {
    new name[MAX_PLAYER_NAME], string[78];
    new admin[MAX_PLAYER_NAME];
    GetPlayerName(playerid, admin, sizeof(admin));
    GetPlayerName(targetid, name, sizeof(name));
    format(string, sizeof(string), "%s has been banned by an admin %s", name, admin);
    SendClientMessageToAll(COLOR_RED, string);
    PlayerInfo[targetid][pBan] = 1;
    SetTimerEx("KickDelay", 2000, false, "i", playerid);
    }
    return true;
}
Quote:
Originally Posted by Facerafter
Посмотреть сообщение
Can you show us OnPlayerConnect?
really? -_-
Reply
#7

Why you add another name string??
pawn Код:
new name[MAX_PLAYER_NAME], string[24];
new admin[MAX_PLAYER_NAME], string1[24];
Reply
#8

Try making the string array size bigger.

Here:
pawn Код:
CMD:ban(playerid, params[])
{
    new targetid;
    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED, "You can't use this command");
    if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
    if(sscanf(params,"u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /ban [id]");
    {
    new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME + MAX_PLAYER_NAME ];
    new admin[MAX_PLAYER_NAME], string1[24+MAX_PLAYER_NAME];
    GetPlayerName(playerid, admin, sizeof(admin));
    GetPlayerName(targetid, name, sizeof(name));
    format(string, sizeof(string), "%s has been banned by an admin %s", name, admin);
    SendClientMessageToAll(COLOR_RED, string);
    PlayerInfo[targetid][pBan] = 1;
    SetTimerEx("KickDelay", 2000, false, "i", playerid);
    }
    return true;
}
Reply
#9

string cells aren't enough,
let it be +70 at least.
Reply
#10

pawn Код:
new string[128];
Done.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)