Quote
potrei aggiungere un commento sulle funzioni/macro binarie di peppe, mi potresti spiegare a cosa servirebbero?
Quote
Inviato il 21 settembre 2010 - 12:33
Quote
Quote
Inviato il 01 ottobre 2010 - 13:17
stock TicksConvert(ticks) { new d, h, m, s, ms; d = ticks/86400000; h = ticks/3600000 % 24; m = ticks/60000 % 60; s = ticks/1000 % 60; ms = ticks % 1000; new str[128]; format(str, 128, "%d giorni, %d ore, %d minuti, %d secondi, %d millisecondi", d, h, m, s, ms); return str; }
stock TicksConvert(ticks) { new str[128]; format(str, 128, "%d:%02d:%03d", ticks/60000 % 60, ticks/1000 % 60, ticks % 1000); return str; }
Inviato il 02 ottobre 2010 - 03:18
#define rotx 1 #define roty 2 #define rotz 3 forward RotateObject(objectid, axis, Float:extent, Float:rspeed);
public RotateObject(objectid, axis, Float:extent, Float:rspeed) { if (rspeed <= 0.0) return 1; if ((extent > 0.0) && (extent < rspeed/10)) rspeed = extent*10; if ((extent < 0.0) && (extent > -rspeed/10)) rspeed = -extent*10; if (extent == 0.0) return 1; new Float:rx, Float:ry, Float:rz; GetObjectRot(objectid, rx, ry, rz); switch (axis) { case rotx: SetObjectRot(objectid, rx + ((extent > 0.0) ? (rspeed/10) : (-rspeed/10)), ry, rz); case roty: SetObjectRot(objectid, rx, ry + ((extent > 0.0) ? (rspeed/10) : (-rspeed/10)), rz); case rotz: SetObjectRot(objectid, rx, ry, rz + ((extent > 0.0) ? (rspeed/10) : (-rspeed/10))); } SetTimerEx("RotateObject", 10, 0, "ddff", objectid, axis, ((extent > 0.0) ? (extent - rspeed/10) : (extent + rspeed/10)), rspeed); return 1; }
new sbarrapolizia;
sbarrapolizia = CreateObject(...);
if (!strcmp(cmdtext, "/aprisbarra", true)) { RotateObject(sbarrapolizia, rotx, 90.0, 0.5); // E' solo un esempio, non sono sicuro che sia +90 gradi (potrebbe essere -90 gradi) e che sia sull'asse x. return 1; }
if (!strcmp(cmdtext, "/ruota", true)) { RotateObject(objectid, rotz, -90.0, 1.0); return 1; }
if (!strcmp(cmdtext, "/ruota", true)) { RotateObject(objectid, rotz, -90.0, 1.0); RotateObject(objectid, rotx, 270.0, 5.0); RotateObject(objectid, roty, -180.0, 3.5); return 1; }
if (!strcmp(cmdtext, "/ruota", true)) { RotateObject(objectid, rotz, 1440, 5.0); // L'oggetto girerà su se stesso per 4 volte, in quanto 1440 = 360*4 return 1; }
if (!strcmp(cmdtext, "/ruota", true)) { RotateObject(objectid1, rotz, 180, 5.0); RotateObject(objectid2, roty, 90, 2.0); RotateObject(objectid3, rotx, -45, 0.3); RotateObject(objectid4, rotz, 360, 10.5); return 1; }
Inviato il 09 ottobre 2010 - 20:44
GetPlayerNameFromIP(ip[]) { new maxPlayers = GetMaxPlayers(), iIP[16], PlayerName[24]; for(new i = 0; i != maxPlayers; i++) { if(IsPlayerConnected(i)) { GetPlayerIp(i, iIP, 16); if(strcmp(ip, iIP, true) == 0) { GetPlayerName(i, PlayerName, 24); return PlayerName; } } } return PlayerName; }
Inviato il 09 ottobre 2010 - 20:49
GetPlayerIDFromIP(ip[]) { new IP[16], playerid; for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { GetPlayerIp(i, IP, sizeof(IP)); if(strcmp(ip, IP, true)==0) return i = playerid; }else return INVALID_PLAYER_ID; } return playerid; }
public OnRconLoginAttempt(ip[], password[], success) { if(!success) { new nome[24], str[256], playerid; playerid = GetPlayerIDFromIP(ip); GetPlayerName(playerid, nome, 24); format(str, 256, "%s ha sbagliato il login", nome); SendClientMessageToAll(0x0000FF, str); } return 1; }
Inviato il 10 ottobre 2010 - 13:38
CreaPunto(&Float:x, &Float:y, Float:distance, Float:a) { x += (distance * floatsin(-a, degrees)); y += (distance * floatcos(-a, degrees)); }
new Text:Lancetta[21][MAX_PLAYERS]; for(new i = 0; i < MAX_PLAYERS; i++) { for(new a = 0;a<21;a++) { TextDrawDestroy(Lancetta[a][i]); TextDrawHideForPlayer(i,Lancetta[a][i]); } new Float:distance=0; for(new a = 0;a<21;a++) { distance+=1.5; new Float:X,Float:Y; CreaPunto(X, Y, distance,70+speed);// nell'ultimo campo va inserita l'angolazione in questo caso 70 (che decidiamo noi) + la velocità a cui va la macchina. La distanza serve a far spostare ad ogni ciclo il puntino Lancetta[a][i] = TextDrawCreate(X+150,Y+150,".");//Io ho messo +150 e +150, modificate queste cordinate per il centro. TextDrawShowForPlayer(i,Lancetta[a][i]); } }
Messaggio modificato da StanleY il 10 ottobre 2010 - 13:39
Inviato il 10 ottobre 2010 - 14:33
stock FloatToInt(Float: Var) { new str[30]; format(str, 30, "%f", Var); return strval(str); }
; new We = FloatToInt("34.97654"); printf("%d", We);
Inviato il 10 ottobre 2010 - 16:25
Angelo_95, il 10 ottobre 2010 - 15:33 ha detto:
stock FloatToInt(Float: Var) { new str[30]; format(str, 30, "%f", Var); return strval(str); }
; new We = FloatToInt("34.97654"); printf("%d", We);
floatround(34.97654, floatround_floor);
Inviato il 10 ottobre 2010 - 18:10
BanClan(tag[]) { new nome[24], str[10]; format(str, sizeof(str), "[%s]" , tag); for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { GetPlayerName(i, nome, 24); if(strfind(nome, str, true)==0) { Ban(i); } } } return 1; }
Messaggio modificato da Angelo_95 il 10 ottobre 2010 - 18:19