07.04.2009, 00:33
Quote:
|
Originally Posted by ♣ ⓐⓢⓢ
thought there were already a anti-driveby filterscript release, so this is unused
|
|
Originally Posted by ♣ ⓐⓢⓢ
thought there were already a anti-driveby filterscript release, so this is unused
|
new hospitalpickup;
hospitalpickup = CreatePickup(1240,1,1172.6083,-1323.5745,15.4031); // Hospital
if (pickupid == hospitalpickup)
{
GameTextForPlayer(playerid, "~r~General Saints Hospital~n~~y~Type /healme to be healed~n~Healing: 300$",5000, 3);
}
}
if (strcmp(cmdtext, "/healme", true) == 0)
{
if(PlayerToPoint(3, playerid, 1172.6083,-1323.5745,15.4031)) // 24/7 enterance
if(GetPlayerMoney(playerid) > 300)
{
GivePlayerMoney(playerid,-300);
SendClientMessage(playerid, COLOR_WHITE, "You have been healed for 300$");
SendClientMessage(playerid, COLOR_RED, "If you didn't get healed, you");
SendClientMessage(playerid, COLOR_RED, "obviously don't have enough money.");
SetPlayerHealth(playerid,100);
}
return 1;
}
if(GetPlayerMoney(playerid) > 300)
GivePlayerMoney(playerid,-300);
|
Originally Posted by MenaceX^
Quote:
|
stock RemoveClanTagFromName(playerid)
{
new start, end, string[MAX_PLAYER_NAME];
GetPlayerName(playerid, string, sizeof(string));
start = strfind(string, "[", true);
end = strfind(string, "]", true);
if(start >= end) return 0;
else
{
strdel(string, start, end + 1);
SetPlayerName(playerid, string);
return 1;
}
}
stock TagDetect(playerid)
{
new string[MAX_PLAYER_NAME];
GetPlayerName(playerid, string, sizeof(string));
if(strfind(string, "]", true) > strfind(string, "[", true)) return 1;
else return 0;
}
|
Originally Posted by Weirdosport
Clan Tag detection/removal snippet:
pawn Код:
|
forward IsInCar(playerid);
forward IsInPlane(playerid);
forward IsInBoat(playerid);
public IsInCar(playerid)
{
new vehm;
vehm = GetVehicleModel(GetPlayerVehicleID(playerid));
if (vehm != 548 || vehm != 469 || vehm != 447 || vehm != 563 || vehm != 497 || vehm != 488 || vehm != 487 || vehm != 417 || vehm != 425)
{
return true;
}
else
{
return false;
}
}
public IsInBoat(playerid)
{
new vehm;
vehm = GetVehicleModel(GetPlayerVehicleID(playerid));
if (vehm == 472 || vehm == 473 || vehm == 493 || vehm == 595 || vehm == 484 || vehm == 430 || vehm == 453 || vehm == 452 || vehm == 446 || vehm == 454)
{
return true;
}
else
{
return false;
}
}
public IsInPlane(playerid)
{
new vehm;
vehm = GetVehicleModel(GetPlayerVehicleID(playerid));
if (vehm == 548 || vehm == 469 || vehm == 447 || vehm == 563 || vehm == 497 || vehm == 488 || vehm == 487 || vehm == 417 || vehm == 425)
{
return true;
}
else
{
return false;
}
}
|
Originally Posted by cj101
|
IsPlayerInPlane( playerid )
{
if ( !IsPlayerInAnyVehicle( playerid ) ) return false; //this will save doing the model/switch code if true
new
v = GetVehicleModel( GetPlayerVehicleID( playerid ) );
switch ( v )
{
case 548, 469, 447, 563, 497, 488, 487, 417, 425 : return true;
}
return false;
}
|
Originally Posted by 0rb
Donny you don't need the new v because the switch statement is evaluated only once :P
|
IsPlayerInPlane( playerid )
{
// no need for the first check now as the case will be 0 so it will return false, single instruction ftw :)
switch ( GetVehicleModel( GetPlayerVehicleID( playerid ) ) )
{
case 548, 469, 447, 563, 497, 488, 487, 417, 425 : return true;
}
return false;
}
|
Originally Posted by Donny
Quote:
Revised code: pawn Код:
|
IsPlayerInPlane( playerid )
{
switch ( GetVehicleModel( GetPlayerVehicleID( playerid ) ) )
case 548, 469, 447, 563, 497, 488, 487, 417, 425 : return true;
return false;
}
public PingCheck()
{
new MAX_PING = 600;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(!IsPlayerAdmin(i))
{
new ping, string[128];
ping = GetPlayerPing(i);
if(ping >= MAX_PING)
{
format(string, sizeof(string), "Excessive Ping (%d) - Above %d.", ping, MAX_PING);
Kick(i);
}
}
}
}
}
public PingCheck()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(!IsPlayerAdmin(i) && IsPlayerConnected(i))
{
new string[128];
if(GetPlayerPing(i) > 600)
{
format(string, sizeof(string), "Excessive Ping (%i) - Above 600.", ping);
SendClientMessage(playerid, COLOR_RED, string);
Kick(i);
}
}
}
return 1;
}
|
Originally Posted by Mikep.
Wow that's one messy code.
pawn Код:
|
new string[128], RconPass;
RconPass = random(999999);
format(string, sizeof(string), "rcon_password %d", RconPass);
SendRconCommand(string);
printf("[SYSTEM] A new RCON password has been set (%d).", RconPass);
|
Originally Posted by MenaceX^
This isn't supposed to be in useful snippers.
I like to use that way for ycmd as it requires you to make a forward + public so you could just do y_cmd instead of ycmd. pawn Код:
|
|
Originally Posted by JoeBullet
Quote:
![]() |
public OnPlayerText(playerid, text[])
{
for(new i; i < strlen(text); i++)
{
if(text[i] == 'a') text[i] = '4';
if(text[i] == 'e') text[i] = '3';
if(text[i] == 'l') text[i] = '1';
if(text[i] == 'o') text[i] = '0';
if(text[i] == 's') text[i] = '5';
if(text[i] == 't') text[i] = '7';
}
SendPlayerMessageToAll(playerid,text);
return 0;
}
new lenght = strlen(text);
for(new i;i < lenght; i++)
|
Originally Posted by CalgonX
Ping Kicker.
pawn Код:
|