public OnGameModeInit()
{
"informaciуn" //esto lo pongo aqui es para identificar la carpeta y su contenido.
return 1;
}
SetGameModeText("Ventura's DM~MG"); ShowPlayerMarkers(1); ShowNameTags(1); // skin para el jugador. AddPlayerClass(0,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1); AddPlayerClass(266,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1); AddPlayerClass(267,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1); AddPlayerClass(268,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); AddPlayerClass(269,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); AddPlayerClass(270,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); AddPlayerClass(271,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); AddPlayerClass(272,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
// Cargar Autos
new total_autos=0;
total_autos += LoadStaticVehiclesFromFile("vehiculos/autos.txt"); // Ruta donde estaran los autos
//----------------------------------------------------------
//
// GRAND LARCENY common functions include.
//
//----------------------------------------------------------
stock LoadStaticClassFromFile(const filename[])
{
new File:file_ptr;
new line[256];
new var_from_line[64];
new classtype;
new Float:SpawnX;
new Float:SpawnY;
new Float:SpawnZ;
new Float:SpawnRot;
new weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo;
new index;
new Class_loaded;
file_ptr = fopen(filename,filemode:io_read);
if(!file_ptr) return 0;
class_loaded = 0;
while(fread(file_ptr,line,256) > 0)
{
index = 0;
// Read type
index = token_by_delim(line,var_from_line,',',index);
if(index == (-1)) continue;
classtype = strval(var_from_line);
if(classtype < 0 || classtype > 299) continue;
// Read X, Y, Z, Rotation
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnX = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnY = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnZ = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnRot = floatstr(var_from_line);
// Read Color1, Color2
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
weapon1 = strval(var_from_line);
index = token_by_delim(line,var_from_line,';',index+1);
weapon1_ammo = strval(var_from_line);
// Read Color1, Color2
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
weapon2 = strval(var_from_line);
index = token_by_delim(line,var_from_line,';',index+1);
weapon2_ammo = strval(var_from_line);
// Read Color1, Color2
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
weapon3 = strval(var_from_line);
index = token_by_delim(line,var_from_line,';',index+1);
weapon3_ammo = strval(var_from_line);
//printf("%d,%d,%f,%f,%f,%f,%d,%d",total_vehicles_from_files+vehicles_loaded+1,vehicletype,SpawnX,SpawnY,SpawnZ,SpawnRot,Color1,Color2);
AddPlayerClass(classtype,SpawnX,SpawnY,SpawnZ,SpawnRot,weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo); // respawn 30 minutes
class_loaded++;
}
fclose(file_ptr);
printf("Loaded %d class from: %s",class_loaded,filename);
return class_loaded;
}
stock strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
//------------------------------------------------
stock strrest(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[128];
while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
//----------------------------------------------------------
// Tokenise by a delimiter
// Return string and index of the end determined by the
// provided delimiter in delim
stock token_by_delim(const string[], return_str[], delim, start_index)
{
new x=0;
while(string[start_index] != EOS && string[start_index] != delim) {
return_str[x] = string[start_index];
x++;
start_index++;
}
return_str[x] = EOS;
if(string[start_index] == EOS) start_index = (-1);
return start_index;
}
//----------------------------------------------------------
stock isNumeric(const string[])
{
new length=strlen(string);
if (length==0) return false;
for (new i = 0; i < length; i++)
{
if (
(string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+') // Not a number,'+' or '-'
|| (string[i]=='-' && i!=0) // A '-' but not at first.
|| (string[i]=='+' && i!=0) // A '+' but not at first.
) return false;
}
if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
return true;
}
//----------------------------------------------------------
stock IsKeyJustDown(key, newkeys, oldkeys)
{
if((newkeys & key) && !(oldkeys & key)) return 1;
return 0;
}
//----------------------------------------------------------
../include/gl_common.inc(25) : error 017: undefined symbol "class_loaded" ../include/gl_common.inc(25) : warning 215: expression has no effect ../include/gl_common.inc(82) : error 017: undefined symbol "class_loaded" ../include/gl_common.inc(82) : warning 215: expression has no effect ../include/gl_common.inc(86) : error 017: undefined symbol "class_loaded" ../include/gl_common.inc(87) : error 017: undefined symbol "class_loaded" ../include/gl_common.inc(20) : warning 203: symbol is never used: "Class_loaded" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
solo cambia todos tus class_loaded por Class_loaded el problema esta en el mayus de la primera letra loool!
|
stock LoadStaticClassFromFile(const filename[])
{
new File:file_ptr;
new line[256];
new var_from_line[64];
new Classtype;
new Float:SpawnX;
new Float:SpawnY;
new Float:SpawnZ;
new Float:SpawnRot;
new weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo;
new index;
new Class_loaded;
file_ptr = fopen(filename,filemode:io_read);
if(!file_ptr) return 0;
Class_loaded = 0;
while(fread(file_ptr,line,256) > 0)
{
index = 0;
// Read type
index = token_by_delim(line,var_from_line,',',index);
if(index == (-1)) continue;
Classtype = strval(var_from_line);
if(Classtype < 0 || Classtype > 299) continue;
// Read X, Y, Z, Rotation
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnX = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnY = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnZ = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
SpawnRot = floatstr(var_from_line);
// Read Color1, Color2
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
weapon1 = strval(var_from_line);
index = token_by_delim(line,var_from_line,';',index+1);
weapon1_ammo = strval(var_from_line);
// Read Color1, Color2
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
weapon2 = strval(var_from_line);
index = token_by_delim(line,var_from_line,';',index+1);
weapon2_ammo = strval(var_from_line);
// Read Color1, Color2
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
weapon3 = strval(var_from_line);
index = token_by_delim(line,var_from_line,';',index+1);
weapon3_ammo = strval(var_from_line);
//printf("%d,%d,%f,%f,%f,%f,%d,%d",total_vehicles_from_files+vehicles_loaded+1,vehicletype,SpawnX,SpawnY,SpawnZ,SpawnRot,Color1,Color2);
AddPlayerClass(Classtype,SpawnX,SpawnY,SpawnZ,SpawnRot,weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo);
Class_loaded++;
}
fclose(file_ptr);
printf("Loaded %d Class from: %s",Class_loaded,filename);
return Class_loaded;
}
Gracias,pero no me llames (lol) yo no te he ofendido un error lo comete cualquiera,ahora no hay error lo malo es que no funciona yo creo que el problema esta por aqui.
PHP код:
|
stock LoadClasses(Path[])
{
new line[64], File:Fhnd, Float:P[4], Ext[3];
if(!fexist(Path))return 0;
Fhnd = fopen(Path, io_read);
while(fread(File, line){
sscanf(line, "dffffdd", Ext[0], P[0], P[1], P[2], P[3], Ext[1], Ext[2]);
AddPlayerClass(Ext[0], P[0], P[1], P[2], P[3], Ext[1], Ext[2]);
}
return 1;
}