not saying name :(
#1

hi im wondering why when i type /repairall that it only says had repaired all vehicles and not the admin name

pawn Код:
COMMAND:repairall(playerid, params[])
{
 new AdminName[24], string[256], Name[24];
    // Send the command to all admins so they can see it
    SendAdminText(playerid, "/repairall", params);

    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true)
    {
        // Check if the player's admin-level is at least 3
        if (APlayerData[playerid][PlayerLevel] >= 3)
        {
            // Loop through all vehicles
            for (new i; i < 2000; i++)

                RepairVehicle(i); // Fully repair the vehicle (damage value and bodywork)

   // Send all players a message to inform them that all vehicles have been repaired
            format(string, 256, "{ffff00}%s  Has Repaired All Vehicles", AdminName, Name);
                        SendClientMessageToAll(0xff00FF,string);

        }
        else
            return 0;
    }
    else
        return 0;

    // Let the server know that this was a valid command
    return 1;
}
Reply
#2

You havent defined what is AdminName u just created a variable and typed it. How will samp understand what to show??
Reply
#3

it is defined in an include that all work together
Reply
#4

You defined AdminName, but you didn't assign it to GetPlayerName.

Somwhere in your command you would add.
pawn Код:
GetPlayerName(playerid, AdminName, sizeof(AdminName));
Also on the line below.
pawn Код:
format(string, 256, "{ffff00}%s  Has Repaired All Vehicles", AdminName, Name);
the float below should not be there since you only put in one specifier.
pawn Код:
Name
So it should look like this.
pawn Код:
format(string, 256, "{ffff00}%s  Has Repaired All Vehicles", AdminName);
P.S
If I'm right
Код:
ffff00
Is not a correct hexadecimal color. It is case sensitive. So it would be
PHP код:
FFFF00 
Reply
#5

Quote:
Originally Posted by [LHT]Bally
Посмотреть сообщение
it is defined in an include that all work together
It isn't defined anywhere else you would've gotten an already defined error.
Reply
#6

well this is a command that works as it should.

pawn Код:
// Warn a player
COMMAND:warn(playerid, params[])
{
    new PlayerToWarn, Reason[128], ReasonMsg[128], Name[24], string[3256];

    // Send the command to all admins so they can see it
    SendAdminText(playerid, "/warn", params);

    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true)
    {
        // Check if the player's admin-level is at least 1
        if (APlayerData[playerid][PlayerLevel] >= 1)
        {
            if (sscanf(params, "us[128]", PlayerToWarn, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/warn <PlayerToWarn> <Reason>\"");
            else
                if (IsPlayerConnected(PlayerToWarn)) // If the player is a valid playerid (he's connected)
                {
                    // Increase the number of warnings
                    APlayerData[PlayerToWarn][Warnings]++;

                    // Get the name of the player who warned the player
                    GetPlayerName(playerid, Name, sizeof(Name));
                    // Send the warned player a message who warned him and why he's been warned
                    format(ReasonMsg, 128, "You have been warned by %s %s", AdminLevelName[APlayerData[playerid][PlayerLevel]], Name);
                    SendClientMessage(PlayerToWarn, 0xFF0000FF, ReasonMsg);
                    format(ReasonMsg, 128, "Reason: %s", Reason);
                    SendClientMessage(PlayerToWarn, 0xFF0000FF, ReasonMsg);
                    format(ReasonMsg, 128, "{ff0000}Warning %i/%i: %s", APlayerData[PlayerToWarn][Warnings], AutoKickWarnings, Reason);
                    SendClientMessage(PlayerToWarn, 0xFF0000FF, ReasonMsg);

                    // Get the name of the warned player
                    GetPlayerName(PlayerToWarn, Name, sizeof(Name));
                    // Let the admin know who has been warned and why
                    format(ReasonMsg, 3256, "You have warned %s (warnings: %i/%i)", Name, APlayerData[PlayerToWarn][Warnings], AutoKickWarnings);
                    SendClientMessage(playerid, 0x00FF00FF, ReasonMsg);
                    format(ReasonMsg, 3256, "Reason: %s", Reason);
                    SendClientMessage(playerid, 0xFF0000FF, ReasonMsg);
                    format(string, 3256, "{ffff00}Player %s Has Been warned by %s %s {ffff00}(Reason: %s)", Name, AdminLevelName[APlayerData[playerid][PlayerLevel]], Name, Reason);
                    SendClientMessageToAll(0xff00FF,string);
                    // Automatically kick the player if he got 3 warnings (if autokick is enabled)
                    if ((APlayerData[PlayerToWarn][Warnings] == AutoKickWarnings) && (AutoKickAfterWarn == 1))
                        Kick(PlayerToWarn);
                }
                else
                    SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
        }
        else
            return 0;
    }
    else
        return 0;

    // Let the server know that this was a valid command
    return 1;
}
Reply
#7

Quote:
Originally Posted by [LHT]Bally
Посмотреть сообщение
well this is a command that works as it should.

pawn Код:
// Warn a player
COMMAND:warn(playerid, params[])
{
    new PlayerToWarn, Reason[128], ReasonMsg[128], Name[24], string[3256];

    // Send the command to all admins so they can see it
    SendAdminText(playerid, "/warn", params);

    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true)
    {
        // Check if the player's admin-level is at least 1
        if (APlayerData[playerid][PlayerLevel] >= 1)
        {
            if (sscanf(params, "us[128]", PlayerToWarn, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/warn <PlayerToWarn> <Reason>\"");
            else
                if (IsPlayerConnected(PlayerToWarn)) // If the player is a valid playerid (he's connected)
                {
                    // Increase the number of warnings
                    APlayerData[PlayerToWarn][Warnings]++;

                    // Get the name of the player who warned the player
                    GetPlayerName(playerid, Name, sizeof(Name));
                    // Send the warned player a message who warned him and why he's been warned
                    format(ReasonMsg, 128, "You have been warned by %s %s", AdminLevelName[APlayerData[playerid][PlayerLevel]], Name);
                    SendClientMessage(PlayerToWarn, 0xFF0000FF, ReasonMsg);
                    format(ReasonMsg, 128, "Reason: %s", Reason);
                    SendClientMessage(PlayerToWarn, 0xFF0000FF, ReasonMsg);
                    format(ReasonMsg, 128, "{ff0000}Warning %i/%i: %s", APlayerData[PlayerToWarn][Warnings], AutoKickWarnings, Reason);
                    SendClientMessage(PlayerToWarn, 0xFF0000FF, ReasonMsg);

                    // Get the name of the warned player
                    GetPlayerName(PlayerToWarn, Name, sizeof(Name));
                    // Let the admin know who has been warned and why
                    format(ReasonMsg, 3256, "You have warned %s (warnings: %i/%i)", Name, APlayerData[PlayerToWarn][Warnings], AutoKickWarnings);
                    SendClientMessage(playerid, 0x00FF00FF, ReasonMsg);
                    format(ReasonMsg, 3256, "Reason: %s", Reason);
                    SendClientMessage(playerid, 0xFF0000FF, ReasonMsg);
                    format(string, 3256, "{ffff00}Player %s Has Been warned by %s %s {ffff00}(Reason: %s)", Name, AdminLevelName[APlayerData[playerid][PlayerLevel]], Name, Reason);
                    SendClientMessageToAll(0xff00FF,string);
                    // Automatically kick the player if he got 3 warnings (if autokick is enabled)
                    if ((APlayerData[PlayerToWarn][Warnings] == AutoKickWarnings) && (AutoKickAfterWarn == 1))
                        Kick(PlayerToWarn);
                }
                else
                    SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
        }
        else
            return 0;
    }
    else
        return 0;

    // Let the server know that this was a valid command
    return 1;
}
It works as it should, because it was scripted as it should..?
Reply
#8

ty for help walsh +rep for ya
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)