SA-MP Forums Archive
Problems with npc - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problems with npc (/showthread.php?tid=266478)



Problems with npc - BizzyD - 04.07.2011

Hello, i got a problem with my npcs. The first npc loads good, but the second npc, wont load the items that i scripted.

This is how it looks:

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname));
        if(!strcmp(npcname, "intro", true))
        {
            PutPlayerInVehicle(playerid, introplane, 0);
            SetPlayerArmour(playerid, 0);
            SetPlayerColor(playerid, COLOR_WHITE);
        }
        if(strcmp(npcname, "cow1", true))
        {
            SetPlayerSkin(playerid,292);
            SetPlayerArmour(playerid, 0);
            SetPlayerColor(playerid, COLOR_WHITE);
            SetPlayerAttachedObject(playerid,2,16442,1,-0.41,0.12,-0.03,0.0,87.0,94.0,0.45,0.65,1.17);
        }
        return 1;
    }
But the npc dosent get the skin that i want, Or the object that i added to it. Anyone know how to fix this?

Regards, Alex


Re: Problems with npc - Cyanide - 05.07.2011

You should skim through your scripts more carefully. The code below:

pawn Код:
if(strcmp(npcname, "cow1", true))
{
    SetPlayerSkin(playerid,292);
    SetPlayerArmour(playerid, 0);
    SetPlayerColor(playerid, COLOR_WHITE);
    SetPlayerAttachedObject(playerid,2,16442,1,-0.41,0.12,-0.03,0.0,87.0,94.0,0.45,0.65,1.17);
}
should be:

pawn Код:
if(!strcmp(npcname, "cow1", true))
{
    SetPlayerSkin(playerid,292);
    SetPlayerArmour(playerid, 0);
    SetPlayerColor(playerid, COLOR_WHITE);
    SetPlayerAttachedObject(playerid,2,16442,1,-0.41,0.12,-0.03,0.0,87.0,94.0,0.45,0.65,1.17);
}
You have forgotten the exclamation mark in front of your function.


Re: Problems with npc - BizzyD - 05.07.2011

lol didnt see that :P thanks