[Tutorial] Object Loader
#1

When i was bored i made this.... this can be used for any object streamer...
Did you have sometimes when you teleport to somewhere and you fall trough objects? This is way to fix it!
Some Info:
Doesn't matter how much heal have player but if player have 0 heal this won't work

Screens? :
when objects are loading:

when objects are loaded:


about image when Objects was loaded thats a little bug.... you don't see objects but you can walk on them....
it won't happen if you teleport to there twice in 1 minute....


Lets get started!
This can be in any FILTERSCRIPT/GAMEMODE
so we need to forward Callbacks!
Code:
 forward LoadObjects(playerid); //with standart load time 2 secs
forward LoadedObjects(playerid);
forward LoadDmObjects(playerid); //with standart load time 2 secs
forward LoadedDmObjects(playerid);
//timed
forward LoadTimedObjects(playerid,Time); //you need to change Time in your gamemode / include to time what you want loading! (in seconds)
forward LoadTimedDmObjects(playerid,Time); // same but in deathmach!
so.... when we have that.... we will need godmode.... to disable unfair kills in dm!
pawn Code:
#define GOD_ON 100000
#define GOD_OFF 100
and now we need to make Callbacks now:
Standart (2 seconds timer )

pawn Code:
public LoadObjects(playerid)
{
    SetTimerEx("LoadedObjects",2000,false,"i",playerid);
    TogglePlayerControllable(playerid,0);
    GameTextForPlayer(playerid,"~w~Objects ~r~Loading",1000,5);
    return 1;
}
Im using SetTimerEx because its able to set timer for one player not all... so.... noone gets freezed only yoU!
TogglePlayerControllable(playerid,0); its just freezing you.... important line....
GameTextForPlayer(playerid,"~w~Objects ~r~Loading",1000,5); isn't important line... you can delete it if you dont want to have it....

Whats about that when timer ends? you should unfreeze player....
pawn Code:
public LoadedObjects(playerid)
{
    TogglePlayerControllable(playerid,1);
    GameTextForPlayer(playerid,"~w~Objects ~g~Loaded",6000,5);
    return 1;
}
TogglePlayerControllable(playerid,1); unfreezing player
same as before! GameTextForPlayer(playerid,"~w~Objects ~g~Loaded",6000,5); isnt important one.... because its effect is announcing text (may be removed*)

don't want fall trough death mach objects? or don't want to be unfair killed?
see how its done down here.....
pawn Code:
public LoadDmObjects(playerid)
{
    SetPlayerHealth(playerid, GOD_ON);
    SetTimerEx("LoadedDmObjects",2000,false,"i",playerid);
    TogglePlayerControllable(playerid,0);
    GameTextForPlayer(playerid,"~w~Deathmatch ~r~Loading",2000,5);
    return 1;
}
Explaining things:
SetPlayerHealth(playerid, GOD_ON); Sets player heal to unkillable.... (you wont have unfair kills with this lane...)
SetTimerEx("LoadedDmObjects",2000,false,"i",player id); Sets timer just for player
TogglePlayerControllable(playerid,0); As i told this freezes player
GameTextForPlayer sends announce text for player.....


pawn Code:
public LoadedDmObjects(playerid)
{
    SetPlayerHealth(playerid, GOD_OFF);
    TogglePlayerControllable(playerid,1);
    GameTextForPlayer(playerid,"~w~Deathmatch ~g~Loaded",6000,5);
    return 1;
}
SetPlayerHealth(playerid, GOD_OFF); sets players heal to 100... makes him killable
and you should undarstand whats all in that.... if you don't read topic again!

Custom timer Loaders:

pawn Code:
public LoadTimedObjects(playerid,Time) //replace time with your own defined in secs
{
    SetTimerEx("LoadedObjects",Time*1000,false,"i",playerid);
    TogglePlayerControllable(playerid,0);
    GameTextForPlayer(playerid,"~w~Objects ~r~Loading",1000,5);
    return 1;
}
im using ''LoadedObjects'' again because doesn't need to make LoadedTimedObjects.... its just.... filling script palace
''Time*1000'' means that:
i use some nummber as 4
4 = Time
4*1000 is 4 seconds or 4000
thats how does that work.....


pawn Code:
public LoadTimedDmObjects(playerid,Time)
{
    SetPlayerHealth(playerid, GOD_ON);
    SetTimerEx("LoadedDmObjects",Time*1000,false,"i",playerid);
    TogglePlayerControllable(playerid,0);
    GameTextForPlayer(playerid,"~w~Deathmatch ~r~Loading",2000,5);
    return 1;
}
if you don't undarstand how this work read about LoadTimedObjects(playerid,Time)

there isn't big difference about LoadDmObjects or LoadTimedDmObjects.... just custom timer....

As ****** said i ll make and show how to use it!
you can use that in teleports:
warning* im using ZCMD.... you can change it to any command format.....

pawn Code:
CMD:dm1(playerid, params[]) {
            LoadTimedDmObjects(playerid,2); // i have replaced time with 2.... thats timer in seconds how long you want to load
            SetPlayerPos(playerid,Float:X,Float:Y,Float:Z); // and this..... yea..... teleport.... xD
            }
        return 1;
}
simple commands:
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/airdrift", true)) // you can change airdrift to anything else
    {
                    LoadTimedObjects(playerid,2); // or use LoadObjects(playerid,);
            SetPlayerPos(playerid,Float:X,Float:Y,Float:Z); // teleport (float)
        return 1;
    }
    return 0;
}
you can use that when player spawns
pawn Code:
public OnPlayerSpawn(playerid);
}
LoadObjects(playerid);
return 1;
}
or you could use:
pawn Code:
public OnPlayerSpawn(playerid);
}
LoadTimedObjects(playerid,4);
return 1;
}
None bugs found.... found a bug? pm me....


so..... as you can see i use ''2'' not ''2000'' because milliseconds doesn't support my function right......
and it dont work as i want to....

any questions?


and thats it!



sry for my sh*ty grammar... xD
Reply
#2

Imo you just copyed this from some script and didnt anything especially explain for new scripters.
Reply
#3

thanks it helped
Reply
#4

n.p.... i enjoy that you like that... xD
Reply
#5

ok... i ll add few things....
Reply
#6

u copy this https://sampforum.blast.hk/showthread.php?tid=188906
Reply
#7

omfg... i never been on that topic.... omg.... this is 100% mine script... thats Map script...... i don't care about it....
i have not copied nothing....!
Reply
#8

https://sampforum.blast.hk/showthread.php?tid=191112
Reply
#9

Super Thank
Reply
#10

Quote:
Originally Posted by parames3010
View Post
Super Thank
Lol, Well thank you. Wasn't expecting this to be back again lol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)