Command check
#1

Hello all,

I have there a /admins command and a /duty command so i want when the admin types /duty it show his name then in admins list but when he didnt typed /duty it does not show it in admins.

Duty command
Quote:

COMMAND:duty(playerid, params[])
{
new Msg[128], AdminName[24];
// 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)
{
// Get the name of the player who warned the player
GetPlayerName(playerid, AdminName, sizeof(AdminName));
// Send a message to everyone.
format(Msg, 128, "{FFFF00}Admin {04B404} %s {ffff00} Gцrev Basinda", AdminName, playerid);
SendClientMessageToAll(0xFFFFFFFF, Msg);
}
}
return 1;
}

Admins
Quote:

// This command lists all online admins
COMMAND:admins(playerid, ,cmdtext, params[])
{
// Setup local variables
new AdminList[500], Name[24];

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

// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Scan through all players
for (new i; i < MAX_PLAYERS; i++)
{
// Check if this player is connected
if (IsPlayerConnected(i))
{
// Get the name of the player
GetPlayerName(i, Name, sizeof(Name));

if(!strcmp(cmdtext, "/duty")) Here i added it but many errors i get
{
// Check if this player is an RCON admin
if (IsPlayerAdmin(i))
{
// Add all admin players to the list
format(AdminList, 500, "%s%s: %s (id: %i), Admin-leveli: %i (RCON admin)\n", AdminList, AdminLevelName[APlayerData[i][PlayerLevel]], Name, i, APlayerData[i][PlayerLevel]); // Add the name of the admin-player to the list
// Re-start the for loop (skipping the remaining code for this iteration)
continue;
}

//Check if that player is an admin (using the PlayerLevel)
if (APlayerData[i][PlayerLevel] > 0)
{
// Add all admin players to the list
format(AdminList, 500, "%s%s: %s (id: %i), Admin-leveli: %i\n", AdminList, AdminLevelName[APlayerData[i][PlayerLevel]], Name, i, APlayerData[i][PlayerLevel]); // Add the name of the admin-player to the list
}
}
}
}

// Check if there were admin-names added to the list
if (strlen(AdminList) > 0)
ShowPlayerDialog(playerid, DialogNoResponse, DIALOG_STYLE_LIST, "Cevrimci Adminler:", AdminList, "OK", "Iptal");
else
SendClientMessage(playerid, 0xFF0000FF, "Hicbir Admin Yok"); // No admins are online
}
else
return 0;

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

i added this in the admins command but i get many errors

if(!strcmp(cmdtext, "/duty")
Reply
#2

Quote:

c(2714) : error 035: argument type mismatch (argument 1)

now i get this error.

Quote:

if(!strcmp(cmdtext, "/duty"))
{

Reply
#3

You should really learn the basics of the syntaxes you're using before trying to use them in other ways...

Код:
if(!strcmp(cmdtext, "/duty", true)) 
{
Reply
#4

Quote:
Originally Posted by Prokill911
Посмотреть сообщение
You should really learn the basics of the syntaxes you're using before trying to use them in other ways...

Код:
if(!strcmp(cmdtext, "/duty", true)) 
{
It doesn't matter if you pass that true or not. (false is the default argument)

I am guessing that the error is probably due to a missing ';' or misplaced { } () [].
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)