NPC doesn't connect
#1

Here is my code, does anyone knows what's the problem?

pawn Код:
#include <a_samp>
#include <a_npc>
new admir;
new nedac;
new niel;
main()
{
}
public OnGameModeInit()
{
    ConnectNPC("Nedac","Nedac");
    ConnectNPC("Niel","Niel");
    ConnectNPC("Admir","Admir");
   
    nedac = AddStaticVehicle(596,2076.4067,222.7834,10.4165,178.8465,0,0);
    admir = AddStaticVehicle(596,2076.406,2227.7834,10.4165,178.8465,0,0);
    niel = AddStaticVehicle(596,207.4067,2227.7834,10.4165,178.8465,0,0);
    // Don't use these lines if it's a filterscript
    ShowNameTags(0);
    SetGameModeText("0");
    AddPlayerClass(223, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}
public OnPlayerSpawn(playerid)
{
    if(!IsPlayerNPC(playerid)) return 1; // If the player is not a NPC, nothing will happend

    new playername[64]; //Player String
    GetPlayerName(playerid,playername,64); //This is to get the NPC's name
    if(!strcmp(playername, "Admir", true)) { // Detecting if the NPC is spawned. If it is not spawned or the name is wrong, nothing will happend
        SetSpawnInfo( playerid, 0, 255, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
        //SetSpawnInfo( playerid, Team, Skin, x, y, z, rotation, weapon1, ammo for weapon1, w2, ammo2, w3, ammo3 );
        SetPlayerColor(playerid,0xFFFFFFFF); // Chose any color you want, this is currently white
        PutPlayerInVehicle(playerid, admir, 0);
        //PutPlayerInVehicle(playerid, vehiclename, seat);
    }
    if(!strcmp(playername, "Nedac", true)) { // Detecting if the NPC is spawned. If it is not spawned or the name is wrong, nothing will happend
        SetSpawnInfo( playerid, 0, 255, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
        //SetSpawnInfo( playerid, Team, Skin, x, y, z, rotation, weapon1, ammo for weapon1, w2, ammo2, w3, ammo3 );
        SetPlayerColor(playerid,0xFFFFFFFF); // Chose any color you want, this is currently white
        PutPlayerInVehicle(playerid, nedac, 0);
        //PutPlayerInVehicle(playerid, vehiclename, seat);
    }
    if(!strcmp(playername, "Niel", true)) { // Detecting if the NPC is spawned. If it is not spawned or the name is wrong, nothing will happend
        SetSpawnInfo( playerid, 0, 255, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
        //SetSpawnInfo( playerid, Team, Skin, x, y, z, rotation, weapon1, ammo for weapon1, w2, ammo2, w3, ammo3 );
        SetPlayerColor(playerid,0xFFFFFFFF); // Chose any color you want, this is currently white
        PutPlayerInVehicle(playerid, niel, 0);
        //PutPlayerInVehicle(playerid, vehiclename, seat);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)