#define GetPlayerId() ((playerid))
Kick(GetPlayerId());
stock GivePlayerRandomWeapons(playerid)
{
new Randomico = random(4);
if(Randomico == 1)
{
GivePlayerWeapon(playerid,24,350);
GivePlayerWeapon(playerid,27,230);
GivePlayerWeapon(playerid,31,530);
GivePlayerWeapon(playerid,9,1);
}
if(Randomico == 2)
{
GivePlayerWeapon(playerid,24,350);
GivePlayerWeapon(playerid,30,530);
GivePlayerWeapon(playerid,25,200);
GivePlayerWeapon(playerid,8,1);
}
if(Randomico == 3)
{
GivePlayerWeapon(playerid,24,350);
GivePlayerWeapon(playerid,27,230);
GivePlayerWeapon(playerid,31,530);
GivePlayerWeapon(playerid,18,10);
}
if(Randomico == 4)
{
GivePlayerWeapon(playerid,24,350);
GivePlayerWeapon(playerid,25,200);
GivePlayerWeapon(playerid,29,530);
GivePlayerWeapon(playerid,4,1);
}
return true;
}
stock IsVehicleInWater(vehicleid)
{
new Float:Float[4];
GetVehiclePos(vehicleid,Float[0],Float[1],Float[2]);
Float[3] = Float[2]*0.3048;
if(Float[3] < 0) {
return true;
}
return false;
}
#include <a_samp>
new PlayerMorreu[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
if(PlayerMorreu[playerid] == true)
{
PlayerMorreu[playerid] = false;
TogglePlayerControllable(playerid, 0);
SetPlayerPos(playerid, GetPVarFloat(playerid, "PosMortoX"), GetPVarFloat(playerid, "PosMortoY"), GetPVarFloat(playerid, "PosMortoZ"));
SetPlayerInterior(playerid, GetPVarInt(playerid, "InteriorMorto"));
SetPlayerVirtualWorld(playerid, GetPVarInt(playerid, "VirtualWorldMorto"));
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
SendClientMessage(playerid, 0xFFFFFFAA, "estas a morrer, espere uma abulancia chegar para lhe salvar.");
return 0x1;
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerMorreu[playerid] = true;
new Float:PosMortoX, Float:PosMortoY, Float:PosMortoZ;
GetPlayerPos(playerid, PosMortoX, PosMortoY, PosMortoZ);
SetPVarFloat(playerid, "PosMortoX", PosMortoX);
SetPVarFloat(playerid, "PosMortoY", PosMortoY);
SetPVarFloat(playerid, "PosMortoZ", PosMortoZ);
SetPVarInt(playerid, "InteriorMorto", GetPlayerInterior(playerid));
SetPVarInt(playerid, "VirtualWorldMorto", GetPlayerVirtualWorld(playerid));
return 1;
}
new bool:Controllable[MAX_PLAYERS];
#define TogglePlayerControllableEx(%0,%1); TogglePlayerControllable(%0,%1); Controllable[%0] = %1;
#define GetPlayerControllableEx(%0) Controllable[%0]
#define Relize_Loop(%15) ((for(new %1=%15,%2;%1< FA/2!=%2;++%1)?(%1):(0))
Realize_Loop(i)
{
ResetPlayerWeapons(i);
}
#define RealizarLoop(%1, %2) for(new %1 = 0; %1 < %2; ++%1);
RealizarLoop(i, 100);
{
ResetPlayerWeapons(i);
}
stock GetWeaponModel(weaponid)
{
if(weaponid == 0 || weaponid == 1) return 331;
else if(weaponid > 1 && weaponid < 9) return weaponid+331;
else if(weaponid == 9) return 341;
else if(weaponid > 9 && weaponid < 16) return weaponid+311;
else if(weaponid == 16 || weaponid == 17 || weaponid == 18) return weaponid+326;
else if(weaponid > 21 && weaponid < 30 || weaponid > 32 && weaponid < 46) return weaponid+324;
else if(weaponid == 30 || weaponid == 31) return weaponid+325;
else if(weaponid == 32) return 372;
else if(weaponid == 46) return 371;
return false;
}
stock GetPlayerWeaponName(playerid)
{
static str[21];
switch(GetPlayerWeapon(playerid))
{
case 0: str = "Unarmed";
case 1: str = "Brass Knuckles";
case 2: str = "Golf Club";
case 3: str = "Nite Stick";
case 4: str = "Knife";
case 5: str = "Baseball Bat";
case 6: str = "Shovel";
case 7: str = "Pool Cue";
case 8: str = "Katana";
case 9: str = "Chainsaw";
case 10: str = "Purple Dildo";
case 11: str = "Small White Vibrator";
case 12: str = "Large White Vibrator";
case 13: str = "Silver Vibrator";
case 14: str = "Flowers";
case 15: str = "Cane";
case 16: str = "Grenade";
case 17: str = "Tear Gas";
case 18: str = "Molotov Cocktail";
case 22: str = "9mm";
case 23: str = "Silenced 9mm";
case 24: str = "Desert Eagle";
case 25: str = "Shotgun";
case 26: str = "Sawn-off Shotgun";
case 27: str = "Combat Shotgun";
case 28: str = "Micro SMG";
case 29: str = "MP5";
case 30: str = "AK-47";
case 31: str = "M4";
case 32: str = "Tec9";
case 33: str = "Country Rifle";
case 34: str = "Sniper Rifle";
case 35: str = "Rocket Launcher";
case 36: str = "HS Rocket Launcher";
case 37: str = "Flamethrower";
case 38: str = "Minigun";
case 39: str = "Satchel Charge";
case 40: str = "Detonator";
case 41: str = "Spraycan";
case 42: str = "Fire Extinguisher";
case 43: str = "Camera";
case 44: str = "Nightvision Goggles";
case 45: str = "Thermal Goggles";
case 46: str = "Parachute";
}
return str;
}
stock IsVehicleInWater(vehicleid)
{
static Float:Pos[3];
GetVehiclePos(vehicleid,Pos[0],Pos[1],Pos[2]);
return Pos[2] < -1 ? true : false;
}
//@Nota: Alterei do Strong
public OnFilterScriptInit()
{
new Tick = GetTickCount();
for(new i; i < 999999; i++)
{
IsVehicleInWater1(0);
}
printf("[1] %d ms",GetTickCount() - Tick);
Tick = GetTickCount();
for(new i; i < 999999; i++)
{
IsVehicleInWater2(0);
}
printf("[2] %d ms",GetTickCount() - Tick);
}
stock IsVehicleInWater1(vehicleid)
{
new Float:Float[4];
GetVehiclePos(vehicleid,Float[0],Float[1],Float[2]);
Float[3] = Float[2]*0.3048;
if(Float[3] < 0) {
return true;
}
return false;
}
stock IsVehicleInWater2(vehicleid)
{
static Float:Pos[3];
GetVehiclePos(vehicleid,Pos[0],Pos[1],Pos[2]);
return Pos[2] < -1 ? true : false;
}
/*
#Resultado:
[02:38:58] [1] 667 ms
[02:38:59] [2] 375 ms
*/
#define Loop(%0,%1,%2,%3,%4) for(new %0 = %1; %0 %2 %3; %0%4)
//for(new i = 5; i > 0; i--)
Loop(i,5,>,0,--)
{
printf("[Valor] %d",i);
}
stock Pula_Pula(playerid)
{
static g[3]; GetVehiclePos(GetVehicleModel(playerid),g[0],g[1],g[2]);
SetVehiclePos(GetVehicleModel(playerid),g[0],g[1],g[2] + 10 ); // Aonde estб o 10 tu troca pela altura.
return 1;
}
stock Pula_Pula( playerid )
{
static k[ 3 ]; GetPlayerPos( playerid, k[ 0 ], k[ 1 ], k[ 2 ] );
SetPlayerPos( playerid, k[ 0 ], k[ 1 ], k[ 2 ] + 10 ); // Onde estб o 10 vocк troca pela altura.
return true;
}
public ClearChatbox(playerid, lines)
{
if (IsPlayerConnected(playerid))
{
for(new i=0; i<lines; i++)
{
SendClientMessage(playerid, COLOR_GREY, " ");
}
}
return 1;
}
Pegou este codigo do God Father ... Olha ele aqui:
PHP Code:
|
Um loop terб que criar variбveis e ainda terб que acrescentar +1 em cada mensagem enviada, realmente acham que й mais rбpido?
pawn Code:
Abraзos _____ Shadow, MAX_PLAYER_NAME й muito ъtil, isto deixa o cуdigo muito mais genйrico para funcionar em caso de os desenvolvedores aumentaram o tamanho do limite do nick .. Para deixar 100 linhas para mudar 0xF para 100, enfim Abraзos |
stock IsValidVehicle(playerid, vehid)// By: [iPs]Garfield~
{
if(!IsPlayerInAnyVehicle(playerid)) return false;
static ModelosValidos[]=
{
562,565,559,561,560,575,534,567,536,411,579,602,496,518,527,589,597,419,533,526,474,545,517,410,600,
436,580,439,549,491,445,604,507,585,587,466,492,546,551,516,467,426,547,405,409,550,566,540,421,
529,431,438,437,420,525,552,416,433,427,490,528,407,544,470,598,596,597,599,601,428,499,609,524,578,486,406,573,
455,588,403,514,423,414,443,515,456,422,482,530,418,572,413,440,543,583,478,554,402,542,603,475,568,504,457,483,508,429,541,415,480,434,
506,451,555,477,400,404,489,479,442,458,558
};
for(new i; i < sizeof(ModelosValidos); ++i)
{
if(GetVehicleModel(GetVehicleID(playerid)) == ModelosValidos[i])
{
return true;
}
}
return false;
}
stock IsValidVehicle(playerid)
{
if(!IsPlayerInAnyVehicle(playerid)) return false;
new modelid = GetVehicleModel(GetVehicleID(playerid));
switch(modelid) {
case 581, 523, 462, 521, 463, 522, 461, 448, 468, 586, 509,
481, 510, 472, 473, 493, 595, 484, 430, 453,
452, 446, 454, 445, 602, 416, 485, 568, 429, 433, 499, 424, 536, 496,
504, 422, 609, 498, 401, 575, 518,
402, 541, 482, 431, 438, 457, 527, 483, 524, 415, 542, 589, 437, 532,
480, 596, 599, 597, 598, 578, 486,
507, 562, 585, 427, 419, 587, 490, 528, 533, 544, 407, 565, 455, 530,
526, 466, 604, 492, 474, 588, 434,
502, 503, 494, 579, 545, 411, 546, 559, 508, 571, 400, 403, 517, 410,
551, 500, 418, 572, 423, 414, 516,
582, 467, 443, 470, 404, 514, 603, 600, 413, 426, 436, 547, 489, 441,
594, 564, 515, 479, 534, 432, 505,
442, 440, 475, 543, 605, 495, 567, 428, 405, 535, 458, 580, 439, 561,
409, 560, 506, 601, 574, 566, 549,
420, 459, 576, 525, 531, 408, 583, 451, 558, 552, 540, 491, 412, 478,
421, 529, 456, 554, 477, 548, 425,
417, 487, 497, 563, 501, 465, 447, 469, 488, 406, 573, 444, 556, 557,
592, 577, 511, 512, 593, 520, 553,
464, 476, 519, 460, 513, 539, 471, 435, 450, 591, 606, 607, 610, 584,
608, 611, 590, 449:
{
return true;
}
}
return false;
}
#undef MAX_PLAYERS
#define MAX_PLAYERS __oPl()
stock __oPl()
{
for( new i; i < 500; i++ )
{
if(!IsPlayerConnected(i)) return i;
}
}
new
VeiculoNomes[212][] =
{
"Landstalker",
"Bravura",
"Buffalo",
"Linerunner",
"Pereniel",
"Sentinel",
"Dumper",
"Firetruck",
"Trashmaster",
"Stretch",
"Manana",
"Infernus",
"Voodoo",
"Pony",
"Mule",
"Cheetah",
"Ambulance",
"Leviathan",
"Moonbeam",
"Esperanto",
"Taxi",
"Washington",
"Bobcat",
"Mr-Whoopee",
"BF-Injection",
"Hunter",
"Premier",
"Enforcer",
"Securicar",
"Banshee",
"Predator",
"Bus",
"Rhino",
"Barracks",
"Hotknife",
"Trailer",
"Previon",
"Coach",
"Cabbie",
"Stallion",
"Rumpo",
"RC-Bandit",
"Romero",
"Packer",
"Monster",
"Admiral",
"Squalo",
"Seasparrow",
"Pizzaboy",
"Tram",
"Trailer",
"Turismo",
"Speeder",
"Reefer",
"Tropic",
"Flatbed",
"Yankee",
"Caddy",
"Solair",
"Berkley's-RC-Van",
"Skimmer",
"PCJ-600",
"Faggio",
"Freeway",
"RC Baron",
"RC Raider",
"Glendale",
"Oceanic",
"Sanchez",
"Sparrow",
"Patriot",
"Quad",
"Coastguard",
"Dinghy",
"Hermes",
"Sabre",
"Rustler",
"ZR3-50",
"Walton",
"Regina",
"Comet",
"BMX",
"Burrito",
"Camper",
"Marquis",
"Baggage",
"Dozer",
"Maverick",
"News Chopper",
"Rancher",
"FBI Rancher",
"Virgo",
"Greenwood",
"Jetmax",
"Hotring",
"Sandking",
"Blista-Compact",
"Police-Maverick",
"Boxville",
"Benson",
"Mesa",
"RC-Goblin",
"Hotring-Racer",
"Hotring-Racer",
"Bloodring-Banger",
"Rancher",
"Super GT",
"Elegant",
"Journey",
"Bike",
"Mountain Bike",
"Beagle",
"Cropdust",
"Stunt",
"Tanker",
"RoadTrain",
"Nebula",
"Majestic",
"Buccaneer",
"Shamal",
"Hydra",
"FCR-900",
"NRG-500",
"HPV1000",
"Cement-Truck",
"Tow-Truck",
"Fortune",
"Cadrona",
"FBI-Truck",
"Willard",
"Forklift",
"Tractor",
"Combine",
"Feltzer",
"Remington",
"Slamvan",
"Blade",
"Freight",
"Streak",
"Vortex",
"Vincent",
"Bullet",
"Clover",
"Sadler",
"Firetruck",
"Hustler",
"Intruder",
"Primo",
"Cargobob",
"Tampa",
"Sunrise",
"Merit",
"Utility",
"Nevada",
"Yosemite",
"Windsor",
"Monster-A",
"Monster-B",
"Uranus",
"Jester",
"Sultan",
"Stratum",
"Elegy",
"Raindance",
"RC-Tiger",
"Flash",
"Tahoma",
"Savanna",
"Bandito",
"Freight",
"Trailer",
"Kart",
"Mower",
"Duneride",
"Sweeper",
"Broadway",
"Tornado",
"AT-400",
"DFT-30",
"Huntley",
"Stafford",
"BF-400",
"Newsvan",
"Tug",
"Trailer",
"Emperor",
"Wayfarer",
"Euros",
"Hotdog",
"Club",
"Trailer-B",
"Trailer-C",
"Andromada",
"Dodo",
"RC-CaLm",
"Launch",
"Police Car [LSPD]",
"Police Car [SFPD]",
"Police Car [LVPD]",
"Police Ranger",
"Picador",
"S.W.A.T",
"Alpha",
"Phoenix",
"Glendale",
"Sadler",
"Luggage Trailer",
"Luggage Trailer",
"Stair Trailer",
"Boxville",
"Farm Plow",
"Utility Trailer"
};
stock
CriarVeiculo( playerid, modelid )
{
new veiculo,Float:X,Float:Y,Float:Z,Float:X2,Float:Y2,Float:Z2,Float:Angulo;
if ( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER )
{
veiculo = GetPlayerVehicleID( playerid );
GetVehiclePos( veiculo, X, Y, Z );
GetVehicleZAngle( veiculo, Angulo );
GetVehicleVelocity(veiculo,X2,Y2,Z2);
DestroyVehicle( veiculo );
}
else
{
GetPlayerPos( playerid, X, Y, Z );
GetPlayerFacingAngle( playerid, Angulo );
}
vehicle = AddStaticVehicle( modelid, X, Y, ( Z + 1 ), Angulo,-1,-1);
LinkVehicleToInterior( veiculo, GetPlayerInterior( playerid ) );
SetVehicleVirtualWorld( veiculo, GetPlayerVirtualWorld( playerid ) );
PutPlayerInVehicle( playerid, veiculo, 0 );
return true;
}
IsNumeric(const stringf[])
{
for (new g = 0, kho = strlen(stringf); g < kho; g++)
{
if (stringf[g] > '9' || stringf[g] < '0') return 0;
}
return true;
}
GetVehicleModelIDFromName(Nome[])
{
for(new i = 0; i < 211; i++)
{
if ( strfind(VeiculoNomes[i], Nome, true) != -1 )
return i + 400;
}
return -true;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
if(strcmp("/veiculo", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, 1007, DIALOG_STYLE_INPUT, "Nome do Carro","Por favor Digite o nome do veiculo que vocк deseja criar.","Ok","Cancelar");
return true;
}
return false;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1007)
{
new
id;
if(!IsNumeric(inputtext)) id = GetVehicleModelIDFromName(inputtext); else ida = strval(inputtext);
if(id < 400 || id > 603) return SendClientMessage(playerid ,-1,"Modelo/Nome Invalido");
CriarVeiculo(playerid, id);
}
return true;
}
new IsFlooding[MAX_PLAYERS];
public OnPlayerText(playerid,text[])
{
if(gettime() < IsFlooding[playerid])
SendClientMessage(playerid,-1,"(erro) Sem flood.");
else
{
IsFlooding[playerid] = gettime()+3;
return true;
}
return false;
}
//======================================[ sDetector ]======================================
public sDetector(Float:radi, playerid, string[], color1, color2, color3)
{
if(IsPlayerConnected(playerid))
{
new Float:Pos[3];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerInRangeOfPoint(i, radi, Pos[0], Pos[1], Pos[2]))
{
SendClientMessage(i, color1, string);
}
if(IsPlayerInRangeOfPoint(i, radi*2, Pos[0], Pos[1], Pos[2]) && !IsPlayerInRangeOfPoint(i, radi, Pos[0], Pos[1], Pos[2]))
{
SendClientMessage(i, color2, string);
}
if(IsPlayerInRangeOfPoint(i, radi*3, Pos[0], Pos[1], Pos[2]) && !IsPlayerInRangeOfPoint(i, radi*2, Pos[0], Pos[1], Pos[2]))
{
SendClientMessage(i, color3, string);
}
}
}
return 1;
}
//======================================[ sDetector ]======================================
stock GetVehiclesConnecteds()
{
new
strtr[213], lol;
for(new i; i < MAX_VEHICLES; ++i)
{
if(GetVehicleModel(i))
{
strtr[GetVehicleModel(i)-400]++;
lol++;
}
}
return lol;
}
printf("Tem %d veiculos no servidor.",GetVehiclesConnecteds());