Hey Leute,
ich möchte meinen Bots Skins zuweisen und habe daher bei OnPlayerSpawn folgendes gemacht:
if(IsPlayerNPC(playerid))
{
new npc = GetFreeNPCID();
if(!strcmp(PName[playerid],"ArbeitsamtBackground",true))
{
NPCID[npc] = playerid;
s_SetPlayerSkin(playerid,57);
}
else if(!strcmp(PName[playerid],"ArbeitsamtTresen",true))
{
NPCID[npc] = playerid;
s_SetPlayerSkin(playerid,141);
}
else if(!strcmp(PName[playerid],"DJ01",true))
{
NPCID[npc] = playerid;
s_SetPlayerSkin(playerid,19);
}
else if(!strcmp(PName[playerid],"StadthalleBG",true))
{
NPCID[npc] = playerid;
s_SetPlayerSkin(playerid,163);
}
...
}
Der Stock:
stock GetFreeNPCID()
{
for(new i=0; i<MAX_NPC; i++)
{
if(NPCID[i] != 0) continue;
return i;
}
return -1;
}
Die Variable NPCID:
new NPCID[MAX_NPC];
derStock s_SetPlayerSkin:
stock s_SetPlayerSkin(playerid,skin)
{
SetPlayerSkin(playerid,skin);
if(pInfo[playerid][pWeste] == 1)
{
SetPlayerAttachedObject(playerid,0,19142,1,WestePosInfo[skin][w_OffX],WestePosInfo[skin][w_OffY],WestePosInfo[skin][w_OffZ],WestePosInfo[skin][w_RotX],WestePosInfo[skin][w_RotY],WestePosInfo[skin][w_RotZ],WestePosInfo[skin][w_ScaX],WestePosInfo[skin][w_ScaY],WestePosInfo[skin][w_ScaZ]);
}
else
{
RemovePlayerAttachedObject(playerid,0);
}
return 1;
}
Komischerweise hatte es mal geklappt, weiß aber nicht mehr was genau ich editiert habe :o