SA-MP Forums Archive
Help About 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)
+--- Thread: Help About Npc (/showthread.php?tid=500704)



Help About Npc - alishvasis - 14.03.2014

Hi all.
hOW cAN i make Re Spawn CMd that the BOT Npc car dont Re spawn
I Make This CMD But Re Spawned Npc Bots Car When I Use This CMD.... Any One Can Fix It ? TNX + Rep
Код:
#pragma unused params
	for(new i = 0; i < MAX_VEHICLES; i++)
   {
 	 if(!IsPlayerNPC(playerid)) return 0;
     SetVehicleToRespawn(i);
   }
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "[News] %sRe Spawned All Cars.",name);
    SendClientMessageToAll(COLOR_PINK, string);
    return 1;
   }



Re: Help About Npc - Matess - 14.03.2014

try
pawn Код:
#pragma unused params
    for(new i = 0; i < MAX_VEHICLES; i++)
   {
     if(IsPlayerInVehicle(-1, i)) continue;
     SetVehicleToRespawn(i);
   }
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "[News] %sRe Spawned All Cars.",name);
    SendClientMessageToAll(COLOR_PINK, string);
    return 1;
   }



Re: Help About Npc - alishvasis - 14.03.2014

Not Work


Re: Help About Npc - alishvasis - 14.03.2014

help me i Need it


AW: Help About Npc - Macronix - 14.03.2014

Try this:
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
    {
        for(new v = 1; v < MAX_VEHICLES; v++)
        {
            if(IsPlayerNPC(i) && IsPlayerInVehicle(i, GetPlayerVehicleID(i))) continue;
            SetVehicleToRespawn(v);
        }
    }
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "[News] %sRe Spawned All Cars.",name);
    SendClientMessageToAll(COLOR_PINK, string);
    return 1;
}



Re: Help About Npc - Matess - 14.03.2014

DELETED


Re: Help About Npc - alishvasis - 14.03.2014

Not Work re Spawned NPC bot Car !!!1


AW: Help About Npc - Macronix - 14.03.2014

Oh, mmh, then try to replace the IsPlayerInVehicle with a IsPlayerInAnyVehicle(i);


Re: AW: Help About Npc - alishvasis - 14.03.2014

Quote:
Originally Posted by Macronix
Посмотреть сообщение
Oh, mmh, then try to replace the IsPlayerInVehicle with a IsPlayerInAnyVehicle(i);
Not Work I Need This


AW: Help About Npc - Macronix - 14.03.2014

Last try..

pawn Код:
new bool:notnpcvehicle[MAX_VEHICLES];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerNPC(i) && IsPlayerInAnyVehicle(i)) { notnpcvehicle[GetPlayerVehicleID(i)]=true; }
    }
    for(new v = 0; v < MAX_VEHICLES; v++)
    {
        if(!notnpcvehicle[v])
        {
            SetVehicleToRespawn(v);
        }
    }
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "[News] %sRe Spawned All Cars.",name);
    SendClientMessageToAll(COLOR_PINK, string);
    return 1;
}