Guten Tag
Ich habe einen Zugbot hinzugefüft mithelilfe vom Tutorial.
Nun joint dieser auch. Sobald man sich registriert, soll man für ein paar sekunden den Bot beobachten, danach beginnt das tutorial.
Jedoch disconnected der Bot kurznachdem ich connecte..
Hier ma alles was mit dem Bot zu tuhen hat:
OnGameModeInit()
{
/*~~~Bots:~~~*/
ConnectNPC("Intro","Intro"); //Zug-Noob-Bot
Botcar[0] = AddStaticVehicle(538,1700.7551,-1953.6531,14.8756,200.0,-1,-1); // zug
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(Botcar[0], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(Botcar[0],1,1,alarm,doors,bonnet,boot,objective);
SetVehicleVirtualWorld(Botcar[0],1);
return 1;
}
public OnPlayerSpawn(playerid)
{
SetPlayerColor(playerid,0xFFFFFF00);
TextDrawShowForPlayer(playerid,komma);
TogglePlayerControllable(playerid,1);
SetPlayerVirtualWorld(playerid,0);
SetPlayerSkin(playerid,Spieler[playerid][Skin]);
if(pregister[playerid] == 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerNPC(i))
{
new botname[MAX_PLAYER_NAME];
GetPlayerName(i, botname, sizeof(botname));
if(!strcmp(botname, "Intro", true))
{
tv[playerid][i] = 1;
PlayerSpectateVehicle(playerid,Botcar[0]);
TogglePlayerSpectating(playerid,1);
tuttimer[playerid] = SetTimerEx("tutorial",10000,0,"i",playerid);
}
}
}
}
else
{
SetPlayerSpawn(playerid);
}
if(IsPlayerNPC(playerid))
{
new botname[MAX_PLAYER_NAME];
GetPlayerName(playerid, botname, sizeof(botname));
if(!strcmp(botname, "Intro", true))
{
SetPlayerSkin(playerid,0);
SetPlayerVirtualWorld(playerid,1);
PutPlayerInVehicle(playerid, Botcar[0], 0);
}
}
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
if(!IsPlayerNPC(playerid))
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
if(registriert[playerid] == 1)
{
new str[100];
format(str,sizeof(str),"Guten Tag %s,\n\nIhr Account wurde wiedererkannt.\nLoggen Sie sich mit ihr Passwort ein!",name);
ShowPlayerDialog(playerid,Dialog_Login,DIALOG_STYLE_INPUT,"Login",str,"Okay","Cancel");
}
else
{
new str[100];
format(str,sizeof(str),"Guten Tag %s,\n\nSie besitzen noch kein Account.\nRegistrieren Sie sich mit einem Passwort!",name);
ShowPlayerDialog(playerid,Dialog_Regis,DIALOG_STYLE_INPUT,"Login",str,"Okay","Cancel");
}
}
else
{
new botname[MAX_PLAYER_NAME];
GetPlayerName(playerid, botname, sizeof(botname));
if(!strcmp(botname, "Intro", true))
{
SpawnPlayer(playerid);
}
}
return 1;
}
public OnPlayerConnect(playerid)
{
SetPlayerColor(playerid,0xFFFFFF00);
new name[MAX_PLAYER_NAME], Spielerdatei[50];
GetPlayerName(playerid,name,sizeof(name));
if(!IsPlayerNPC(playerid))
{
format(Spielerdatei,sizeof(Spielerdatei),"/Users/%s.ini",name);
if(dini_Exists(Spielerdatei))
{
registriert[playerid] = 1;
}
else
{
registriert[playerid] = 0;
}
falschespw[playerid] = 3;
}
else
{
new botname[MAX_PLAYER_NAME];
GetPlayerName(playerid, botname, sizeof(botname));
if(!strcmp(botname, "Intro", true))
{
login[playerid] = 1;
}
}
return 1;
}
public tutorial(playerid)
{
TogglePlayerSpectating(playerid,0);
SetPlayerVirtualWorld(playerid,2);
TogglePlayerControllable(playerid,0);
SetPlayerCameraPos(playerid,-842.1766,-1387.2435,90.1723);
SetPlayerCameraLookAt(playerid,-836.0152,-1389.2963,90.2541);
SendClientMessage(playerid,0xFF5660FF,"[Tutorial] Wir benötigen noch ein Paar Informationen für ihr Personalausweis...");
ShowPlayerDialog(playerid,Dialog_Zugbot,DIALOG_STYLE_LIST,"In Welcher Stadt möchtest du spawnen?","Los Santos\nSan Fierro\nLasVenturas","Okay","");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerNPC(i))
{
new botname[MAX_PLAYER_NAME];
GetPlayerName(i, botname, sizeof(botname));
if(!strcmp(botname, "Intro", true))
{
tv[playerid][i] = 0;
}
}
}
return 1;
}
Ich hoffe ihr könnt mir da weiterhelfen
Mfg
Simon