Hallo mein Lieben Leute,
Ich hab eine abfrage gemacht aber wen ich in gam bin dan kann nur die fraktion mit der nummer 1 Alle autos fahren und die anderen keine warum ?
public OnPlayerStateChange(playerid, newstate, oldstate)
{
for (new i=0; i< MAX_VEHICLES; i++)
{
if(newstate==PLAYER_STATE_DRIVER)
{
if(AutoInfo[i][frakid] != 1)
{
if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1)
{
SendClientMessage(playerid,ROT,"Du bist in der Fraktion !");
return 1;
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,ROT,"Du bist nicht in der Fraktion !");
return 1;
}
}
}
if(newstate==PLAYER_STATE_DRIVER)
{
if(AutoInfo[i][frakid] != 5)
{
if(PlayerInfo[playerid][pLeader] != 5 || PlayerInfo[playerid][pMember] != 5)
{
SendClientMessage(playerid,ROT,"Du bist in der Fraktion !");
return 1;
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,ROT,"Du bist nicht in der Fraktion !");
return 1;
}
}
}
if(newstate==PLAYER_STATE_DRIVER)
{
if(AutoInfo[i][frakid] != 0)
{
if(PlayerInfo[playerid][pLeader] == 0 || PlayerInfo[playerid][pMember] == 0)
{
return 1;
}
}
}
}
return 1;
}
Hier die Mysql-Abfrage
stock LoadAutosData()
{
for(new i;i<MAX_VEHICLES;i++)
{
new query[128],data[128],bedienung[40];
format(bedienung,sizeof(bedienung),"id='%i'",i);
format(query,sizeof(query),"SELECT * FROM cardata WHERE %s", bedienung);//Die query
mysql_query(query);
mysql_store_result();
if(mysql_num_rows())// Eine Abfrage zur Sicherheit
{
mysql_fetch_field("Fraknummer",data);
AutoInfo[i][frakid]=strval(data);
strdel(data,0,100);
mysql_fetch_field("CarID",data);
AutoInfo[i][carid]=strval(data);
strdel(data,0,100);
mysql_fetch_field("X",data);
AutoInfo[i][PosX]=strval(data);
strdel(data,0,100);
mysql_fetch_field("Y",data);
AutoInfo[i][PosY]=strval(data);
strdel(data,0,100);
mysql_fetch_field("Z",data);
AutoInfo[i][PosZ]=strval(data);
strdel(data,0,100);
mysql_fetch_field("A",data);
AutoInfo[i][PosA]=strval(data);
strdel(data,0,100);
mysql_fetch_field("Farbe1",data);
AutoInfo[i][Farbe1]=strval(data);
strdel(data,0,100);
mysql_fetch_field("Farbe2",data);
AutoInfo[i][Farbe2]=strval(data);
strdel(data,0,100);
}
mysql_free_result();
}
return printf("Autos wurden Geladen");
}
public OnGameModeInit()
{
for(new i;i<MAX_VEHICLES;i++)
{
AutoInfo[i][frakid] = CreateVehicle(AutoInfo[i][carid],AutoInfo[i][PosX],AutoInfo[i][PosY],AutoInfo[i][PosZ],AutoInfo[i][PosA],AutoInfo[i][Farbe1],AutoInfo[i][Farbe2],-1);
}
return 1;
}
Bitte um Hilfe
MFG
Ingo
//Edit Titel bearbeitet