Szerző Téma: Hóesés script átálítása  (Megtekintve 785 alkalommal)

Nem elérhető BoSS

  • 816
    • Profil megtekintése
Hóesés script átálítása
« Dátum: 2012. december 18. - 18:58:09 »
0 Show voters
Sziasztok ez zcmd-s most és nekem nem zcmd-s kéne :/
Valaki meg tudná csinálni úgy?
Elõre is köszi
 
#include <a_samp>
#include <streamer>
#include <zcmd>
#undef MAX_PLAYERS
#define MAX_SLOTS         30
#define MAX_SNOW_OBJECTS    20
#define UPDATE_INTERVAL     750
#if MAX_SLOTS == -1
#error Change MAX_SLOTS to the max players of your server! (At line 6)
#endif
#define ploop(%0)         for(new %0 = 0; %0 < MAX_SLOTS; %0++) if(IsPlayerConnected(%0))
#define CB:%0(%1)           forward %0(%1); public %0(%1)
new bool:snowOn[MAX_SLOTS char],
snowObject[MAX_SLOTS][MAX_SNOW_OBJECTS],
updateTimer[MAX_SLOTS char]
;
public OnFilterScriptExit()
{
ploop(i)
{
    if(snowOn{i})
    {
        for(new j = 0; j < MAX_SNOW_OBJECTS; j++) DestroyDynamicObject(snowObject[j]);
   KillTimer(updateTimer{i});
}
}
return 1;
}
public OnPlayerDisconnect(playerid)
{
if(snowOn{playerid})
{
    for(new i = 0; i < MAX_SNOW_OBJECTS; i++) DestroyDynamicObject(snowObject[playerid]);
snowOn{playerid} = false;
KillTimer(updateTimer{playerid});
}
return 1;
}
CB:UpdateSnow(playerid)
{
if(!snowOn{playerid}) return 0;
new Float:pPos[3];
GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
for(new i = 0; i < MAX_SNOW_OBJECTS; i++) SetDynamicObjectPos(snowObject[playerid], pPos[0] + random(25), pPos[1] + random(25), pPos[2] - 5);
return 1;
}
stock CreateSnow(playerid)
{
if(snowOn{playerid}) return 0;
new Float:pPos[3];
GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
for(new i = 0; i < MAX_SNOW_OBJECTS; i++) snowObject[playerid] = CreateDynamicObject(18864, pPos[0] + random(25), pPos[1] + random (25), pPos[2] - 5, random(100), random(100), random(100), -1, -1, playerid);
snowOn{playerid} = true;
updateTimer{playerid} = SetTimerEx(\"UpdateSnow\", UPDATE_INTERVAL, true, \"i\", playerid);
return 1;
}
stock DeleteSnow(playerid)
{
if(!snowOn{playerid}) return 0;
for(new i = 0; i < MAX_SNOW_OBJECTS; i++) DestroyDynamicObject(snowObject[playerid]);
KillTimer(updateTimer{playerid});
snowOn{playerid} = false;
return 1;
}
CMD:hoeses(playerid, params[])
{
if(snowOn{playerid})
{
    DeleteSnow(playerid);
    SendClientMessage(playerid, 0x00FF00AA, \"* Hóesést leállítottad!\");
}
else
{
    CreateSnow(playerid);
    SendClientMessage(playerid, 0x00FF00AA, \"Hóesés elindítva! Boldog karácsonyt és kellemes ünnepeket! :)\");
}
return 1;
}
CMD:allhoeses(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    ploop(i) //This is included in my FS! It\'s the \'#define ploop(%0)\' thing.
    {
        if(snowOn{i}) continue;
        CreateSnow(i);
    }
    return 1;
}
CMD:allsnowoff(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    ploop(i)
    {
        if(!snowOn{i}) continue;
        DeleteSnow(i);
    }
    return 1;
}

Nem elérhető DyZe

Hóesés script átálítása
« Válasz #1 Dátum: 2012. december 18. - 23:01:19 »
0 Show voters
Talán, jó talán nem, de szerintem nem jó ahogy ismerem magam!!
 
#include <a_samp>
#include <streamer>
#undef MAX_PLAYERS
#define MAX_SLOTS                       30
#define MAX_SNOW_OBJECTS    20
#define UPDATE_INTERVAL     750
#if MAX_SLOTS == -1
        #error Change MAX_SLOTS to the max players of your server! (At line 6)
#endif
#define ploop(%0)                       for(new %0 = 0; %0 < MAX_SLOTS; %0++) if(IsPlayerConnected(%0))
#define CB:%0(%1)           forward %0(%1); public %0(%1)
new bool:snowOn[MAX_SLOTS char],
        snowObject[MAX_SLOTS][MAX_SNOW_OBJECTS],
        updateTimer[MAX_SLOTS char]
;
public OnFilterScriptExit()
{
        ploop(i)
        {
            if(snowOn{i})
            {
                for(new j = 0; j < MAX_SNOW_OBJECTS; j++) DestroyDynamicObject(snowObject[j]);
                        KillTimer(updateTimer{i});
                }
        }
        return 1;
}
public OnPlayerDisconnect(playerid)
{
        if(snowOn{playerid})
        {
            for(new i = 0; i < MAX_SNOW_OBJECTS; i++) DestroyDynamicObject(snowObject[playerid]);
                snowOn{playerid} = false;
                KillTimer(updateTimer{playerid});
        }
        return 1;
}
CB:UpdateSnow(playerid)
{
        if(!snowOn{playerid}) return 0;
        new Float:pPos[3];
        GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
        for(new i = 0; i < MAX_SNOW_OBJECTS; i++) SetDynamicObjectPos(snowObject[playerid], pPos[0] + random(25), pPos[1] + random(25), pPos[2] - 5);
        return 1;
}
stock CreateSnow(playerid)
{
        if(snowOn{playerid}) return 0;
        new Float:pPos[3];
        GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
        for(new i = 0; i < MAX_SNOW_OBJECTS; i++) snowObject[playerid] = CreateDynamicObject(18864, pPos[0] + random(25), pPos[1] + random (25), pPos[2] - 5, random(100), random(100), random(100), -1, -1, playerid);
        snowOn{playerid} = true;
        updateTimer{playerid} = SetTimerEx(\"UpdateSnow\", UPDATE_INTERVAL, true, \"i\", playerid);
        return 1;
}
stock DeleteSnow(playerid)
{
        if(!snowOn{playerid}) return 0;
        for(new i = 0; i < MAX_SNOW_OBJECTS; i++) DestroyDynamicObject(snowObject[playerid]);
        KillTimer(updateTimer{playerid});
        snowOn{playerid} = false;
        return 1;
}
CMD:hoeses(playerid, params[])
{
        if(snowOn{playerid})
        {
            DeleteSnow(playerid);
            SendClientMessage(playerid, 0x00FF00AA, \"* Hóesést leállítottad!\");
        }
        else
        {
            CreateSnow(playerid);
            SendClientMessage(playerid, 0x00FF00AA, \"Hóesés elindítva! Boldog karácsonyt és kellemes ünnepeket! :)\");
        }
        return 1;
}
CMD:allhoeses(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    ploop(i) //This is included in my FS! It\'s the \'#define ploop(%0)\' thing.
    {
        if(snowOn{i}) continue;
        CreateSnow(i);
    }
    return 1;
}
CMD:allsnowoff(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    ploop(i)
    {
        if(!snowOn{i}) continue;
        DeleteSnow(i);
    }
    return 1;
}

Nem elérhető BoSS

  • 816
    • Profil megtekintése
Hóesés script átálítása
« Válasz #2 Dátum: 2012. december 19. - 09:50:13 »
0 Show voters
Tuti nem jó! :) nekem régi fajta parancs kezelõn kell nem \"CMD:hoeses\"
Így kéne átalakítani.
 
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, \"/hó\", true))
    {
        if(SnowONOFF[playerid]==0)
        {
   GetPlayerCameraPos(playerid,sx,sy,sz);
   snowobj[playerid]=CreatePlayerObject(playerid,18864, sx, sy, sz-5, 0.0, 0.0, 0.0, 300.0);
            SnowONOFF[playerid]=1;
            SendClientMessage(playerid,0xFFFFFFAA,\"Hóesést bekpcsoltad\");
            SetPlayerWeather(playerid,9);
        }
        else if(SnowONOFF[playerid]==1)
        {
            SnowONOFF[playerid]=0;
            SendClientMessage(playerid,0xFFFFFFAA,\"Hóesést kikapcsoltad\");
            SetPlayerWeather(playerid,10);
            DestroyPlayerObject(playerid,snowobj[playerid]);
        }
        return 1;
    }

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal