31.10.2011, 17:31
(
Последний раз редактировалось whiXґ; 02.11.2011 в 21:26.
)
pawn Код:
#include <a_samp>
pawn Код:
forward SetPlayerPrisao(killerid);
forward SetPlayerPrisao(killerid); Forward usada na callback(Public) SetPlayerPrisao(killerid);
pawn Код:
new bool:Prisao[MAX_PLAYERS];
new String[128];
new bool:Prisao[MAX_PLAYERS]; Tйcnical Boleana(bool) para verificar se o player esta preso ou nгo.
new String[128]; Variavel usada para definimos o tamanho de caracters em um texto.
pawn Код:
public OnPlayerDeath(playerid,killerid)
{
if(GetPlayerState(killerid) == PLAYER_STATE_DRIVER) {
new nome[24];
GetPlayerName(killerid,pname,sizeof(pname));
format(String, sizeof(String), "{FF0000}%s Foi preso [motivo: Matou com o veiculo ] [Tempo: 1 Minuto ]",nome);
SendClientMessageToAll(-1, String);
Prisao[killerid] = true;
GivePlayerMoney(killerid, -3500);
SetPlayerPos(killerid, 197.6661, 173.8179, 1003.0233);
SetPlayerInterior(killerid, 3);
SetTimerEx("SetPlayerPrisao", 60000, 0, "i", killerid);
}
return 1;
}
if(GetPlayerState(killerid) == PLAYER_STATE_DRIVER) Se o player matar com o veiculo, acontecera as linhas abaixo.
new nome[24]; Numero de caracters do nome do player.
GetPlayerName(killerid,pname,sizeof(pname)); Pegara o nome do player.
format(String, sizeof(String), "{FF0000}%s Foi preso [motivo: Matou com o veiculo ] [Tempo: 1 Minuto ]",nome); Ira formata a menssagem, Nome = Exibira o nome do player
SendClientMessageToAll(-1, String); Mandara a menssagem a todos os players, Setara a cor da menssgem, Definir o numero de caracters da mensagem.
Prisao[killerid] = true; Setara a prisao do player para true ou 1(Um), ou seja o player sera preso.
GivePlayerMoney(killerid, -3500); O player perdera -3500 de dinheiro.
SetPlayerPos(killerid, 197.6661, 173.8179, 1003.0233); O player sera setado para a Posiзгo ''197.6661, 173.8179, 1003.0233''
SetPlayerInterior(killerid, 3); Sera setado para o interior ''3''
SetTimerEx("SetPlayerPrisao", 60000, 0, "i", killerid); Setara o tempo que o player ficara na prisao '60000' ou seja 60 Segundos = 1 Minuto
pawn Код:
public SetPlayerPrisao(killerid)
{
new giveplayer[MAX_PLAYER_NAME];
GetPlayerName(killerid, giveplayer, sizeof(giveplayer));
SetPlayerInterior(killerid,0);
SpawnPlayer(killerid);
Prisao[killerid] = false;
GameTextForPlayer(killerid, "~w~~h~voce esta ~r~~h~livre!", 1000,1);
return 1;
}
public SetPlayerPrisao(killerid) Public usada para quando se passar 1 minuto na prisao o player ser souto.
new giveplayer[MAX_PLAYER_NAME]; Criaremos uma variavel para verificar numero de caracters do nome do player.
GetPlayerName(killerid, giveplayer, sizeof(giveplayer)); Verificara o nome do player
SetPlayerInterior(killerid,0); Setara o player para o interior '0' ou seja nenhum.
SpawnPlayer(killerid); Ira dar spawn no player.
Prisao[killerid] = false; Setara a prisao do player para false ou 0(zero)
GameTextForPlayer(killerid, "]] Voce esta livre ]]", 1000,1); Mandara um Game Text para o player dizendo que ele esta livre.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp("/kkk", cmdtext, true)) {
if(Prisao[playerid] == true)
return SendClientMessage(playerid, -1, "Vocк nгo pode digitar nenhum comando enquanto estiver preso!");
SendClientMessage(playerid, -1, "Kakakakakaka...");
return 1;
}
return 0;
}
f(Prisao[playerid] == true)
return SendClientMessage(playerid, -1, "Vocк nгo pode digitar nenhum comando enquanto estiver preso!"); ira verificar se o player esta preso, se caso ele estiver mandara a seguinte mensagem "Vocк nгo pode digitar nenhum comando enquanto estiver preso!" se nгo estiver o comando funcionara perfeitamente.