09.09.2013, 21:30
Tenta agora
pawn Код:
COMMAND:darvip(playerid, params[])
{
// Setup local variables
new OtherPlayer, Name[24], AdminName[24], Msg[128], OldLevel, NewVIPLevel;
// Send the command to all admins so they can see it
SendAdminText(playerid, "/darvip", params);
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player's admin-level is at least 5
if (APlayerData[playerid][PlayerLevel] >= 6)
{
if (sscanf(params, "ud", OtherPlayer, NewVIPLevel)) SendClientMessage(playerid, 0xFF0000AA, "[USE] \"/darvip <ID> <Nivel VIP>\"");
else
{
// Check if that other player is online
if (IsPlayerConnected(OtherPlayer))
{
OldLevel = APlayerData[OtherPlayer][VIPLevel];
// Get the playername of the admin
GetPlayerName(playerid, AdminName, sizeof(AdminName));
// Also get the name of the player that has been promoted
GetPlayerName(OtherPlayer, Name, sizeof(Name));
// Store the level of the player
APlayerData[OtherPlayer][VIPLevel] = NewVIPLevel;
format(Msg, 128, "Voce ganhou %d por %s (%s)", NewVIPLevel, AdminName, AdminLevelName[APlayerData[playerid][PlayerLevel]]);
SendClientMessage(OtherPlayer, 0x00FF00FF, Msg);
format(Msg, 128, "Voce deu %d ao jogador %s", NewVIPLevel, Name);
SendClientMessage(playerid, 0x00FF00FF, Msg);
PlayerFile_Save(OtherPlayer);
if (OldLevel != NewVIPLevel)
{
// Check if the player has been promoted or demoted
format(Msg, 128, "[VIP] O jogador %s foi promovido a vip nivel %d pelo admin %s", Name, NewVIPLevel, AdminName, AdminLevelName[APlayerData[playerid][PlayerLevel]]);
SendClientMessageToAll(0x00FF00FF, Msg);
}
else
SendClientMessage(playerid, 0xFF0000FF, "O nнvel do jogador nгo foi alterado");
}
else
SendClientMessage(playerid, 0xFF0000FF, "O jogador nao esta online");
}
}
else
return 0;
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}