Posts: 6,129
Threads: 36
Joined: Jan 2009
Here you go:
pawn Код:
if (strcmp("/test", cmdtext, true) == 0)
{
if(GetPlayerWantedLevel(playerid) >= 1)
return SendClientMessage(playerid, 0xDEEE20FF, "You can't have a wanted level to use this command.");
Pause(playerid);
SetPlayerPos(playerid, -1944.96, 515.19, 202.2;
GetPlayerName(playerid, playername, sizeof(playername));
format(string,sizeof(string),"%s is joining test", playername);
SendClientMessageToAll(0xDEEE20FF, string);
return 1;
}
A simple if statement checking if GetPlayerWantedLevel() for the playerid is over or equal to 1, then returning a message to block the rest of the code for that command from executing.
Posts: 32
Threads: 2
Joined: Oct 2007
Reputation:
0
@Calg00ne
Yes thank you m8, it really helped me.
Posts: 32
Threads: 2
Joined: Oct 2007
Reputation:
0
Sry about asking again but i forgot in the first post to ask:
How its possible to deny teleport also when a player is jailed?
Sry for busying
Posts: 6,129
Threads: 36
Joined: Jan 2009
You'll need to show us some code that you use to jail a player, an example of this could be a /jail command.
Posts: 32
Threads: 2
Joined: Oct 2007
Reputation:
0
01.08.2011, 08:24
(
Последний раз редактировалось misterlc; 01.08.2011 в 19:31.
)
Hello,
here is the working variable: it's an include
// This command teleports you to your selected house
COMMAND:gohome(playerid, params[])
{
// Setup local variables
new HouseList[1000];
// Send the command to all admins so they can see it
SendAdminText(playerid, "/gohome", params);
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player has a wanted level of less than 3
if (GetPlayerWantedLevel(playerid) < 3)
{
// Check if the player is not jailed
if (APlayerData[playerid][PlayerJailed] == 0)
{
// Check if the player is not inside a vehicle
if (GetPlayerVehicleID(playerid) == 0)
{
// Ask to which house the player wants to add his vehicle
for (new i; i < MAX_HOUSESPERPLAYER; i++)
{
// Check if this houseindex is occupied
if (APlayerData[playerid][Houses][i] != 0)
format(HouseList, 1000, "%s{00FF00}%s{FFFFFF}\n", HouseList, AHouseData[APlayerData[playerid][Houses][i]][HouseName]);
else
format(HouseList, 1000, "%s{FFFFFF}%s{FFFFFF}\n", HouseList, "Empty house-slot");
}
ShowPlayerDialog(playerid, DialogGoHome, DIALOG_STYLE_LIST, "Choose the house to go to:", HouseList, "Select", "Cancel");
}
else
SendClientMessage(playerid, 0xFF0000FF, "You need to be on-foot to port to your house");
}
else
SendClientMessage(playerid, 0xFF0000FF, "You cannot use /gohome when you're in jail");
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /gohome when you're wanted");
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}
I'm not able to put some updates on my server, when some own teleport commands i made still working if jailed.
My own teleports are on diff. filterscript. The example is above.
Thank You for your help
Posts: 32
Threads: 2
Joined: Oct 2007
Reputation:
0
Hi and sorry here is the /jail command from the include
COMMAND:jail(playerid, params[])
{
new PlayerToJail, JailTime, Reason[128], Msg[128], Name[24], AdminName[24];
// Send the command to all admins so they can see it
SendAdminText(playerid, "/jail", 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, "uis[128]", PlayerToJail, JailTime, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/jail <PlayerToJail> <JailTime> <Reason>\"");
else
if (IsPlayerConnected(PlayerToJail)) // If the player is a valid playerid (he's connected)
{
// Jail the player
Police_JailPlayer(PlayerToJail, JailTime);
// Get the name of the player who jailed the player
GetPlayerName(playerid, AdminName, sizeof(AdminName));
// Get the name of the player who's being sent to jail
GetPlayerName(PlayerToJail, Name, sizeof(Name));
// Send the jailed player a message who jailed him, why he's been jailed and how long
format(Msg, 128, "You have been jailed by %s %s for %i seconds", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, JailTime);
SendClientMessage(PlayerToJail, 0xFF0000FF, Msg);
format(Msg, 128, "Reason: %s", Reason);
SendClientMessage(PlayerToJail, 0xFF0000FF, Msg);
format(Msg, 128, "{00FF00}You have jailed {FFFF00}%s{00FF00} for {FFFF00}%i{00FF00} seconds", Name, JailTime);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
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;
}