public OnPlayerHealthChange(playerid,Float:NewHealth,Float:OldHealth)
{
return 1;
}
4kb on megaupload? You're kidding me right.
That's 0.1 second to download and 45 seconds waiting. |
#include <a_samp> #if defined _UPCB_included #endinput #endif #define _UPCB_included #pragma library UPCB //=======[ PUBLICS ]======= [ 1-ON / 0=OFF ] #define PublicHealth 1 #define PublicArmour 1 #define PublicPos 1 #define PublicBebida 1 //------------------------------------------ //Variaveis new Float:VidaA[MAX_PLAYERS],Float:ColeteA[MAX_PLAYERS],Bebida[MAX_PLAYERS],Vivo[MAX_PLAYERS],Float:PosX[MAX_PLAYERS],Float:PosY[MAX_PLAYERS],Float:PosZ[MAX_PLAYERS]; //Forwards forward OnPlayerHealthChange(playerid,Float:NewHealth,Float:OldHealth); forward OnPlayerArmourChange(playerid,Float:NewArmour,Float:OldArmour); forward OnPlayerPosChange(playerid,Float:NewX,Float:OldX,Float:NewY,Float:OldY,Float:NewZ,Float:OldZ); forward OnPlayerDrunkLevelChange(playerid,NewDrunkLevel,OldDrunkLevel); stock AtivarUPCB() { if(PublicHealth==1) {SetTimer("TimerVida",1000,true);} if(PublicArmour==1) {SetTimer("TimerColete",1000,true);} if(PublicPos==1) {SetTimer("TimerPos",1000,true);} if(PublicBebida==1) {SetTimer("TimerBebida",1000,true);} return 1; } public OnPlayerSpawn(playerid) {SetTimerEx("IsVivo",1500,false,"i",playerid);} public OnPlayerDeath(playerid) {Vivo[playerid]=0;} public OnPlayerDisconnect(playerid) {Vivo[playerid]=0;} forward IsVivo(playerid); public IsVivo(playerid) {Vivo[playerid]=1;} forward TimerVida(); public TimerVida() { for(new s=0;s<=MAX_PLAYERS;s++) { if(IsPlayerConnected(s)) { new Float:Vida;GetPlayerHealth(s,Vida); if(floatcmp(VidaA[s],Vida)&&Vivo[s]==1) { CallRemoteFunction("OnPlayerHealthChange","iff",s,VidaA[s],Vida); GetPlayerHealth(s,VidaA[s]); } } } return 1; } forward TimerColete(); public TimerColete() { for(new s=0;s<=MAX_PLAYERS;s++) { if(IsPlayerConnected(s)) { new Float:Armor;GetPlayerArmour(s,Armor); if(floatcmp(ColeteA[s],Armor)&&Vivo[s]==1) { CallRemoteFunction("OnPlayerArmourChange","iff",s,ColeteA[s],Armor); GetPlayerArmour(s,ColeteA[s]); } } } return 1; } forward TimerPos(); public TimerPos() { for(new s=0;s<=MAX_PLAYERS;s++) { if(IsPlayerConnected(s)) { new Float:PosXN,Float:PosYN,Float:PosZN;GetPlayerPos(s,PosXN,PosYN,PosZN); if(floatcmp(PosX[s],PosXN)&&Vivo[s]==1) { CallRemoteFunction("OnPlayerPosChange","ifff",s,PosX[s],PosXN,PosY[s],PosYN,PosZ[s],PosZN); GetPlayerPos(s,PosX[s],PosY[s],PosZ[s]); return 1; } if(floatcmp(PosY[s],PosYN)&&Vivo[s]==1) { CallRemoteFunction("OnPlayerPosChange","ifff",s,PosX[s],PosXN,PosY[s],PosYN,PosZ[s],PosZN); GetPlayerPos(s,PosX[s],PosY[s],PosZ[s]); return 1; } if(floatcmp(PosZ[s],PosZN)&&Vivo[s]==1) { CallRemoteFunction("OnPlayerPosChange","ifff",s,PosX[s],PosXN,PosY[s],PosYN,PosZ[s],PosZN); GetPlayerPos(s,PosX[s],PosY[s],PosZ[s]); return 1; } } } return 1; } forward TimerBebida(); public TimerBebida() { for(new s=0;s<=MAX_PLAYERS;s++) { if(IsPlayerConnected(s)) { new bebida=GetPlayerDrunkLevel(s); if((Bebida[s]!=bebida)&&Vivo[s]==1) { CallRemoteFunction("OnPlayerDrunkLevelChange","idd",s,Bebida[s],bebida); Bebida[s]=GetPlayerDrunkLevel(s); } } } return 1; }
Question.. What's the difference between OnPlayerUpdate and this timer thingy.. And what is faster?
|
Does this script use multiple timers? If so, then that's bad. All of these could be done in one timer.
|