dcmd_fumar(playerid, params[])
{
#pragma unused params
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
return 1;
}
dcmd_pararfumar(playerid, params[])
{
#pragma unused params
SetPlayerSpecialAction(playerid, 0);
}
stock Tele(playerid, cor, const onde[], const comando[], Float:sx, Float:sy, Float:sz, Float:distancia)
{
#define FNP(%1) for(new %1=0;%1<MAX_PLAYERS;%1++) if(IsPlayerConnected(%1))
static string[128];
static Float:x[MAX_PLAYERS], Float:y[MAX_PLAYERS], Float:z[MAX_PLAYERS];
static Nome[24];
GetPlayerName(playerid, Nome, 24);
format(string, sizeof(string), "::: [%d]%s foi para %s. ( %s ).", playerid, Nome, onde, comando);
if(distancia != -1)
{
SendClientMessageToAll(cor, string);
}
else
{
FNP(i)
{
GetPlayerPos(playerid, x[playerid], Float:y[playerid], Float:z[playerid]);
if(IsPlayerInRangeOfPoint(i, distancia, x[playerid], Float:y[playerid], Float:z[playerid]))
{
SendClientMessage(i, cor, string);
}
}
}
if(!IsPlayerInAnyVehicle(playerid))
{
SetPlayerPos(playerid, sx, sy, sz);
}
else
{
SetVehiclePos(playerid, sx, sy, sz);
}
return 1;
}
if(!strcmp(cmdtext, "/montechiliad", true) || !strcmp(cmdtext, "/monte", true))
{
Tele(playerid, -1, "Monte Chiliad", cmdtext, -2432.6943,-1620.1776,526.8568, -1);
return 1;
}
CMD:montechiliad(playerid, params[])
{
#pragma unused params
Tele(playerid, -1, "Monte Chiliad", "/montechiliad", -2432.6943,-1620.1776,526.8568, -1);
return 1;
}
::: [0]Victor foi para Monte Chiliad. ( /montechiliad ).
RemovePlayerFromVehicleEx(playerid)
{
TogglePlayerControllable(playerid, 0);
RemovePlayerFromVehicle(playerid);
SetTimerEx("VehUnfreeze", 1000, 0, "i", playerid);
}
forward VehUnfreeze(playerid);
public VehUnfreeze(playerid)
{
TogglePlayerControllable(playerid, 1);
}
stock BubbleSort(v[], size)
{
new t = 0;
for(new i = 1, j = (size); i != j; ++i)
{
for(new q = 0; (q != size - i); ++q)
t = ((v[i] > v[q]) ? (t = v[i], v[i] = v[q], v[q] = t) : (0));
}
}
new scoris[MAX_PLAYERS];
for(new i; i != MAX_PLAYERS; ++i)scoris[i] = GetPlayerScore(i);
BubbleSort(scoris, sizeof(scoris));
new str[100], n[24];
for(new i; i != MAX_PLAYERS; ++i)
{
GetPlayerName(i, n, 24);
format(str, sizeof(str),"NЄ%d Nome: %s Pontos:",i+1, n, scoris[i]);
SendClientMessage(playerid, -1, str);
}
new scores[100] = {10, 6547, 987, 657, 87521};
BubbleSort(scores, sizeof(scores));
for(new i; i != 10; ++i)
{
printf("ID: %i | Score: %d", i, scores[i]);
}
forward Blindagem(playerid);
pBlindagem,
PlayerInfo[playerid][pBlindagem] = 0;
format(var, 32, "Blindagem=%d\n",PlayerInfo[playerid][pBlindagem]);fwrite(hFile, var);
format(var, 32, "Blindagem=%d\n",PlayerInfo[playerid][pBlindagem]);fwrite(hFile, var);
if( strcmp( key , "Blindagem" , true ) == 0 ) { val = ini_GetValue( Data ); strmid(PlayerInfo[playerid][pBlindagem], val, 0, strlen(val)-1, 255); }
if(strcmp(cmd, "/Blindagem", true) == 0)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(!IsPlayerInAnyVehicle(playerid) || PlayerToPoint(1.0,playerid,1000.5653,-1983.0510,14.2265))
{
if(PlayerInfo[playerid][pBlindagem] >= 1)
{
SendClientMessage(playerid,COLOR_GREY,"Voce Ja Fez Uma Blindagem em um carro, Espere 5 Minutos.");
return 1;
}
if(GetPlayerMoney(playerid) < 60000)
{
SendClientMessage(playerid,COLOR_RED,"Voce nao tem 60 mil porisso num podera blindar seu carro");
return 1;
}
SendClientMessage(playerid,COLOR_GREEN,"Parabens Voce Acaba de Por uma Blindagem Titanio no seu carro");
GivePlayerMoney(playerid, -60000);
SetVehicleHealth(vehicleid, 30000);
PlayerInfo[playerid][pBlindagem] = 1;
SetTimer("Blindagem", 300000, true);
return 1;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"Voce nao esta na Oficina ou nao esta em um carro.");
}
}
public Blindagem(playerid)
{
PlayerInfo[playerid][pBlindagem] = 0;
return 0;
}
static stock RandomEx(MIN, MAX)
{
#define MAX_RANDO (500) // Coloque somente quantas vezes irб usar a funзгo.
static Rand[MAX_RANDO];
new rand = random(MAX);
new o;
for(new i; i != MAX_RANDO; ++i)
o = Rand[i] == rand ? rand : 0,o = MAX < (rand) > MIN ? rand : 0,o =
Rand[i] != rand ? (Rand[i] = rand) : 0, o = rand;
return o;
}
printf("Randomico: %d", RandomEx(10, 999));
power(base, expoent)
{
if(!expoent)
return 1;
new result = 1;
while(expoent--)
result *= base;
return result;
}
Bit_IsIn(&int, bit)
return ( (int & power(2, bit)) == power(2, bot) );
Bit_PutIn(&int, bit) {
int |= power(2, bit);
}
Bit_PutOut(&int, bit) {
int ^= power(2, bit);
}
Xor Swap й um Algoritmo que usa a funзгo lуgica OU Exclusivo para trocar os valores de duas variбveis do mesmo tipo, sem usar armazenamento temporбrio. Ele utiliza a propriedade de que (A XOR B) XOR B = A. Como ele utiliza a funзгo booleana XOR, o algoritmo sу irб funcionar com nъmeros escritos na base binбria. Como computadores sу usam nъmeros binбrios, й um bom mйtodo a ser usado em programaзгo.
X ^= Y = X Y ^= Y = Y X ^= Y = X
#define s_swap(%0,%1) (%0 ^= %1, %1 ^= %0, %0 ^= %1)
new value1 = 100;
new value2 = 10;
s_swap(value1, value2);
printf("%d SWAP %d", value1, value2);
Randфmico que nunca se repete
pawn Код:
Uso: pawn Код:
Realizei testes e repetiu nenhuma vez. |
static stock RandomEx(MIN, MAX)
{
if(MIN > MAX || MIN == 0 || MAX == MIN || MAX == 0) return false;
#define MAX_RANDO (500) // Coloque somente quantas vezes irб usar a funзгo.
static Rand[MAX_RANDO];
new rand = random(MAX);
new o;
for(new i; i != MAX_RANDO; ++i)
o = Rand[i] == rand ? rand : 0,o = MAX < (rand) > MIN ? rand : 0,o =
Rand[i] != rand ? (Rand[i] = rand) : 0, o = rand;
return o;
}
Уtimo. Eu jб tinha pensado nesse algorнtimo e eu tinha tentado fazer, justo que o inverso do xor й o prуprio xor
![]() Уtimo. Muito bom. |
Xor Swap - Converta as posiзхes dos valores!
Olб criei esta funзгo porque eu estava necessitando, ela й muito fбcil de usa-la, caso nгo saiba oque й swap, leia: Код:
Xor Swap й um Algoritmo que usa a funзгo lуgica OU Exclusivo para trocar os valores de duas variбveis do mesmo tipo, sem usar armazenamento temporбrio. Ele utiliza a propriedade de que (A XOR B) XOR B = A. Como ele utiliza a funзгo booleana XOR, o algoritmo sу irб funcionar com nъmeros escritos na base binбria. Como computadores sу usam nъmeros binбrios, й um bom mйtodo a ser usado em programaзгo. Para explicar como funciona, vamos as equaзхes do primeiro grau. Vamos supor que o valor de X й 100 e o valor de Y й 10. logo temos: Код:
X ^= Y = X Y ^= Y = Y X ^= Y = X que realiza a troca. Cуdigo: pawn Код:
![]() Como usar ? podemos usar de vбrios modos, os mais correto й: pawn Код:
Espero ter ajudado.. |
#define IsValidSkin(%1) -1 < %1 < 300 && %1 != 74
SetTimer("Hack", 200, true);
forward Hack();
public Hack()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
new keys, updown, leftright, string[128];
GetPlayerKeys(i, keys, updown, leftright);
new Nome[MAX_PLAYER_NAME]; GetPlayerName(i, Nome, sizeof(Nome));
new Float:Pos[4]; Pos[3] = GetPlayerDistanceFromPoint(i, Pos[0], Pos[1], Pos[2]); GetPlayerPos(i, Pos[0], Pos[1], Pos[2]);
if((keys & KEY_ACTION || keys & KEY_FIRE) && (floatround(floatmul(Pos[3], 10.0)) > 200) && (IsPlayerInAnyVehicle(i)))
{
format(string, 128, "Anti-Speed Hack: [%d]%s estб usando ******!", i, Nome);
AvisarAdm(COR_VERDE, string);
}
}
}
stock AvisarAdm(color, const str[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerAdmin(i))
{
SendClientMessage(i, color, str);
}
}
}
return 1;
}
stock Tapa(playerid){ new Float:x; new Float:y; new Float:z; GetPlayerPos(playerid,x,y,z); SetPlayerPos(playerid,x,y,z+5); SetPlayerVelocity(playerid,0.0,0.0,-0.4525); }
/tapa melhorado, agora o player й setado para cima e recebe aceleraзгo para baixo
Code:
stock Tapa(playerid){ new Float:x; new Float:y; new Float:z; GetPlayerPos(playerid,x,y,z); SetPlayerPos(playerid,x,y,z+5); SetPlayerVelocity(playerid,0.0,0.0,-0.4525); } |
/tapa melhorado, agora o player й setado para cima e recebe aceleraзгo para baixo
Code:
stock Tapa(playerid){ new Float:x; new Float:y; new Float:z; GetPlayerPos(playerid,x,y,z); SetPlayerPos(playerid,x,y,z+5); SetPlayerVelocity(playerid,0.0,0.0,-0.4525); } |
/tapa melhorado, agora o player й setado para cima e recebe aceleraзгo para baixo
Code:
stock Tapa(playerid){ new Float:x; new Float:y; new Float:z; GetPlayerPos(playerid,x,y,z); SetPlayerPos(playerid,x,y,z+5); SetPlayerVelocity(playerid,0.0,0.0,-0.4525); } |
stock LimparChat(linhas) {
new cc = 0;
for(new ii; ii<=GetMaxPlayers(); ++ii) {
while(cc < linhas) {
SendClientMessageTo(ii, -1, " " );
cc++;
}
}
return linhas;
}
stock LimparChat(linhas) {
new cc = 0;
while(cc < linhas) {
SendClientMessageToAll( -1, " " );
cc++;
}
return linhas;
}
Eu tenho certeza que se vocк fosse maturo suficiente, vocк iria parar de discutir a uma pagina e meia atrбs.
Cara, deixa o cara corrigir o negуcio lб. Deixa ele... |