Hallo wenn ich die Spawns der Fraktionen aus der Datenbank lesen will geht es aber er Spawn mich immer am 0 Punkt.
Hier der CODE:
ENUM:
enum fracEnum {
f_id,
f_name[128],
Float:f_spawnX,
Float:f_spawnY,
Float:f_spawnZ,
Float:f_spawnR,
f_int,
f_world
}
OnFrakLoad:
public OnFrakLoad()
{
new num_fields,num_rows;
cache_get_data(num_rows,num_fields,handle);
if(!num_rows)return 1;
for(new i = 0;i<num_rows;i++)
{
new id=getFreeFrakID();
//NAME
new tmp_name[35];
cache_get_field_content(i,"Name",tmp_name,handle);
strmid(fInfo[id][f_name],tmp_name,0,sizeof(tmp_name),sizeof(tmp_name));
//X
fInfo[id][f_spawnX] = cache_get_field_content_float(i,"spawnX",handle);
//Y
fInfo[id][f_spawnY] = cache_get_field_content_float(i,"spawnY",handle);
//Z
fInfo[id][f_spawnZ] = cache_get_field_content_float(i,"spawnZ",handle);
//R
fInfo[id][f_spawnR] = cache_get_field_content_float(i,"spawnR",handle);
//INT
fInfo[id][f_int] = cache_get_field_content_int(i,"Interior",handle);
//WORLD
fInfo[id][f_world] = cache_get_field_content_int(i,"World",handle);
//ID
fInfo[id][f_id] = cache_get_field_content_int(i,"id",handle);
printf("Name: %s",fInfo[id][f_name]);
}
return 1;
}
getFreeFrakID:
getFreeFrakID()
{
for(new i=0;i< sizeof(fInfo); i++)
{
if(fInfo[i][f_id]== 0) return i;
}
return 0;
}
OnPlayerSpawn:
public OnPlayerSpawn(playerid)
{
new frak = sInfo[playerid][Fraktion];
if(frak == 0)
{
//ZIVILIST
SetPlayerPos(playerid,2031.5146,1343.5313,10.8203);
SetPlayerFacingAngle(playerid,270.0591);
return 1;
}
else
{
//FRAKTION
SetPlayerPos(playerid,fInfo[frak][f_spawnX],fInfo[frak][f_spawnY],fInfo[frak][f_spawnZ]);
SetPlayerFacingAngle(playerid,fInfo[frak][f_spawnR]);
SetPlayerInterior(playerid,fInfo[frak][f_int]);
SetPlayerVirtualWorld(playerid,fInfo[frak][f_world]);
}
ClearChat(playerid);
return 1;
}