All pastes #955483 Raw Edit

Mine

public cpp v1 · immutable
#955483 ·published 2008-03-24 17:45 UTC
rendered paste body
#include <a_samp>#include <float>//#pragma dynamic 2040347#define ini "No Limit Objects.ini"new MAX_OBJECTS2;enum oInfo{	realid[MAX_PLAYERS],	modelid,	Float:x,	Float:y,	Float:z,	Float:rx,	Float:ry,	Float:rz,	bool:isset[MAX_PLAYERS]}new ObjectInfo[5000][oInfo];public OnFilterScriptInit(){	if(!fexist(ini))	{	    print("Nie znalazlem pliku konfiguracyjnego!");	    print("Skrypt No Limit Objects nie zostanie zaladowany!");	    return 1;	}	new File:cfg = fopen(ini,io_read);	new string[256];	for(MAX_OBJECTS2 = 0; fread(cfg,string); MAX_OBJECTS2++)	{	    new start1,end1,start2,end2,start3,end3,start4,end4,start5,end5,start6,end6,start7,end7;	    new step = 1;		for(new i = 14; i < strlen(string); i++)		{			switch(step)			{			    case 1:			    {			        if(string[i] <= '9' && string[i] >= '0')			        {			            start1 = i-1;			            step = 2;					}				}				case 2:				{				    if(string[i] == ' ' || string[i] == ',' )				    {				        end1 = i;				        step = 3;					}				}				case 3:				{			        if((string[i] <= '9' && string[i] >= '0') || string[i] == '-')			        {			            start2 = i;			            step = 4;					}				}				case 4:				{				    if(string[i] == ' ' || string[i] == ',' )				    {				        end2 = i;				        step = 5;					}				}				case 5:				{			        if((string[i] <= '9' && string[i] >= '0') || string[i] == '-')			        {			            start3 = i;			            step = 6;					}				}				case 6:				{				    if(string[i] == ' ' || string[i] == ',' )				    {				        end3 = i;				        step = 7;					}				}				case 7:				{			        if((string[i] <= '9' && string[i] >= '0') || string[i] == '-')			        {			            start4 = i;			            step = 8;					}				}				case 8:				{				    if(string[i] == ' ' || string[i] == ',' )				    {				        end4 = i;				        step = 9;					}				}				case 9:				{			        if((string[i] <= '9' && string[i] >= '0') || string[i] == '-')			        {			            start5 = i;			            step = 10;					}				}				case 10:				{				    if(string[i] == ' ' || string[i] == ',' )				    {				        end5 = i;				        step = 11;					}				}				case 11:				{			        if((string[i] <= '9' && string[i] >= '0') || string[i] == '-')			        {			            start6 = i;			            step = 12;					}				}				case 12:				{				    if(string[i] == ' ' || string[i] == ',' )				    {				        end6 = i;				        step = 13;					}				}				case 13:				{			        if((string[i] <= '9' && string[i] >= '0') || string[i] == '-')			        {			            start7 = i;			            step = 14;					}				}				case 14:				{				    if(string[i] == ' ' || string[i] == ')' )				    {				        end7 = i;				        step = 15;					}				}			}		}		ObjectInfo[MAX_OBJECTS2][modelid] = strval(gimme(string,start1,end1));		ObjectInfo[MAX_OBJECTS2][x] = floatstr(gimme(string,start2,end2));		ObjectInfo[MAX_OBJECTS2][y] = floatstr(gimme(string,start3,end3));		ObjectInfo[MAX_OBJECTS2][z] = floatstr(gimme(string,start4,end4));		ObjectInfo[MAX_OBJECTS2][rx] = floatstr(gimme(string,start5,end5));		ObjectInfo[MAX_OBJECTS2][ry] = floatstr(gimme(string,start6,end6));		ObjectInfo[MAX_OBJECTS2][rz] = floatstr(gimme(string,start7,end7));	}	fclose(cfg);	SetTimer("NoLimitObject",150,1);	return 1;}gimme(str[],index,end){	new string[10];	strmid(string,str,index,end);	return string;}forward NoLimitObject();public NoLimitObject(){	for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)	{	    if(IsPlayerConnected(playerid))	    {	        for(new arrid = 0; arrid < MAX_OBJECTS2; arrid++)	        {                if(PlayerToPoint(150.0,playerid,ObjectInfo[arrid][x],ObjectInfo[arrid][y],ObjectInfo[arrid][z]))	            {	                if(!ObjectInfo[arrid][isset][playerid])	                {	                    ObjectInfo[arrid][realid][playerid] = CreatePlayerObject(playerid,ObjectInfo[arrid][modelid],ObjectInfo[arrid][x],ObjectInfo[arrid][y],ObjectInfo[arrid][z],ObjectInfo[arrid][rx],ObjectInfo[arrid][ry],ObjectInfo[arrid][rz]);                        ObjectInfo[arrid][isset][playerid] = true;                        //printf("Object Created %i %i",arrid,ObjectInfo[arrid][realid][playerid]);					}				}				else if(ObjectInfo[arrid][isset][playerid])				{				    DestroyPlayerObject(playerid,ObjectInfo[arrid][realid][playerid]);				    ObjectInfo[arrid][isset][playerid] = false;				    //printf("Object Destroyed %i %i",arrid,ObjectInfo[arrid][realid][playerid]);				}			}		}	}}forward PlayerToPoint(Float:radi, playerid, Float:x2, Float:y2, Float:z2);public PlayerToPoint(Float:radi, playerid, Float:x2, Float:y2, Float:z2){    if(IsPlayerConnected(playerid))	{		new Float:oldposx, Float:oldposy, Float:oldposz;		new Float:tempposx, Float:tempposy, Float:tempposz;		GetPlayerPos(playerid, oldposx, oldposy, oldposz);		tempposx = (oldposx -x2);		tempposy = (oldposy -y2);		tempposz = (oldposz -z2);		//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);		if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))		{			return 1;		}	}	return 0;}