09.08.2014, 14:43
I Need help in the both cmds below i get the warning that u must be at bank to use /bank and at police sation to use /911 but i see all the cmds like it sends me the msg and it works.. even if i am not at the loc..
and /bank -
Help me plz Ty. i tryed alot but the same...
pawn Code:
// This command allows the player to fine himself if no cop is online
COMMAND:911(playerid, params[])
{
// Setup local variables
new bool:CopOnline = false, Msg[128], Name[24], Fine;
// Send the command to all admins so they can see it
SendAdminText(playerid, "/911", params);
if(!IsPlayerAtPolice(playerid)) SendClientMessage(playerid, 0xFF0000AA, "{FF0000}[ERROR]: {FFFFFF}You are not at the police station!");
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
if (APlayerData[playerid][PlayerClass] != ClassPolice) {
if (GetPlayerWantedLevel(playerid) >= 1) {
// Get the player's name
GetPlayerName(playerid, Name, sizeof(Name));
// Preset the message that needs to be sent to cops
format(Msg, 128, "{0000FF}[POLICE]{FFFFFF}Player {FF0000}%s{FFFFFF} as requested you to fine him.", Name);
// Check if there is at least one cop online
for (new i; i < MAX_PLAYERS; i++)
{
// Check if this player is connected
if (IsPlayerConnected(i))
{
// Check if this player is cops
if (APlayerData[i][PlayerClass] == ClassPolice)
{
// Set the flag to indicate that at least one cop is online
CopOnline = true;
// Send the cop a message to inform him who needs fine
SendClientMessage(i, 0xFFFFFFFF, Msg);
}
}
}
// Check if there is at least one cop online
if (CopOnline == true)
{
// Let the player know that atleast one cop is online who can fine him
SendClientMessage(playerid, 0xFFFFFFFF, "{0000FF}[POLICE]{FFFFFF}Cops are online, called them.");
}
else // No cop is online
{
// Calculate the fine
Fine = GetPlayerWantedLevel(playerid) * DefaultFinePerStar;
// Let the wanted player pay the fine
RewardPlayer(playerid, -Fine, 0);
// Remove wanted level
SetPlayerWantedLevel(playerid, 0);
// Let the player know that he has been auto-fined
format(Msg, sizeof(Msg), "{0000FF}[POLICE]{FFFFFF}You have been auto-fined for {00FF00}$%i", Fine);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{0000FF}[POLICE]{FFFFFF}You cannot use /911 if you're not wanted.");
}
else
return 0;
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}
pawn Code:
// Allows the player to setup a bank account, login to his bank account, or use his bank account after he logged in to his bank account
COMMAND:bank(playerid, params[])
{
// Setup local variables
new file[100], Name[24];
// Send the command to all admins so they can see it
SendAdminText(playerid, "/bank", params);
// Get the playername
if(!IsPlayerAtBank(playerid)) SendClientMessage(playerid, 0xFF0000AA, "{FF0000}[ERROR]: {FFFFFF}You are not at the bank!");
else return 0;
format(Name, sizeof(Name), APlayerData[playerid][PlayerName]);
// Construct the complete filename for this player's bank-account
format(file, sizeof(file), BankFile, Name);
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player doesn't have a bank account
if (!fexist(file))
{
// Ask for a password to setup his bank account
ShowPlayerDialog(playerid, DialogBankPasswordRegister, DIALOG_STYLE_INPUT, "Enter password", "Please enter a password to register your bank account:", TXT_DialogButtonSelect, TXT_DialogButtonCancel);
}
else // The player has a bank account
{
// If the player hasn't logged in to his bank account yet
if (APlayerData[playerid][BankLoggedIn] == false)
{
// Ask for the password to login to his bank account
ShowPlayerDialog(playerid, DialogBankPasswordLogin, DIALOG_STYLE_INPUT, "Enter password", "Please enter your password to login to your bank account:", TXT_DialogButtonSelect, TXT_DialogButtonCancel);
}
else // The player has logged in to his bank account already
{
// Show the main bank menu dialog
ShowBankMenu(playerid);
}
}
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}