stock ConvertTimeToString(weeks = 0, days = 0, hours = 0, minutes = 0, seconds = 0)
{
while(seconds >= 60) minutes++, seconds -= 60;
while(minutes >= 60) hours++, minutes -= 60;
while(hours >= 24) days++, hours -= 24;
while(days >= 7) weeks++, days -= 7;
new string[70], fstr[20];
if(weeks) { format(fstr, sizeof(fstr), (weeks == 1) ? ("%d week") : ("%d weeks"), weeks); if(days || hours || minutes || seconds) strins(fstr, ", ", strlen(fstr)); strins(string, fstr, 0); }
if(days) { format(fstr, sizeof(fstr), (days == 1) ? ("%d day") : ("%d days"), days); if(hours || minutes || seconds) strins(fstr, ", ", strlen(fstr)); strins(string, fstr, strlen(string)); }
if(hours) { format(fstr, sizeof(fstr), (hours == 1) ? ("%d hour") : ("%d hours"), hours); if(minutes || seconds) strins(fstr, ", ", strlen(fstr)); strins(string, fstr, strlen(string)); }
if(minutes) { format(fstr, sizeof(fstr), (minutes == 1) ? ("%d minute") : ("%d minutes"), minutes); if(seconds) strins(fstr, ", ", strlen(fstr)); strins(string, fstr, strlen(string)); }
if(seconds) { format(fstr, sizeof(fstr), (seconds == 1) ? ("%d second") : ("%d seconds"), seconds), strins(string, fstr, strlen(string)); }
return string;
}
printf("%s", ConvertTimeToString(.days = 5, .hours = 49, .minutes = 17, .seconds = 14));
//Outcome: 1 week, 1 hour, 17 minutes, 14 seconds
printf("%s", ConvertTimeToString(.days = 3, .hours = 3, .minutes = 18));
//Outcome: 3 days, 3 hours, 18 minutes
new string[100];
format(string, sizeof(string), "You last logged in: %s ago", ConvertTimeToString(.seconds = (gettime() - LastLoggedIn[playerid])));
SendClientMessage(playerid, -1, string);
LastLoggedIn[playerid] = gettime();
It could be helpful, I guess.
Код:
isBulletWeapon(weaponid) { switch(weaponid) { case 16..18, 22..39, 41..43: return 1; } return 0; } |
new
string[24];
strtrunc("This is a test string.", 10, string);
print(string);
This is a ...
strtrunc(const source[], chars, dest[], maxlength=sizeof(dest))
{
if(strlen(source) > chars)
{
if(ispacked(source))
{
strmid(dest, source, 0, chars, maxlength);
strcat(dest, "...", maxlength);
}
else
{
format(dest, maxlength, "%.*s...", chars, source);
}
}
else
{
if(ispacked(source))
{
strpack(dest, source, maxlength);
}
else
{
strcat(((dest[0] = 0), dest), source, maxlength);
}
}
return 1;
}
if(strlen(banReason) > 24)
{
format(string, sizeof(string), "%s\t%.24s...\t%s", username, banReason, date);
}
else
{
format(string, sizeof(string), "%s\t%s\t%s", username, banReason, date);
}
new
truncatedReason[24];
strtrunc(banReason, 24, truncatedReason);
format(string, sizeof(string), "%s\t%s\t%s", username, truncatedReason, date);
input = "fuck you"; strcensor(input); // output = f*** you input = "fuck you"; strcensor(input, 0); // output = **** you input = "fuck you"; strcensor(input, 1, 1); // output = f**k you input = "fuck you bitch"; strcensor(input); // output = f*** you b****
strcensor(input[], allowed_beginning_chars = 1, allowed_end_chars = 0) { static const badwords[][] = { "4r5e", "5h1t", "5hit", "a55", "anal", "anus", "ar5e", "arrse", "arse", "ass", "ass-fucker", "asses", "assfucker", "assfukka", "asshole", "assholes", "asswhole", "a_s_s", "b!tch", "b00bs", "b17ch", "b1tch", "ballbag", "balls", "ballsack", "bastard", "beastial", "beastiality", "bellend", "bestial", "bestiality", "bi+ch", "biatch", "bitch", "bitcher", "bitchers", "bitches", "bitchin", "bitching", "bloody", "blow job", "blowjob", "blowjobs", "boiolas", "bollock", "bollok", "boner", "boob", "boobs", "booobs", "boooobs", "booooobs", "booooooobs", "breasts", "buceta", "bugger", "bum", "bunny fucker", "butt", "butthole", "buttmuch", "buttplug", "c0ck", "c0cksucker", "carpet muncher", "cawk", "chink", "cipa", "cl1t", "clit", "clitoris", "clits", "cnut", "cock", "cock-sucker", "cockface", "cockhead", "cockmunch", "cockmuncher", "cocks", "cocksuck", "cocksucked", "cocksucker", "cocksucking", "cocksucks", "cocksuka", "cocksukka", "cok", "cokmuncher", "coksucka", "coon", "cox", "crap", "cum", "cummer", "cumming", "cums", "cumshot", "cunilingus", "cunillingus", "cunnilingus", "cunt", "cuntlick", "cuntlicker", "cuntlicking", "cunts", "cyalis", "cyberfuc", "cyberfuck", "cyberfucked", "cyberfucker", "cyberfuckers", "cyberfucking", "d1ck", "damn", "dick", "dickhead", "dildo", "dildos", "dink", "dinks", "dirsa", "dlck", "dog-fucker", "doggin", "dogging", "donkeyribber", "doosh", "duche", "dyke", "ejaculate", "ejaculated", "ejaculates", "ejaculating", "ejaculatings", "ejaculation", "ejakulate", "f u c k", "f u c k e r", "f4nny", "fag", "fagging", "faggitt", "faggot", "faggs", "fagot", "fagots", "fags", "fanny", "fannyflaps", "fannyfucker", "fanyy", "fatass", "fcuk", "fcuker", "fcuking", "feck", "fecker", "felching", "fellate", "fellatio", "fingerfuck", "fingerfucked", "fingerfucker", "fingerfuckers", "fingerfucking", "fingerfucks", "fistfuck", "fistfucked", "fistfucker", "fistfuckers", "fistfucking", "fistfuckings", "fistfucks", "flange", "fook", "fooker", "fuck", "fucka", "fucked", "fucker", "fuckers", "fuckhead", "fuckheads", "fuckin", "fucking", "fuckings", "fuckingshitmotherfucker", "fuckme", "fucks", "fuckwhit", "fuckwit", "fudge packer", "fudgepacker", "fuk", "fuker", "fukker", "fukkin", "fuks", "fukwhit", "fukwit", "fux", "fux0r", "f_u_c_k", "gangbang", "gangbanged", "gangbangs", "gaylord", "gaysex", "goatse", "God", "god-dam", "god-damned", "goddamn", "goddamned", "hardcoresex", "hell", "heshe", "hoar", "hoare", "hoer", "homo", "hore", "horniest", "horny", "hotsex", "jack-off", "jackoff", "jap", "jerk-off", "jism", "jiz", "jizm", "jizz", "kawk", "knob", "knobead", "knobed", "knobend", "knobhead", "knobjocky", "knobjokey", "kock", "kondum", "kondums", "kum", "kummer", "kumming", "kums", "kunilingus", "l3i+ch", "l3itch", "labia", "lust", "lusting", "m0f0", "m0fo", "m45terbate", "ma5terb8", "ma5terbate", "masochist", "master-bate", "masterb8", "masterbat*", "masterbat3", "masterbate", "masterbation", "masterbations", "masturbate", "mo-fo", "mof0", "mofo", "mothafuck", "mothafucka", "mothafuckas", "mothafuckaz", "mothafucked", "mothafucker", "mothafuckers", "mothafuckin", "mothafucking", "mothafuckings", "mothafucks", "mother fucker", "motherfuck", "motherfucked", "motherfucker", "motherfuckers", "motherfuckin", "motherfucking", "motherfuckings", "motherfuckka", "motherfucks", "muff", "mutha", "muthafecker", "muthafuckker", "muther", "mutherfucker", "n1gga", "n1gger", "nazi", "nigg3r", "nigg4h", "nigga", "niggah", "niggas", "niggaz", "nigger", "niggers", "nob", "nob jokey", "nobhead", "nobjocky", "nobjokey", "numbnuts", "nutsack", "orgasim", "orgasims", "orgasm", "orgasms", "p0rn", "pawn", "pecker", "penis", "penisfucker", "phonesex", "phuck", "phuk", "phuked", "phuking", "phukked", "phukking", "phuks", "phuq", "pigfucker", "pimpis", "piss", "pissed", "pisser", "pissers", "pisses", "pissflaps", "pissin", "pissing", "pissoff", "poop", "porn", "porno", "pornography", "pornos", "prick", "pricks", "pron", "pube", "pusse", "pussi", "pussies", "pussy", "pussys", "rectum", "retard", "rimjaw", "rimming", "s hit", "s.o.b.", "sadist", "schlong", "screwing", "scroat", "scrote", "scrotum", "semen", "sex", "sh!+", "sh!t", "sh1t", "shag", "shagger", "shaggin", "shagging", "shemale", "shi+", "shit", "shitdick", "shite", "shited", "shitey", "shitfuck", "shitfull", "shithead", "shiting", "shitings", "shits", "shitted", "shitter", "shitters", "shitting", "shittings", "shitty", "skank", "slut", "sluts", "smegma", "smut", "snatch", "son-of-a-bitch", "spac", "spunk", "s_h_i_t", "t1tt1e5", "t1tties", "teets", "teez", "testical", "testicle", "tit", "titfuck", "tits", "titt", "tittie5", "tittiefucker", "titties", "tittyfuck", "tittywank", "titwank", "tosser", "turd", "tw4t", "twat", "twathead", "twatty", "twunt", "twunter", "v14gra", "v1gra", "vagina", "viagra", "vulva", "w00se", "wang", "wank", "wanker", "wanky", "whoar", "whore", "willies", "willy", "xrated", "xxx" }; new badword_count; for (new pos, i = sizeof badwords - 1; i != 0 ; i--) { while ((pos = strfind(input, badwords[i], true, pos), pos) != -1) { for (new p; p < strlen(badwords[i]) - allowed_beginning_chars - allowed_end_chars; p++) input[pos + p + allowed_beginning_chars] = '*'; badword_count++; } } return badword_count; }
What about "words-exceptions"?
I'm not sure how in English, but in Russian (for example) there are some words that have a partial match with some bad words, although they are not a bad words. |
An alternative would be to split the spring into words and compare each words, then join it back together.
|
public OnPlayerText(playerid, text[]) { for(new i, j, p, s, t; i < num_s; ++i) { t = 0; while((j = strfind(text, Swears[i], true, t)) != -1) { s = j + strlen(Swears[i]); for(p = 0; p < num_e; ++p) { if(!(-1 < strfind(text, Exceptions[p], true, t) < s) || strfind(Exceptions[p], Swears[i], true) == -1) { if(p == num_e - 1) { for(; j < s; ++j) text[j] = '*'; } continue; } else { t = s; break; } } } } return 1; }
IsObstacleOnPath(Float:a[], Float:b[], Float:tolerance = 60.0) {
new Float:c[3];
new Float:d[3];
new Float: retn;
new Float:angle = (atan2(a[0]-b[0], a[1]-b[1]))+180.0;
if(angle > 360.0) angle -= 360.0;
new Float: i = 1.0;
new Float: j = VectorSize(a[0]-b[0], a[1]-b[1], 0.0);
new Float: x; new Float: y;
while( i <= (j) ) {
c[0]=a[0]+(i*floatsin(angle,degrees));
c[1]=a[1]+(i*floatcos(angle,degrees));
d[0]=a[0]+((i-1)*floatsin(angle,degrees));
d[1]=a[1]+((i-1)*floatcos(angle,degrees));
CA_FindZ_For2DCoord(c[0],c[1],c[2]);
CA_FindZ_For2DCoord(d[0],d[1],d[2]);
i += 1.0;
x= VectorSize(c[0]-d[0], c[1]-d[1], 0.0);
y = floatabs(d[2]-c[2]);
retn = atan2(y,x);
if(retn > tolerance) {
return true;
}
}
return false;
}
strcensor
Censors "bad words" in a string. Examples: Код:
input = "fuck you"; strcensor(input); // output = f*** you input = "fuck you"; strcensor(input, 0); // output = **** you input = "fuck you"; strcensor(input, 1, 1); // output = f**k you input = "fuck you bitch"; strcensor(input); // output = f*** you b**** Код:
strcensor(input[], allowed_beginning_chars = 1, allowed_end_chars = 0) { static const badwords[][] = { "4r5e", "5h1t", "5hit", "a55", "anal", "anus", "ar5e", "arrse", "arse", "ass", "ass-fucker", "asses", "assfucker", "assfukka", "asshole", "assholes", "asswhole", "a_s_s", "b!tch", "b00bs", "b17ch", "b1tch", "ballbag", "balls", "ballsack", "bastard", "beastial", "beastiality", "bellend", "bestial", "bestiality", "bi+ch", "biatch", "bitch", "bitcher", "bitchers", "bitches", "bitchin", "bitching", "bloody", "blow job", "blowjob", "blowjobs", "boiolas", "bollock", "bollok", "boner", "boob", "boobs", "booobs", "boooobs", "booooobs", "booooooobs", "breasts", "buceta", "bugger", "bum", "bunny fucker", "butt", "butthole", "buttmuch", "buttplug", "c0ck", "c0cksucker", "carpet muncher", "cawk", "chink", "cipa", "cl1t", "clit", "clitoris", "clits", "cnut", "cock", "cock-sucker", "cockface", "cockhead", "cockmunch", "cockmuncher", "cocks", "cocksuck", "cocksucked", "cocksucker", "cocksucking", "cocksucks", "cocksuka", "cocksukka", "cok", "cokmuncher", "coksucka", "coon", "cox", "crap", "cum", "cummer", "cumming", "cums", "cumshot", "cunilingus", "cunillingus", "cunnilingus", "cunt", "cuntlick", "cuntlicker", "cuntlicking", "cunts", "cyalis", "cyberfuc", "cyberfuck", "cyberfucked", "cyberfucker", "cyberfuckers", "cyberfucking", "d1ck", "damn", "dick", "dickhead", "dildo", "dildos", "dink", "dinks", "dirsa", "dlck", "dog-fucker", "doggin", "dogging", "donkeyribber", "doosh", "duche", "dyke", "ejaculate", "ejaculated", "ejaculates", "ejaculating", "ejaculatings", "ejaculation", "ejakulate", "f u c k", "f u c k e r", "f4nny", "fag", "fagging", "faggitt", "faggot", "faggs", "fagot", "fagots", "fags", "fanny", "fannyflaps", "fannyfucker", "fanyy", "fatass", "fcuk", "fcuker", "fcuking", "feck", "fecker", "felching", "fellate", "fellatio", "fingerfuck", "fingerfucked", "fingerfucker", "fingerfuckers", "fingerfucking", "fingerfucks", "fistfuck", "fistfucked", "fistfucker", "fistfuckers", "fistfucking", "fistfuckings", "fistfucks", "flange", "fook", "fooker", "fuck", "fucka", "fucked", "fucker", "fuckers", "fuckhead", "fuckheads", "fuckin", "fucking", "fuckings", "fuckingshitmotherfucker", "fuckme", "fucks", "fuckwhit", "fuckwit", "fudge packer", "fudgepacker", "fuk", "fuker", "fukker", "fukkin", "fuks", "fukwhit", "fukwit", "fux", "fux0r", "f_u_c_k", "gangbang", "gangbanged", "gangbangs", "gaylord", "gaysex", "goatse", "God", "god-dam", "god-damned", "goddamn", "goddamned", "hardcoresex", "hell", "heshe", "hoar", "hoare", "hoer", "homo", "hore", "horniest", "horny", "hotsex", "jack-off", "jackoff", "jap", "jerk-off", "jism", "jiz", "jizm", "jizz", "kawk", "knob", "knobead", "knobed", "knobend", "knobhead", "knobjocky", "knobjokey", "kock", "kondum", "kondums", "kum", "kummer", "kumming", "kums", "kunilingus", "l3i+ch", "l3itch", "labia", "lust", "lusting", "m0f0", "m0fo", "m45terbate", "ma5terb8", "ma5terbate", "masochist", "master-bate", "masterb8", "masterbat*", "masterbat3", "masterbate", "masterbation", "masterbations", "masturbate", "mo-fo", "mof0", "mofo", "mothafuck", "mothafucka", "mothafuckas", "mothafuckaz", "mothafucked", "mothafucker", "mothafuckers", "mothafuckin", "mothafucking", "mothafuckings", "mothafucks", "mother fucker", "motherfuck", "motherfucked", "motherfucker", "motherfuckers", "motherfuckin", "motherfucking", "motherfuckings", "motherfuckka", "motherfucks", "muff", "mutha", "muthafecker", "muthafuckker", "muther", "mutherfucker", "n1gga", "n1gger", "nazi", "nigg3r", "nigg4h", "nigga", "niggah", "niggas", "niggaz", "nigger", "niggers", "nob", "nob jokey", "nobhead", "nobjocky", "nobjokey", "numbnuts", "nutsack", "orgasim", "orgasims", "orgasm", "orgasms", "p0rn", "pawn", "pecker", "penis", "penisfucker", "phonesex", "phuck", "phuk", "phuked", "phuking", "phukked", "phukking", "phuks", "phuq", "pigfucker", "pimpis", "piss", "pissed", "pisser", "pissers", "pisses", "pissflaps", "pissin", "pissing", "pissoff", "poop", "porn", "porno", "pornography", "pornos", "prick", "pricks", "pron", "pube", "pusse", "pussi", "pussies", "pussy", "pussys", "rectum", "retard", "rimjaw", "rimming", "s hit", "s.o.b.", "sadist", "schlong", "screwing", "scroat", "scrote", "scrotum", "semen", "sex", "sh!+", "sh!t", "sh1t", "shag", "shagger", "shaggin", "shagging", "shemale", "shi+", "shit", "shitdick", "shite", "shited", "shitey", "shitfuck", "shitfull", "shithead", "shiting", "shitings", "shits", "shitted", "shitter", "shitters", "shitting", "shittings", "shitty", "skank", "slut", "sluts", "smegma", "smut", "snatch", "son-of-a-bitch", "spac", "spunk", "s_h_i_t", "t1tt1e5", "t1tties", "teets", "teez", "testical", "testicle", "tit", "titfuck", "tits", "titt", "tittie5", "tittiefucker", "titties", "tittyfuck", "tittywank", "titwank", "tosser", "turd", "tw4t", "twat", "twathead", "twatty", "twunt", "twunter", "v14gra", "v1gra", "vagina", "viagra", "vulva", "w00se", "wang", "wank", "wanker", "wanky", "whoar", "whore", "willies", "willy", "xrated", "xxx" }; new badword_count; for (new pos, i = sizeof badwords - 1; i != 0 ; i--) { while ((pos = strfind(input, badwords[i], true, pos), pos) != -1) { for (new p; p < strlen(badwords[i]) - allowed_beginning_chars - allowed_end_chars; p++) input[pos + p + allowed_beginning_chars] = '*'; badword_count++; } } return badword_count; } |
strcensor("your mother gives the best bIowjobs") == 0
stock strfuzzyfind(const string[], const sub[], pos = 0, &start = -1, &end = -1)
{
new len = strlen(string);
new sublen = strlen(sub);
new s[2];
s[0] = sub[0];
pos -= 1;
while (-1 != (pos = strfind(string, s, true, ++pos))) {
for (new i = pos, j = 0; i < len; i++) {
switch (string[i]) {
case 'a' .. 'z', 'A' .. 'Z': {
if (string[i] != sub[j++]) {
break;
}
if (j == sublen) {
start = pos;
end = i;
return pos;
}
}
}
}
}
return -1;
}
main() {
new pos = -1;
new input[] = "h e l l o h-e-l-l-o world";
new sub[] = "hello";
new start, end;
while (-1 != (pos = strfuzzyfind(input, sub, pos + 1, start, end))) {
for (new i = start + 1; i < end; i++) {
input[i] = '*';
}
printf("found at %d", pos);
}
printf("%s", input);
}
found at 0 found at 10 h*******o h*******o world
Why the hell would you censor that?
Are you censoring text for sunday church or something? Clearly the player could just try f__u_c_k instead, which would work. Your could make a custom strfind that ignores non-alphanumerics, which would cut down on most of this. It seems rather inefficient to add many combinations of a word (such as shit, shitdick, shiting, etc.) rather than just having 1 word where you specify whether the beginning and the end has to be an anchor or not (i.e. next to whitespace/bounds). |
enum
{
INVALID_BAN_TYPE,
PSEUDO_BAN_TYPE,
IP_BAN_TYPE,
TWICE_BAN_TYPE
}
stock GetBanType(const buf[])
{
new
l = strlen(buf);
if(buf[0] == '+' || buf[l-1] == '+') return INVALID_BAN_TYPE;
new
bool:gbt@p,
bool:gbt@i,
bool:gbt@s;
for(new i = 0; i < l; i++)
{
switch(buf[i])
{
case 'p', 'P': {if(gbt@p) return INVALID_BAN_TYPE; gbt@p = true;}
case 'i', 'I': {if(gbt@i) return INVALID_BAN_TYPE; gbt@i = true;}
case '+': {if(gbt@s) return INVALID_BAN_TYPE; gbt@s = true;}
default: return INVALID_BAN_TYPE;
}
}
return (gbt@p ? (gbt@i ? (gbt@s ? TWICE_BAN_TYPE : INVALID_BAN_TYPE) : PSEUDO_BAN_TYPE) : (gbt@i ? IP_BAN_TYPE : INVALID_BAN_TYPE));
}
main()
{
new const
a[][] =
{
"p+i",
"i",
"p",
"P+I",
"I",
"P",
"pi",
"p+",
"i+",
"+p",
"+i",
"a+p",
"a+a",
"p+++i"
};
for(new i = 0; i < sizeof(a); i++)
{
new
bt = GetBanType(a[i]);
switch(bt)
{
case INVALID_BAN_TYPE: printf("%s -> INVALID_BAN_TYPE", a[i]);
case PSEUDO_BAN_TYPE: printf("%s -> PSEUDO_BAN_TYPE", a[i]);
case IP_BAN_TYPE: printf("%s -> IP_BAN_TYPE", a[i]);
case TWICE_BAN_TYPE: printf("%s -> TWICE_BAN_TYPE", a[i]);
}
}
}
p+i -> TWICE_BAN_TYPE i -> IP_BAN_TYPE p -> PSEUDO_BAN_TYPE P+I -> TWICE_BAN_TYPE I -> IP_BAN_TYPE P -> PSEUDO_BAN_TYPE pi -> INVALID_BAN_TYPE p+ -> INVALID_BAN_TYPE i+ -> INVALID_BAN_TYPE +p -> INVALID_BAN_TYPE +i -> INVALID_BAN_TYPE a+p -> INVALID_BAN_TYPE a+a -> INVALID_BAN_TYPE p+++i -> INVALID_BAN_TYPE
enum (<<= 1) {
INVALID_BAN_TYPE = 0b000,
PSEUDO_BAN_TYPE = 0b001,
IP_BAN_TYPE // 0b010
}
stock Ban(ban_type) {
if (ban_type & PSEUDO_BAN_TYPE) {
DoPseudoBan(...);
}
if (ban_type & IP_BAN_TYPE) {
DoIpBan(...);
}
}
// only IP ban
Ban(IP_BAN_TYPE);
// this is the "twice" type
Ban(PSEUDO_BAN_TYPE | IP_BAN_TYPE);
IsObstacleOnPath(Float:a[], Float:b[], Float:tolerance = 63.5, Float: pitch = 0.5) {
static Float:c[3];
if(floatabs(a[2] - b[2]) < 0.25) {
// if is same Z ground, only check CA_RayCastLine have simple colission
return CA_RayCastLine(
a[0], a[1], a[2],
b[0], b[1], b[2],
c[0], c[1], c[2]
);
}
static Float:d[3];
static Float: retn;
static Float:angle;
// angle between two points
angle = (atan2(a[0]-b[0], a[1]-b[1]))+180.0;
if(angle > 360.0) angle -= 360.0;
static Float: i; i = pitch;
// distance between two points 3d
static Float: j; j = VectorSize(a[0]-b[0], a[1]-b[1], 0.0);
new Float: x; new Float: y;
while( i <= (j) ) {
// check pitch by bitch to detect anormalite of Z ground (obstacle)
c[0]=a[0]+(i*floatsin(angle,degrees));
c[1]=a[1]+(i*floatcos(angle,degrees));
d[0]=a[0]+((i-pitch)*floatsin(angle,degrees));
d[1]=a[1]+((i-pitch)*floatcos(angle,degrees));
// get find z coord
CA_FindZ_For2DCoord(c[0],c[1],c[2]);
CA_FindZ_For2DCoord(d[0],d[1],d[2]);
i += pitch;
// get distance from 2d point
x = VectorSize(c[0]-d[0], c[1]-d[1], 0.0);
static Float: slope;
static Float: e[3];
static r ;
if(d[2]>=c[2]) {
// check if have possible colission
y = (d[2]-c[2]);
// get angle between z angle
retn = atan2(y,x);
// if have a colission
if(retn > tolerance) {
r = CA_RayCastLineNormal(
c[0], c[1], c[2],
d[0], d[1], c[2]+0.5,
e[0],e[1],e[2],
slope, slope, slope
);
// check if is bridge or not
return (r && acos(slope) > tolerance);
}
}
else {
y = floatabs(c[2]-d[2]);
retn = atan2(y,x);
if(retn > tolerance) {
r = CA_RayCastLineNormal(
d[0], d[1], d[2],
c[0], c[1], d[2]+0.5,
e[0],e[1],e[2],
slope, slope, slope
);
return (r && acos(slope) > tolerance);
}
}
}
return false;
}
static const FightingStyleNames[][] = { "Normal", "Boxing", "Kung fu", "Knee Head", "", "", "", "", "", "", "", "Grab Kick", "Elbow" }; stock GetFightingStyleName(style, string[], len) { if(!(3 < style < 8) && !(14 < style < 17)) return 0; strmid(string, FightingStyleNames[style - 4], 0, strlen(FightingStyleNames[style - 4]), len); return 1; }
You should know tricking people into using things like that isn't just going to be allowed.
If anybody sees this, DON'T USE THAT FUCKING FUNCTION. It repeatedly sets more and more infinite timers each time it is run. It's going to wreck your computer. |