/freeze -
NathNathii - 20.02.2013
Hello.
When i use /freeze at someone, and when the freeze time is gone they will get bugged.
So anyone knows the problem..
Re: /freeze -
denNorske - 20.02.2013
Make a command yourself (this is not request code help).
Anyways, a hint could be to use "TogglePlayerControlable([playerid here], 0)" --> to freeze.
Example of a freeze / unfreeze command (ONLY EXAMPLE)
pawn Код:
CMD:freeze(playerid, params[])
{
new string[180], reason[60], suspect;
if(AccInfo[playerid][aLevel] < 1)
return SendClientMessage(playerid, grey, " - Only Level 1+ can perform this command - ");
if(sscanf(params, "k<player_name>S(No Reason Defined)[60]", suspect, reason))
return SendClientMessage(playerid, grey, " - Usage: /FREEZE [Player] [reason] - Will make the selected player stand still - ");
if(GetPVarInt(suspect, "frozen") == 1)
return SendClientMessage(playerid, grey, " - Selected Player is already frozen - ");
if(AccInfo[suspect][aLevel] == 5 && AccInfo[playerid][aLevel] < 5)
return SendClientMessage(playerid, red, "Uhm.. You can't freeze Owners!");
TogglePlayerControllable(playerid, false);
format(string,sizeof(string), "%s %s has frozen %s || Reason: %s", Rank(playerid), PlayerName(playerid), PlayerName(suspect), reason);
SendClientMessageToAll(blue, string);
SetPVarInt(suspect, "frozen", 1);
return 1;
}
CMD:unfreeze(playerid, params[])
{
new string[180], reason[60], suspect;
if(AccInfo[playerid][aLevel] < 1)
return SendClientMessage(playerid, grey, " - Only Level 1+ can perform this command - ");
if(sscanf(params, "k<player_name>S(No Reason Defined)[60]", suspect, reason))
return SendClientMessage(playerid, grey, " - Usage: /UNFREEZE [Player] [reason] - Will make the frozen player able to move again - ");
if(GetPVarInt(suspect, "frozen") == 0)
return SendClientMessage(playerid, grey, " - Selected Player is not frozen- ");
if(AccInfo[suspect][aLevel] == 5 && AccInfo[playerid][aLevel] < 5)
return SendClientMessage(playerid, red, "Uhm.. You can't unfreeze Owners!");
TogglePlayerControllable(playerid, false);
format(string,sizeof(string), "%s %s has unfrozen %s || Reason: %s", Rank(playerid), PlayerName(playerid), PlayerName(suspect), reason);
SendClientMessageToAll(blue, string);
SetPVarInt(suspect, "frozen", 0);
return 1;
}
This wont work if you copy paste, so you need to look at what i have done and then learn by that.
Re: /freeze -
NathNathii - 20.02.2013
Did ask if anyone know the problem..
Re: /freeze -
Da_Noob - 20.02.2013
Ohye, I know the problem! I just looked into my magic ball and saw your code + errors!
No. Post your code and the errors you're getting before we can help.
Re: /freeze -
NathNathii - 20.02.2013
Dont have any errors its only that when i freeze someone in-game they will get bugged when the freeze time is over, they cant jump, walk normal or enter a vehicle.
Command:
Код:
// Freeze a player (he cannot move anymore)
COMMAND:freeze(playerid, params[])
{
// Setup local variables
new Msg[128], Name[24], AdminName[24], Reason[128], OtherPlayer, Duration;
// Send the command to all admins so they can see it
SendAdminText(playerid, "/freeze", 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]", OtherPlayer, Duration, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/freeze <OtherPlayer> <Duration> <Reason>\"");
else
{
// Check if the otherplayer is online
if (IsPlayerConnected(OtherPlayer))
{
// Get the player-names
GetPlayerName(playerid, AdminName, sizeof(AdminName));
GetPlayerName(OtherPlayer, Name, sizeof(Name));
// Store the duration for the freeze, freeze him and start the frozentimer
APlayerData[OtherPlayer][PlayerFrozen] = Duration;
TogglePlayerControllable(OtherPlayer, 0);
SetTimerEx("Player_FreezeTimer", 1000, true, "i", OtherPlayer);
// Let the other player know that he has been muted
format(Msg, 128, "{FF0000}You have been frozen by {FFFF00}%s {FF0000}for {FFFF00}%s", AdminName, Reason);
SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
// Let the admin know who he has muted
format(Msg, 128, "{00FF00}You have frozen {FFFF00}%s", Name);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
// Save the player-stats
PlayerFile_Save(OtherPlayer);
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't online");
}
}
else
return 0;
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}