18863 SnowArc1 18864 FakeSnow1 |
Porque No Outro ''Topico'' Nгo Achei Oque Eu Queria , Quero cria Um Comando ?
|
/******************************************************************************* Snow filterscript to simulate falling snow effects for SA:MP SA:MP 0.3 Author: James "Jay" Wilkinson irc.gtanet.com #Jay irc.gtanet.com #ww3 irc.sa-mp.com #ww3 Copyright © Jay 2009 *******************************************************************************/ #include <a_samp> #define SNOW_OBJECT 354 #define SLOTS 200 // aka MAX_PLAYERS #define MAX_SNOW 20 static snowObject[SLOTS][MAX_SNOW+1]; static snowActive[SLOTS]; public OnFilterScriptExit() { for(new i = 0; i < SLOTS; i++) { if(!IsPlayerConnected(i) || IsPlayerNPC(i)) continue; DestroySnow(i); } return 1; } public OnPlayerDisconnect(playerid, reason) { if(!IsPlayerNPC(playerid)) DestroySnow(playerid); } public OnPlayerSpawn(playerid) { CreateSnow(playerid); } public OnPlayerCommandText(playerid, cmdtext[]) { if(!strcmp(cmdtext, "/snow")) { if(!snowActive[playerid]) { CreateSnow(playerid); }else{ DestroySnow(playerid); } return 1; } return 0; } stock CreateSnow(playerid) { if(GetPlayerState(playerid) == 0 || GetPlayerState(playerid) > 6) return; if(GetPlayerInterior(playerid) != 0) return; if(snowActive[playerid] == 1) return; snowActive[playerid] = 1; new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); for(new i = 0; i < MAX_SNOW; i++) { snowObject[playerid][i] = CreatePlayerObject(playerid, SNOW_OBJECT, x, y , z , 0, 0, 0); RecreateSnow(playerid, snowObject[playerid][i]); } } stock DestroySnow(playerid) { snowActive[playerid] = 0; for(new i = 0; i < MAX_SNOW; i++) { DestroyPlayerObject(playerid, snowObject[playerid][i]); } } stock RecreateSnow(playerid, objectid) { if(snowActive[playerid] == 0) return; new Float:x, Float:y, Float:z, Float:objX, Float:objY, Float:objZ; GetPlayerPos(playerid, x, y, z); // And before you ask, I use random twice because SA:MP's random sucks ass new i = random(random(100)); if(i < 20) { SetPlayerObjectPos(playerid, objectid, x - random(random(100)), y + random (random(70)), z + random(20)+20); } else if(i >= 21 && i <= 30) { SetPlayerObjectPos(playerid, objectid, x + random(random(100)), y + random (random(70)), z + random(20)+20); } else if (i >= 31 && i < 40) { SetPlayerObjectPos(playerid, objectid, x + random(random(70)), y - random (random(100)), z + random(20)+20); } else { SetPlayerObjectPos(playerid, objectid, x + random(random(120)), y + random (random(30)), z + random(20)+20); } GetPlayerObjectPos(playerid, objectid, objX, objY, objZ); MovePlayerObject(playerid, objectid, objX, objY, z-10, random(70)+5); } public OnPlayerObjectMoved(playerid, objectid) { if(snowActive[playerid] == 0) return 1; for(new i = 0; i < MAX_SNOW; i++) { if(objectid == snowObject[playerid][i]) { RecreateSnow(playerid, objectid); return 1; } } return 1; }